Updates /graph/beasdk/beta_service_test.go
File renamed to beta_client_test.go. Comments updated.
This commit is contained in:
parent
f8d65d66de
commit
b3aec1b40f
80
src/internal/connector/graph/betasdk/beta_client_test.go
Normal file
80
src/internal/connector/graph/betasdk/beta_client_test.go
Normal file
@ -0,0 +1,80 @@
|
||||
package betasdk
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
)
|
||||
|
||||
type BetaClientSuite struct {
|
||||
suite.Suite
|
||||
credentials account.M365Config
|
||||
}
|
||||
|
||||
func TestBetaClientSuite(t *testing.T) {
|
||||
suite.Run(t, new(BetaClientSuite))
|
||||
}
|
||||
|
||||
func (suite *BetaClientSuite) SetupSuite() {
|
||||
t := suite.T()
|
||||
a := tester.NewM365Account(t)
|
||||
m365, err := a.M365Config()
|
||||
require.NoError(t, err)
|
||||
|
||||
suite.credentials = m365
|
||||
}
|
||||
|
||||
func (suite *BetaClientSuite) TestCreateBetaClient() {
|
||||
t := suite.T()
|
||||
adpt, err := graph.CreateAdapter(
|
||||
suite.credentials.AzureTenantID,
|
||||
suite.credentials.AzureClientID,
|
||||
suite.credentials.AzureClientSecret,
|
||||
)
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
client := NewBetaClient(adpt)
|
||||
assert.NotNil(t, client)
|
||||
}
|
||||
|
||||
// TestBasicClientGetFunctionality. Tests that adapter is able
|
||||
// to parse retrieved Site Page. Additional tests should
|
||||
// be handled within the /internal/connector/sharepoint when
|
||||
// additional features are added.
|
||||
func (suite *BetaClientSuite) TestBasicClientGetFunctionality() {
|
||||
ctx, flush := tester.NewContext()
|
||||
defer flush()
|
||||
t := suite.T()
|
||||
adpt, err := graph.CreateAdapter(
|
||||
suite.credentials.AzureTenantID,
|
||||
suite.credentials.AzureClientID,
|
||||
suite.credentials.AzureClientSecret,
|
||||
)
|
||||
|
||||
require.NoError(t, err)
|
||||
client := NewBetaClient(adpt)
|
||||
require.NotNil(t, client)
|
||||
|
||||
siteID := tester.M365SiteID(t)
|
||||
// TODO(dadams39) document allowable calls in main
|
||||
collection, err := client.SitesById(siteID).Pages().Get(ctx, nil)
|
||||
// Ensures that the client is able to receive data from beta
|
||||
// Not Registered Error: content type application/json does not have a factory registered to be parsed
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, page := range collection.GetValue() {
|
||||
assert.NotNil(t, page, "betasdk call for page does not return value.")
|
||||
|
||||
if page != nil {
|
||||
t.Logf("Page :%s ", *page.GetName())
|
||||
assert.NotNil(t, page.GetId())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package betasdk
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/suite"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/tester"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
)
|
||||
|
||||
type BetaClientSuite struct {
|
||||
suite.Suite
|
||||
credentials account.M365Config
|
||||
}
|
||||
|
||||
func TestBetaClientSuite(t *testing.T) {
|
||||
suite.Run(t, new(BetaClientSuite))
|
||||
}
|
||||
|
||||
func (suite *BetaClientSuite) SetupSuite() {
|
||||
t := suite.T()
|
||||
a := tester.NewM365Account(t)
|
||||
m365, err := a.M365Config()
|
||||
require.NoError(t, err)
|
||||
|
||||
suite.credentials = m365
|
||||
}
|
||||
|
||||
func (suite *BetaClientSuite) TestCreateSite() {
|
||||
t := suite.T()
|
||||
adpt, err := graph.CreateAdapter(
|
||||
suite.credentials.AzureTenantID,
|
||||
suite.credentials.AzureClientID,
|
||||
suite.credentials.AzureClientSecret,
|
||||
)
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
client := NewBetaClient(adpt)
|
||||
assert.NotNil(t, client)
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user