corso/src/pkg/services/m365/m365_test.go
ashmrtn 40cb810861
Use test wrapper in pkg package (#2531)
## Description

Leave out account and storage subpackages as those are used by tester and create an import cycle.

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

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No 

## Type of change

- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Test
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup

## Issue(s)

* #2373

## Test Plan

- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
2023-02-25 04:50:00 +00:00

51 lines
971 B
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 {
tester.Suite
}
func TestM365IntegrationSuite(t *testing.T) {
suite.Run(t, &M365IntegrationSuite{
Suite: tester.NewIntegrationSuite(
t,
[][]string{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 {
suite.Run("user_"+u.ID, func() {
t := suite.T()
assert.NotEmpty(t, u.ID)
assert.NotEmpty(t, u.PrincipalName)
assert.NotEmpty(t, u.Name)
})
}
}