Updates to /connector/sharepoint/helper_test.go

Updates to createTestService method.
Creates createTestBetaService().
This commit is contained in:
Danny Adams 2023-01-27 13:12:18 -05:00
parent 30ce9cafc9
commit a7ea30e109

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
"github.com/pkg/errors"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/graph"
"github.com/alcionai/corso/src/internal/connector/graph/betasdk"
"github.com/alcionai/corso/src/internal/connector/onedrive" "github.com/alcionai/corso/src/internal/connector/onedrive"
"github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/account"
) )
@ -33,17 +33,26 @@ func (ms *MockGraphService) Adapter() *msgraphsdk.GraphRequestAdapter {
// Helper Functions // Helper Functions
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
func createTestService(credentials account.M365Config) (*graph.Service, error) { func createTestService(t *testing.T, credentials account.M365Config) *graph.Service {
adapter, err := graph.CreateAdapter( adapter, err := graph.CreateAdapter(
credentials.AzureTenantID, credentials.AzureTenantID,
credentials.AzureClientID, credentials.AzureClientID,
credentials.AzureClientSecret, credentials.AzureClientSecret,
) )
if err != nil { require.NoError(t, err, "creating microsoft graph service for exchange")
return nil, errors.Wrap(err, "creating microsoft graph service for exchange")
}
return graph.NewService(adapter), nil return graph.NewService(adapter)
}
func createTestBetaService(t *testing.T, credentials account.M365Config) *betasdk.Service {
adapter, err := graph.CreateAdapter(
credentials.AzureTenantID,
credentials.AzureClientID,
credentials.AzureClientSecret,
)
require.NoError(t, err)
return betasdk.NewService(adapter)
} }
func expectedPathAsSlice(t *testing.T, tenant, user string, rest ...string) []string { func expectedPathAsSlice(t *testing.T, tenant, user string, rest ...string) []string {