remove expand drive from root site (#4377)

missed the root site call usage of expand drive
on the last fix.

---

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🐛 Bugfix

#### Issue(s)

* #4337

#### Test Plan

- [x] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
This commit is contained in:
Keepers 2023-09-26 16:32:15 -06:00 committed by GitHub
parent f37e58ee5c
commit a8a2aee99d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 8 deletions

View File

@ -7,10 +7,11 @@ import (
"github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/pkg/services/m365/api"
) )
type getSiteRooter interface { type getSiteRooter interface {
GetRoot(ctx context.Context) (models.Siteable, error) GetRoot(ctx context.Context, cc api.CallConfig) (models.Siteable, error)
} }
func IsServiceEnabled( func IsServiceEnabled(
@ -18,7 +19,7 @@ func IsServiceEnabled(
gsr getSiteRooter, gsr getSiteRooter,
resource string, resource string,
) (bool, error) { ) (bool, error) {
_, err := gsr.GetRoot(ctx) _, err := gsr.GetRoot(ctx, api.CallConfig{})
if err != nil { if err != nil {
if clues.HasLabel(err, graph.LabelsNoSharePointLicense) { if clues.HasLabel(err, graph.LabelsNoSharePointLicense) {
return false, nil return false, nil

View File

@ -12,6 +12,7 @@ import (
"github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/internal/m365/graph"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/pkg/services/m365/api"
) )
type EnabledUnitSuite struct { type EnabledUnitSuite struct {
@ -29,7 +30,10 @@ type mockGSR struct {
err error err error
} }
func (m mockGSR) GetRoot(context.Context) (models.Siteable, error) { func (m mockGSR) GetRoot(
context.Context,
api.CallConfig,
) (models.Siteable, error) {
return m.response, m.err return m.response, m.err
} }

View File

@ -35,11 +35,16 @@ type Sites struct {
// api calls // api calls
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
func (c Sites) GetRoot(ctx context.Context) (models.Siteable, error) { func (c Sites) GetRoot(
ctx context.Context,
cc CallConfig,
) (models.Siteable, error) {
options := &sites.SiteItemRequestBuilderGetRequestConfiguration{ options := &sites.SiteItemRequestBuilderGetRequestConfiguration{
QueryParameters: &sites.SiteItemRequestBuilderGetQueryParameters{ QueryParameters: &sites.SiteItemRequestBuilderGetQueryParameters{},
Expand: []string{"drive"}, }
},
if len(cc.Expand) > 0 {
options.QueryParameters.Expand = cc.Expand
} }
resp, err := c.Stable. resp, err := c.Stable.

View File

@ -256,7 +256,7 @@ func (suite *SitesIntgSuite) TestGetRoot() {
ctx, flush := tester.NewContext(t) ctx, flush := tester.NewContext(t)
defer flush() defer flush()
result, err := suite.its.ac.Sites().GetRoot(ctx) result, err := suite.its.ac.Sites().GetRoot(ctx, api.CallConfig{Expand: []string{"drive"}})
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, result, "must find the root site") require.NotNil(t, result, "must find the root site")
require.NotEmpty(t, ptr.Val(result.GetId()), "must have an id") require.NotEmpty(t, ptr.Val(result.GetId()), "must have an id")