Updates to /connector/sharepoint/collection_test.go TestSharePointPageCollection_Populate() added. Ensures serialization of single page completes without issue.
This commit is contained in:
parent
d2c5ad45bf
commit
3c7c156e72
@ -95,6 +95,51 @@ func (suite *SharePointCollectionSuite) TestSharePointListCollection() {
|
|||||||
assert.Equal(t, testName, shareInfo.Info().SharePoint.ItemName)
|
assert.Equal(t, testName, shareInfo.Info().SharePoint.ItemName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *SharePointCollectionSuite) TestSharePointPageCollection_Populate() {
|
||||||
|
ctx, flush := tester.NewContext()
|
||||||
|
defer flush()
|
||||||
|
|
||||||
|
t := suite.T()
|
||||||
|
count := 1
|
||||||
|
siteID := tester.M365SiteID(t)
|
||||||
|
a := tester.NewM365Account(t)
|
||||||
|
account, err := a.M365Config()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
service, err := createTestService(account)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
tuples, err := fetchPages(ctx, service, siteID)
|
||||||
|
require.NoError(t, err)
|
||||||
|
require.NotEmpty(t, tuples)
|
||||||
|
|
||||||
|
dir, err := path.Builder{}.Append("directory").
|
||||||
|
ToDataLayerSharePointPath(
|
||||||
|
"tenant",
|
||||||
|
siteID,
|
||||||
|
path.PagesCategory,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
col := NewCollection(dir, service, Pages, nil)
|
||||||
|
col.jobs = []string{tuples[0].id}
|
||||||
|
|
||||||
|
streamChannel := col.Items()
|
||||||
|
|
||||||
|
// Verify that each message can be restored
|
||||||
|
for stream := range streamChannel {
|
||||||
|
buf := &bytes.Buffer{}
|
||||||
|
|
||||||
|
read, err := buf.ReadFrom(stream.ToReader())
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NotZero(t, read)
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, count, 1)
|
||||||
|
}
|
||||||
|
|
||||||
// TestRestoreListCollection verifies Graph Restore API for the List Collection
|
// TestRestoreListCollection verifies Graph Restore API for the List Collection
|
||||||
func (suite *SharePointCollectionSuite) TestRestoreListCollection() {
|
func (suite *SharePointCollectionSuite) TestRestoreListCollection() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user