Updates /connector/sharepoint/data_collections.go and data_collections_test.go
Lint ignore removed. collectPages() method updated --> Scope not necessary Test Suite adds test for functionality.
This commit is contained in:
parent
5ca341eb56
commit
8b831d34f0
@ -163,14 +163,11 @@ func collectLibraries(
|
|||||||
|
|
||||||
// collectPages constructs a sharepoint Collections struct and Get()s the associated
|
// collectPages constructs a sharepoint Collections struct and Get()s the associated
|
||||||
// M365 IDs for the associated Pages
|
// M365 IDs for the associated Pages
|
||||||
//
|
|
||||||
//nolint:unused
|
|
||||||
func collectPages(
|
func collectPages(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
creds account.M365Config,
|
creds account.M365Config,
|
||||||
serv graph.Servicer,
|
serv graph.Servicer,
|
||||||
tenantID, siteID string,
|
tenantID, siteID string,
|
||||||
scope selectors.SharePointScope,
|
|
||||||
updater statusUpdater,
|
updater statusUpdater,
|
||||||
ctrlOpts control.Options,
|
ctrlOpts control.Options,
|
||||||
) ([]data.Collection, error) {
|
) ([]data.Collection, error) {
|
||||||
|
|||||||
@ -5,10 +5,12 @@ import (
|
|||||||
|
|
||||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||||
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/control"
|
"github.com/alcionai/corso/src/pkg/control"
|
||||||
"github.com/alcionai/corso/src/pkg/selectors"
|
"github.com/alcionai/corso/src/pkg/selectors"
|
||||||
@ -128,3 +130,37 @@ func driveItem(name string, path string, isFile bool) models.DriveItemable {
|
|||||||
|
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SharePointPagesSuite struct {
|
||||||
|
suite.Suite
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSharePointPagesSuite(t *testing.T) {
|
||||||
|
tester.RunOnAny(
|
||||||
|
t,
|
||||||
|
tester.CorsoCITests,
|
||||||
|
tester.CorsoGraphConnectorTests,
|
||||||
|
tester.CorsoGraphConnectorSharePointTests)
|
||||||
|
suite.Run(t, new(SharePointPagesSuite))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *SharePointPagesSuite) TestCollectPages() {
|
||||||
|
ctx, flush := tester.NewContext()
|
||||||
|
defer flush()
|
||||||
|
|
||||||
|
t := suite.T()
|
||||||
|
siteID := tester.M365SiteID(t)
|
||||||
|
a := tester.NewM365Account(t)
|
||||||
|
account, err := a.M365Config()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
updateFunc := func(*support.ConnectorOperationStatus) {
|
||||||
|
t.Log("Updater Called ")
|
||||||
|
}
|
||||||
|
|
||||||
|
updater := &MockUpdater{UpdateState: updateFunc}
|
||||||
|
|
||||||
|
col, err := collectPages(ctx, account, nil, account.AzureTenantID, siteID, updater, control.Options{})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NotEmpty(t, col)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user