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:
parent
f37e58ee5c
commit
a8a2aee99d
@ -7,10 +7,11 @@ import (
|
||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/m365/graph"
|
||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
||||
)
|
||||
|
||||
type getSiteRooter interface {
|
||||
GetRoot(ctx context.Context) (models.Siteable, error)
|
||||
GetRoot(ctx context.Context, cc api.CallConfig) (models.Siteable, error)
|
||||
}
|
||||
|
||||
func IsServiceEnabled(
|
||||
@ -18,7 +19,7 @@ func IsServiceEnabled(
|
||||
gsr getSiteRooter,
|
||||
resource string,
|
||||
) (bool, error) {
|
||||
_, err := gsr.GetRoot(ctx)
|
||||
_, err := gsr.GetRoot(ctx, api.CallConfig{})
|
||||
if err != nil {
|
||||
if clues.HasLabel(err, graph.LabelsNoSharePointLicense) {
|
||||
return false, nil
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/alcionai/corso/src/internal/m365/graph"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
||||
)
|
||||
|
||||
type EnabledUnitSuite struct {
|
||||
@ -29,7 +30,10 @@ type mockGSR struct {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@ -35,11 +35,16 @@ type Sites struct {
|
||||
// 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{
|
||||
QueryParameters: &sites.SiteItemRequestBuilderGetQueryParameters{
|
||||
Expand: []string{"drive"},
|
||||
},
|
||||
QueryParameters: &sites.SiteItemRequestBuilderGetQueryParameters{},
|
||||
}
|
||||
|
||||
if len(cc.Expand) > 0 {
|
||||
options.QueryParameters.Expand = cc.Expand
|
||||
}
|
||||
|
||||
resp, err := c.Stable.
|
||||
|
||||
@ -256,7 +256,7 @@ func (suite *SitesIntgSuite) TestGetRoot() {
|
||||
ctx, flush := tester.NewContext(t)
|
||||
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.NotNil(t, result, "must find the root site")
|
||||
require.NotEmpty(t, ptr.Val(result.GetId()), "must have an id")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user