corso/src/pkg/services/m365/m365_test.go
Keepers 680ec2b751
adding fault/clues to non-service connector pkgs (#2380)
## Does this PR need a docs update or release note?

- [x]  No 

## Type of change

- [x] 🧹 Tech Debt/Cleanup

## Issue(s)

* #1970

## Test Plan

- [x]  Unit test
- [x] 💚 E2E
2023-02-13 16:54:09 +00:00

49 lines
1.0 KiB
Go

package m365
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/pkg/fault"
)
type M365IntegrationSuite struct {
suite.Suite
}
func TestM365IntegrationSuite(t *testing.T) {
tester.RunOnAny(t, tester.CorsoCITests)
suite.Run(t, new(M365IntegrationSuite))
}
func (suite *M365IntegrationSuite) SetupSuite() {
tester.MustGetEnvSets(suite.T(), tester.M365AcctCredEnvs)
}
func (suite *M365IntegrationSuite) TestUsers() {
ctx, flush := tester.NewContext()
defer flush()
var (
t = suite.T()
acct = tester.NewM365Account(suite.T())
)
users, err := Users(ctx, acct, fault.New(true))
require.NoError(t, err)
require.NotNil(t, users)
require.Greater(t, len(users), 0)
for _, u := range users {
t.Run("user_"+u.ID, func(t *testing.T) {
assert.NotEmpty(t, u.ID)
assert.NotEmpty(t, u.PrincipalName)
assert.NotEmpty(t, u.Name)
})
}
}