Skip to content

Commit

Permalink
fetches lists using Lists client wrapper (#4787)
Browse files Browse the repository at this point in the history
fetches lists and its relationships using Lists client wrapper

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
  • Loading branch information
HiteshRepo authored Dec 5, 2023
1 parent a2637a9 commit 3971031
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 103 deletions.
16 changes: 10 additions & 6 deletions src/internal/m365/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/alcionai/corso/src/pkg/selectors"
selTD "github.com/alcionai/corso/src/pkg/selectors/testdata"
"github.com/alcionai/corso/src/pkg/services/m365/api"
"github.com/alcionai/corso/src/pkg/services/m365/api/graph"
)

// ---------------------------------------------------------------------------
Expand All @@ -53,6 +54,10 @@ func TestDataCollectionIntgSuite(t *testing.T) {
func (suite *DataCollectionIntgSuite) SetupSuite() {
t := suite.T()

ctx, flush := tester.NewContext(t)
defer flush()
graph.InitializeConcurrencyLimiter(ctx, false, 4)

suite.user = tconfig.M365UserID(t)
suite.site = tconfig.M365SiteID(t)

Expand Down Expand Up @@ -274,7 +279,6 @@ func (suite *DataCollectionIntgSuite) TestSharePointDataCollection() {
ctrl := newController(ctx, suite.T(), path.SharePointService)
tests := []struct {
name string
expected int
getSelector func() selectors.Selector
}{
{
Expand All @@ -286,8 +290,7 @@ func (suite *DataCollectionIntgSuite) TestSharePointDataCollection() {
},
},
{
name: "Lists",
expected: 0,
name: "Lists",
getSelector: func() selectors.Selector {
sel := selectors.NewSharePointBackup(selSites)
sel.Include(sel.Lists(selectors.Any()))
Expand Down Expand Up @@ -329,8 +332,8 @@ func (suite *DataCollectionIntgSuite) TestSharePointDataCollection() {
}

// we don't know an exact count of drives this will produce,
// but it should be more than one.
assert.Less(t, test.expected, len(collections))
// but it should be more than zero.
assert.NotEmpty(t, collections)

for _, coll := range collections {
for object := range coll.Items(ctx, fault.New(true)) {
Expand Down Expand Up @@ -465,7 +468,8 @@ func (suite *SPCollectionIntgSuite) TestCreateSharePointCollection_Lists() {
assert.True(t, excludes.Empty())

for _, collection := range cols {
t.Logf("Path: %s\n", collection.FullPath().String())
assert.Equal(t, path.SharePointService, collection.FullPath().Service())
assert.Equal(t, path.ListsCategory, collection.FullPath().Category())

for item := range collection.Items(ctx, fault.New(true)) {
t.Log("File: " + item.ID())
Expand Down
Loading

0 comments on commit 3971031

Please sign in to comment.