Unexport functions and fields in api package (#4547)
Unexport a bunch of stuff that isn't used outside the package. Also use the same package for tests Mostly renaming with some minor dead code cleanup --- #### 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] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Test Plan - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
058a3f47a6
commit
8102523dc6
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/account"
|
"github.com/alcionai/corso/src/pkg/account"
|
||||||
"github.com/alcionai/corso/src/pkg/control"
|
"github.com/alcionai/corso/src/pkg/control"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AccessAPIIntgSuite struct {
|
type AccessAPIIntgSuite struct {
|
||||||
@ -110,7 +109,7 @@ func (suite *AccessAPIIntgSuite) TestGetToken() {
|
|||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
ac, err := api.NewClient(suite.its.ac.Credentials, control.DefaultOptions())
|
ac, err := NewClient(suite.its.ac.Credentials, control.DefaultOptions())
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
ac.Credentials = test.creds()
|
ac.Credentials = test.creds()
|
||||||
|
|||||||
@ -128,7 +128,7 @@ func (c Channels) GetChannelMessage(
|
|||||||
|
|
||||||
message.SetReplies(replies)
|
message.SetReplies(replies)
|
||||||
|
|
||||||
info := ChannelMessageInfo(message)
|
info := channelMessageInfo(message)
|
||||||
|
|
||||||
return message, info, nil
|
return message, info, nil
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ func (c Channels) GetChannelMessage(
|
|||||||
// Helpers
|
// Helpers
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
func ChannelMessageInfo(
|
func channelMessageInfo(
|
||||||
msg models.ChatMessageable,
|
msg models.ChatMessageable,
|
||||||
) *details.GroupsInfo {
|
) *details.GroupsInfo {
|
||||||
var (
|
var (
|
||||||
|
|||||||
@ -167,7 +167,7 @@ func (c Channels) NewChannelMessageDeltaPager(
|
|||||||
// unknownFutureValue.
|
// unknownFutureValue.
|
||||||
const channelMessageSystemMessageContent = "<systemEventMessage/>"
|
const channelMessageSystemMessageContent = "<systemEventMessage/>"
|
||||||
|
|
||||||
func FilterOutSystemMessages(cm models.ChatMessageable) bool {
|
func filterOutSystemMessages(cm models.ChatMessageable) bool {
|
||||||
if ptr.Val(cm.GetMessageType()) == models.SYSTEMEVENTMESSAGE_CHATMESSAGETYPE {
|
if ptr.Val(cm.GetMessageType()) == models.SYSTEMEVENTMESSAGE_CHATMESSAGETYPE {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ func (c Channels) GetChannelMessageIDs(
|
|||||||
prevDeltaLink,
|
prevDeltaLink,
|
||||||
canMakeDeltaQueries,
|
canMakeDeltaQueries,
|
||||||
pagers.AddedAndRemovedByDeletedDateTime[models.ChatMessageable],
|
pagers.AddedAndRemovedByDeletedDateTime[models.ChatMessageable],
|
||||||
FilterOutSystemMessages)
|
filterOutSystemMessages)
|
||||||
|
|
||||||
return added, validModTimes, removed, du, clues.Stack(err).OrNil()
|
return added, validModTimes, removed, du, clues.Stack(err).OrNil()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/str"
|
"github.com/alcionai/corso/src/internal/common/str"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ChannelsPagerIntgSuite struct {
|
type ChannelsPagerIntgSuite struct {
|
||||||
@ -94,7 +93,7 @@ func (suite *ChannelsPagerIntgSuite) TestEnumerateChannelMessages() {
|
|||||||
|
|
||||||
func testEnumerateChannelMessageReplies(
|
func testEnumerateChannelMessageReplies(
|
||||||
t *testing.T,
|
t *testing.T,
|
||||||
ac api.Channels,
|
ac Channels,
|
||||||
groupID, channelID, messageID string,
|
groupID, channelID, messageID string,
|
||||||
) {
|
) {
|
||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
@ -196,7 +195,7 @@ func (suite *ChannelsPagerIntgSuite) TestFilterOutSystemMessages() {
|
|||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
test.expect(suite.T(), api.FilterOutSystemMessages(test.cm))
|
test.expect(suite.T(), filterOutSystemMessages(test.cm))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ChannelsAPIUnitSuite struct {
|
type ChannelsAPIUnitSuite struct {
|
||||||
@ -235,7 +234,7 @@ func (suite *ChannelsAPIUnitSuite) TestChannelMessageInfo() {
|
|||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
chMsg, expected := test.msgAndInfo()
|
chMsg, expected := test.msgAndInfo()
|
||||||
assert.Equal(suite.T(), expected, api.ChannelMessageInfo(chMsg))
|
assert.Equal(suite.T(), expected, channelMessageInfo(chMsg))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ContactsPagerIntgSuite struct {
|
type ContactsPagerIntgSuite struct {
|
||||||
@ -56,7 +55,7 @@ func (suite *ContactsPagerIntgSuite) TestContacts_GetItemsInContainerByCollision
|
|||||||
expectM := map[string]struct{}{}
|
expectM := map[string]struct{}{}
|
||||||
|
|
||||||
for _, c := range cs {
|
for _, c := range cs {
|
||||||
expectM[api.ContactCollisionKey(c)] = struct{}{}
|
expectM[ContactCollisionKey(c)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect := maps.Keys(expectM)
|
expect := maps.Keys(expectM)
|
||||||
@ -91,7 +90,7 @@ func (suite *ContactsPagerIntgSuite) TestContacts_GetItemsIDsInContainer() {
|
|||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
container, err := ac.GetContainerByID(ctx, suite.its.user.id, api.DefaultContacts)
|
container, err := ac.GetContainerByID(ctx, suite.its.user.id, DefaultContacts)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
msgs, err := ac.Stable.
|
msgs, err := ac.Stable.
|
||||||
@ -112,7 +111,7 @@ func (suite *ContactsPagerIntgSuite) TestContacts_GetItemsIDsInContainer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
results, err := suite.its.ac.Contacts().
|
results, err := suite.its.ac.Contacts().
|
||||||
GetItemIDsInContainer(ctx, suite.its.user.id, api.DefaultContacts)
|
GetItemIDsInContainer(ctx, suite.its.user.id, DefaultContacts)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
require.Less(t, 0, len(results), "requires at least one result")
|
require.Less(t, 0, len(results), "requires at least one result")
|
||||||
require.Equal(t, len(expect), len(results), "must have same count of items")
|
require.Equal(t, len(expect), len(results), "must have same count of items")
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -16,7 +16,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/control/testdata"
|
"github.com/alcionai/corso/src/pkg/control/testdata"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ContactsAPIUnitSuite struct {
|
type ContactsAPIUnitSuite struct {
|
||||||
@ -73,7 +72,7 @@ func (suite *ContactsAPIUnitSuite) TestContactInfo() {
|
|||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
contact, expected := test.contactAndRP()
|
contact, expected := test.contactAndRP()
|
||||||
assert.Equal(suite.T(), expected, api.ContactInfo(contact))
|
assert.Equal(suite.T(), expected, ContactInfo(contact))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +107,7 @@ func (suite *ContactsAPIUnitSuite) TestBytesToContactable() {
|
|||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
result, err := api.BytesToContactable(test.byteArray)
|
result, err := BytesToContactable(test.byteArray)
|
||||||
test.checkError(t, err, clues.ToCore(err))
|
test.checkError(t, err, clues.ToCore(err))
|
||||||
test.isNil(t, result)
|
test.isNil(t, result)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DrivePagerIntgSuite struct {
|
type DrivePagerIntgSuite struct {
|
||||||
@ -70,7 +69,7 @@ func (suite *DrivePagerIntgSuite) TestDrives_GetItemsInContainerByCollisionKey()
|
|||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
ims := items.GetValue()
|
ims := items.GetValue()
|
||||||
expect := make([]api.DriveItemIDType, 0, len(ims))
|
expect := make([]DriveItemIDType, 0, len(ims))
|
||||||
|
|
||||||
assert.NotEmptyf(
|
assert.NotEmptyf(
|
||||||
t,
|
t,
|
||||||
@ -144,7 +143,7 @@ func (suite *DrivePagerIntgSuite) TestDrives_GetItemIDsInContainer() {
|
|||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
igv := items.GetValue()
|
igv := items.GetValue()
|
||||||
expect := map[string]api.DriveItemIDType{}
|
expect := map[string]DriveItemIDType{}
|
||||||
|
|
||||||
assert.NotEmptyf(
|
assert.NotEmptyf(
|
||||||
t,
|
t,
|
||||||
@ -153,7 +152,7 @@ func (suite *DrivePagerIntgSuite) TestDrives_GetItemIDsInContainer() {
|
|||||||
suite.its.user.id, test.driveID, test.rootFolderID)
|
suite.its.user.id, test.driveID, test.rootFolderID)
|
||||||
|
|
||||||
for _, itm := range igv {
|
for _, itm := range igv {
|
||||||
expect[ptr.Val(itm.GetId())] = api.DriveItemIDType{
|
expect[ptr.Val(itm.GetId())] = DriveItemIDType{
|
||||||
ItemID: ptr.Val(itm.GetId()),
|
ItemID: ptr.Val(itm.GetId()),
|
||||||
IsFolder: itm.GetFolder() != nil,
|
IsFolder: itm.GetFolder() != nil,
|
||||||
}
|
}
|
||||||
@ -195,8 +194,8 @@ func (suite *DrivePagerIntgSuite) TestEnumerateDriveItems() {
|
|||||||
ctx,
|
ctx,
|
||||||
suite.its.user.driveID,
|
suite.its.user.driveID,
|
||||||
"",
|
"",
|
||||||
api.CallConfig{
|
CallConfig{
|
||||||
Select: api.DefaultDriveItemProps(),
|
Select: DefaultDriveItemProps(),
|
||||||
})
|
})
|
||||||
|
|
||||||
for page, reset, done := pager.NextPage(); !done; page, reset, done = pager.NextPage() {
|
for page, reset, done := pager.NextPage(); !done; page, reset, done = pager.NextPage() {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/control"
|
"github.com/alcionai/corso/src/pkg/control"
|
||||||
"github.com/alcionai/corso/src/pkg/control/testdata"
|
"github.com/alcionai/corso/src/pkg/control/testdata"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DriveAPIIntgSuite struct {
|
type DriveAPIIntgSuite struct {
|
||||||
@ -66,12 +65,12 @@ func (suite *DriveAPIIntgSuite) TestDrives_PostItemInContainer() {
|
|||||||
ctx,
|
ctx,
|
||||||
suite.its.user.driveID,
|
suite.its.user.driveID,
|
||||||
suite.its.user.driveRootFolderID,
|
suite.its.user.driveRootFolderID,
|
||||||
api.NewDriveItem(rc.Location, true),
|
NewDriveItem(rc.Location, true),
|
||||||
control.Replace)
|
control.Replace)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
// generate a folder to use for collision testing
|
// generate a folder to use for collision testing
|
||||||
folder := api.NewDriveItem("collision", true)
|
folder := NewDriveItem("collision", true)
|
||||||
origFolder, err := acd.PostItemInContainer(
|
origFolder, err := acd.PostItemInContainer(
|
||||||
ctx,
|
ctx,
|
||||||
suite.its.user.driveID,
|
suite.its.user.driveID,
|
||||||
@ -81,7 +80,7 @@ func (suite *DriveAPIIntgSuite) TestDrives_PostItemInContainer() {
|
|||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
// generate an item to use for collision testing
|
// generate an item to use for collision testing
|
||||||
file := api.NewDriveItem("collision.txt", false)
|
file := NewDriveItem("collision.txt", false)
|
||||||
origFile, err := acd.PostItemInContainer(
|
origFile, err := acd.PostItemInContainer(
|
||||||
ctx,
|
ctx,
|
||||||
suite.its.user.driveID,
|
suite.its.user.driveID,
|
||||||
@ -265,7 +264,7 @@ func (suite *DriveAPIIntgSuite) TestDrives_PostItemInContainer_replaceFolderRegr
|
|||||||
ctx,
|
ctx,
|
||||||
suite.its.user.driveID,
|
suite.its.user.driveID,
|
||||||
suite.its.user.driveRootFolderID,
|
suite.its.user.driveRootFolderID,
|
||||||
api.NewDriveItem(rc.Location, true),
|
NewDriveItem(rc.Location, true),
|
||||||
// skip instead of replace here to get
|
// skip instead of replace here to get
|
||||||
// an ErrItemAlreadyExistsConflict, just in case.
|
// an ErrItemAlreadyExistsConflict, just in case.
|
||||||
control.Skip)
|
control.Skip)
|
||||||
@ -273,7 +272,7 @@ func (suite *DriveAPIIntgSuite) TestDrives_PostItemInContainer_replaceFolderRegr
|
|||||||
|
|
||||||
// generate items within that folder
|
// generate items within that folder
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
file := api.NewDriveItem(fmt.Sprintf("collision_%d.txt", i), false)
|
file := NewDriveItem(fmt.Sprintf("collision_%d.txt", i), false)
|
||||||
f, err := acd.PostItemInContainer(
|
f, err := acd.PostItemInContainer(
|
||||||
ctx,
|
ctx,
|
||||||
suite.its.user.driveID,
|
suite.its.user.driveID,
|
||||||
@ -289,7 +288,7 @@ func (suite *DriveAPIIntgSuite) TestDrives_PostItemInContainer_replaceFolderRegr
|
|||||||
ctx,
|
ctx,
|
||||||
suite.its.user.driveID,
|
suite.its.user.driveID,
|
||||||
ptr.Val(folder.GetParentReference().GetId()),
|
ptr.Val(folder.GetParentReference().GetId()),
|
||||||
api.NewDriveItem(rc.Location, true),
|
NewDriveItem(rc.Location, true),
|
||||||
control.Replace)
|
control.Replace)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
require.NotEmpty(t, ptr.Val(resultFolder.GetId()))
|
require.NotEmpty(t, ptr.Val(resultFolder.GetId()))
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type EventsPagerIntgSuite struct {
|
type EventsPagerIntgSuite struct {
|
||||||
@ -56,7 +55,7 @@ func (suite *EventsPagerIntgSuite) TestEvents_GetItemsInContainerByCollisionKey(
|
|||||||
expectM := map[string]struct{}{}
|
expectM := map[string]struct{}{}
|
||||||
|
|
||||||
for _, e := range es {
|
for _, e := range es {
|
||||||
expectM[api.EventCollisionKey(e)] = struct{}{}
|
expectM[EventCollisionKey(e)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect := maps.Keys(expectM)
|
expect := maps.Keys(expectM)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/control/testdata"
|
"github.com/alcionai/corso/src/pkg/control/testdata"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type EventsAPIUnitSuite struct {
|
type EventsAPIUnitSuite struct {
|
||||||
@ -131,7 +130,7 @@ func (suite *EventsAPIUnitSuite) TestEventInfo() {
|
|||||||
future = time.Now().UTC().AddDate(0, 0, 1)
|
future = time.Now().UTC().AddDate(0, 0, 1)
|
||||||
eventTime = time.Date(future.Year(), future.Month(), future.Day(), future.Hour(), 0, 0, 0, time.UTC)
|
eventTime = time.Date(future.Year(), future.Month(), future.Day(), future.Hour(), 0, 0, 0, time.UTC)
|
||||||
eventEndTime = eventTime.Add(30 * time.Minute)
|
eventEndTime = eventTime.Add(30 * time.Minute)
|
||||||
event, err = api.BytesToEventable(bytes)
|
event, err = BytesToEventable(bytes)
|
||||||
)
|
)
|
||||||
|
|
||||||
require.NoError(suite.T(), err, clues.ToCore(err))
|
require.NoError(suite.T(), err, clues.ToCore(err))
|
||||||
@ -151,7 +150,7 @@ func (suite *EventsAPIUnitSuite) TestEventInfo() {
|
|||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
event, expected := test.evtAndRP()
|
event, expected := test.evtAndRP()
|
||||||
result := api.EventInfo(event)
|
result := EventInfo(event)
|
||||||
|
|
||||||
assert.Equal(t, expected.Subject, result.Subject, "subject")
|
assert.Equal(t, expected.Subject, result.Subject, "subject")
|
||||||
assert.Equal(t, expected.Sender, result.Sender, "sender")
|
assert.Equal(t, expected.Sender, result.Sender, "sender")
|
||||||
@ -211,7 +210,7 @@ func (suite *EventsAPIUnitSuite) TestBytesToEventable() {
|
|||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
result, err := api.BytesToEventable(test.byteArray)
|
result, err := BytesToEventable(test.byteArray)
|
||||||
test.checkError(t, err, clues.ToCore(err))
|
test.checkError(t, err, clues.ToCore(err))
|
||||||
test.isNil(t, result)
|
test.isNil(t, result)
|
||||||
})
|
})
|
||||||
@ -304,7 +303,7 @@ func (suite *EventsAPIIntgSuite) TestEvents_canFindNonStandardFolder() {
|
|||||||
containers, err := ac.EnumerateContainers(
|
containers, err := ac.EnumerateContainers(
|
||||||
ctx,
|
ctx,
|
||||||
suite.its.user.id,
|
suite.its.user.id,
|
||||||
api.DefaultCalendar,
|
DefaultCalendar,
|
||||||
false)
|
false)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
@ -363,7 +362,7 @@ func (suite *EventsAPIIntgSuite) TestEvents_GetContainerByName_mocked() {
|
|||||||
{
|
{
|
||||||
name: "zero",
|
name: "zero",
|
||||||
results: func(t *testing.T) map[string]any {
|
results: func(t *testing.T) map[string]any {
|
||||||
return parseableToMap(t, models.NewCalendarCollectionResponse())
|
return requireParseableToMap(t, models.NewCalendarCollectionResponse())
|
||||||
},
|
},
|
||||||
expectErr: assert.Error,
|
expectErr: assert.Error,
|
||||||
},
|
},
|
||||||
@ -373,7 +372,7 @@ func (suite *EventsAPIIntgSuite) TestEvents_GetContainerByName_mocked() {
|
|||||||
mfcr := models.NewCalendarCollectionResponse()
|
mfcr := models.NewCalendarCollectionResponse()
|
||||||
mfcr.SetValue([]models.Calendarable{c})
|
mfcr.SetValue([]models.Calendarable{c})
|
||||||
|
|
||||||
return parseableToMap(t, mfcr)
|
return requireParseableToMap(t, mfcr)
|
||||||
},
|
},
|
||||||
expectErr: assert.NoError,
|
expectErr: assert.NoError,
|
||||||
},
|
},
|
||||||
@ -383,7 +382,7 @@ func (suite *EventsAPIIntgSuite) TestEvents_GetContainerByName_mocked() {
|
|||||||
mfcr := models.NewCalendarCollectionResponse()
|
mfcr := models.NewCalendarCollectionResponse()
|
||||||
mfcr.SetValue([]models.Calendarable{c, c})
|
mfcr.SetValue([]models.Calendarable{c, c})
|
||||||
|
|
||||||
return parseableToMap(t, mfcr)
|
return requireParseableToMap(t, mfcr)
|
||||||
},
|
},
|
||||||
expectErr: assert.NoError,
|
expectErr: assert.NoError,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -79,7 +79,7 @@ func getGroups(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ValidateGroup(item)
|
err := validateGroup(item)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
el.AddRecoverable(ctx, graph.Wrap(ctx, err, "validating groups"))
|
el.AddRecoverable(ctx, graph.Wrap(ctx, err, "validating groups"))
|
||||||
} else {
|
} else {
|
||||||
@ -315,9 +315,9 @@ func (c Groups) GetRootSite(
|
|||||||
// helpers
|
// helpers
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
// ValidateGroup ensures the item is a Groupable, and contains the necessary
|
// validateGroup ensures the item is a Groupable, and contains the necessary
|
||||||
// identifiers that we handle with all groups.
|
// identifiers that we handle with all groups.
|
||||||
func ValidateGroup(item models.Groupable) error {
|
func validateGroup(item models.Groupable) error {
|
||||||
if item.GetId() == nil {
|
if item.GetId() == nil {
|
||||||
return clues.New("missing ID")
|
return clues.New("missing ID")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GroupUnitSuite struct {
|
type GroupUnitSuite struct {
|
||||||
@ -31,10 +30,9 @@ func (suite *GroupUnitSuite) TestValidateGroup() {
|
|||||||
group.SetId(ptr.To("testID"))
|
group.SetId(ptr.To("testID"))
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args models.Groupable
|
args models.Groupable
|
||||||
expectErr assert.ErrorAssertionFunc
|
expectErr assert.ErrorAssertionFunc
|
||||||
errIsSkippable bool
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Valid group ",
|
name: "Valid group ",
|
||||||
@ -70,12 +68,8 @@ func (suite *GroupUnitSuite) TestValidateGroup() {
|
|||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
err := api.ValidateGroup(test.args)
|
err := validateGroup(test.args)
|
||||||
test.expectErr(t, err, clues.ToCore(err))
|
test.expectErr(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
if test.errIsSkippable {
|
|
||||||
assert.ErrorIs(t, err, api.ErrKnownSkippableCase)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -144,9 +138,9 @@ func (suite *GroupsIntgSuite) TestGetAllSitesNonTeam() {
|
|||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
group, err := suite.its.ac.Groups().GetByID(ctx, suite.its.nonTeamGroup.id, api.CallConfig{})
|
group, err := suite.its.ac.Groups().GetByID(ctx, suite.its.nonTeamGroup.id, CallConfig{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.False(t, api.IsTeam(ctx, group), "group should not be a team for this test")
|
require.False(t, IsTeam(ctx, group), "group should not be a team for this test")
|
||||||
|
|
||||||
sites, err := suite.its.ac.
|
sites, err := suite.its.ac.
|
||||||
Groups().
|
Groups().
|
||||||
@ -167,7 +161,7 @@ func (suite *GroupsIntgSuite) TestGroups_GetByID() {
|
|||||||
groupsAPI = suite.its.ac.Groups()
|
groupsAPI = suite.its.ac.Groups()
|
||||||
)
|
)
|
||||||
|
|
||||||
grp, err := groupsAPI.GetByID(ctx, groupID, api.CallConfig{})
|
grp, err := groupsAPI.GetByID(ctx, groupID, CallConfig{})
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
@ -208,7 +202,7 @@ func (suite *GroupsIntgSuite) TestGroups_GetByID() {
|
|||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
_, err := groupsAPI.GetByID(ctx, test.id, api.CallConfig{})
|
_, err := groupsAPI.GetByID(ctx, test.id, CallConfig{})
|
||||||
test.expectErr(t, err, clues.ToCore(err))
|
test.expectErr(t, err, clues.ToCore(err))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -19,7 +19,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/account"
|
"github.com/alcionai/corso/src/pkg/account"
|
||||||
"github.com/alcionai/corso/src/pkg/control"
|
"github.com/alcionai/corso/src/pkg/control"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@ -28,18 +27,18 @@ import (
|
|||||||
|
|
||||||
// GockClient produces a new exchange api client that can be
|
// GockClient produces a new exchange api client that can be
|
||||||
// mocked using gock.
|
// mocked using gock.
|
||||||
func gockClient(creds account.M365Config) (api.Client, error) {
|
func gockClient(creds account.M365Config) (Client, error) {
|
||||||
s, err := gmock.NewService(creds)
|
s, err := gmock.NewService(creds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.Client{}, err
|
return Client{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
li, err := gmock.NewService(creds, graph.NoTimeout())
|
li, err := gmock.NewService(creds, graph.NoTimeout())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.Client{}, err
|
return Client{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return api.Client{
|
return Client{
|
||||||
Credentials: creds,
|
Credentials: creds,
|
||||||
Stable: s,
|
Stable: s,
|
||||||
LargeItem: li,
|
LargeItem: li,
|
||||||
@ -80,7 +79,7 @@ func odErrMsg(code, message string) *odataerrors.ODataError {
|
|||||||
return odErr
|
return odErr
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseableToMap(t *testing.T, thing serialization.Parsable) map[string]any {
|
func requireParseableToMap(t *testing.T, thing serialization.Parsable) map[string]any {
|
||||||
sw := kjson.NewJsonSerializationWriter()
|
sw := kjson.NewJsonSerializationWriter()
|
||||||
|
|
||||||
err := sw.WriteObjectValue("", thing)
|
err := sw.WriteObjectValue("", thing)
|
||||||
@ -109,8 +108,8 @@ type ids struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type intgTesterSetup struct {
|
type intgTesterSetup struct {
|
||||||
ac api.Client
|
ac Client
|
||||||
gockAC api.Client
|
gockAC Client
|
||||||
user ids
|
user ids
|
||||||
site ids
|
site ids
|
||||||
group ids
|
group ids
|
||||||
@ -129,7 +128,7 @@ func newIntegrationTesterSetup(t *testing.T) intgTesterSetup {
|
|||||||
creds, err := a.M365Config()
|
creds, err := a.M365Config()
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
its.ac, err = api.NewClient(creds, control.DefaultOptions())
|
its.ac, err = NewClient(creds, control.DefaultOptions())
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
its.gockAC, err = gockClient(creds)
|
its.gockAC, err = gockClient(creds)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@ -13,7 +13,6 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ItemSerializationUnitSuite struct {
|
type ItemSerializationUnitSuite struct {
|
||||||
@ -43,13 +42,13 @@ func (suite *ItemSerializationUnitSuite) TestConcurrentItemSerialization() {
|
|||||||
item := models.NewMessage()
|
item := models.NewMessage()
|
||||||
item.SetSubject(&subject)
|
item.SetSubject(&subject)
|
||||||
|
|
||||||
bs, err := api.Mail{}.Serialize(ctx, item, user, subject)
|
bs, err := Mail{}.Serialize(ctx, item, user, subject)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
return bs
|
return bs
|
||||||
},
|
},
|
||||||
deserializeAndGetField: func(t *testing.T, bs []byte) string {
|
deserializeAndGetField: func(t *testing.T, bs []byte) string {
|
||||||
item, err := api.BytesToMessageable(bs)
|
item, err := BytesToMessageable(bs)
|
||||||
require.NoError(
|
require.NoError(
|
||||||
t,
|
t,
|
||||||
err,
|
err,
|
||||||
@ -68,13 +67,13 @@ func (suite *ItemSerializationUnitSuite) TestConcurrentItemSerialization() {
|
|||||||
item := models.NewEvent()
|
item := models.NewEvent()
|
||||||
item.SetSubject(&subject)
|
item.SetSubject(&subject)
|
||||||
|
|
||||||
bs, err := api.Events{}.Serialize(ctx, item, user, subject)
|
bs, err := Events{}.Serialize(ctx, item, user, subject)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
return bs
|
return bs
|
||||||
},
|
},
|
||||||
deserializeAndGetField: func(t *testing.T, bs []byte) string {
|
deserializeAndGetField: func(t *testing.T, bs []byte) string {
|
||||||
item, err := api.BytesToEventable(bs)
|
item, err := BytesToEventable(bs)
|
||||||
require.NoError(
|
require.NoError(
|
||||||
t,
|
t,
|
||||||
err,
|
err,
|
||||||
@ -93,13 +92,13 @@ func (suite *ItemSerializationUnitSuite) TestConcurrentItemSerialization() {
|
|||||||
item := models.NewContact()
|
item := models.NewContact()
|
||||||
item.SetGivenName(&name)
|
item.SetGivenName(&name)
|
||||||
|
|
||||||
bs, err := api.Contacts{}.Serialize(ctx, item, user, name)
|
bs, err := Contacts{}.Serialize(ctx, item, user, name)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
return bs
|
return bs
|
||||||
},
|
},
|
||||||
deserializeAndGetField: func(t *testing.T, bs []byte) string {
|
deserializeAndGetField: func(t *testing.T, bs []byte) string {
|
||||||
item, err := api.BytesToContactable(bs)
|
item, err := BytesToContactable(bs)
|
||||||
require.NoError(
|
require.NoError(
|
||||||
t,
|
t,
|
||||||
err,
|
err,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|||||||
@ -565,7 +565,7 @@ func (c Mail) Serialize(
|
|||||||
|
|
||||||
func MailInfo(msg models.Messageable, size int64) *details.ExchangeInfo {
|
func MailInfo(msg models.Messageable, size int64) *details.ExchangeInfo {
|
||||||
var (
|
var (
|
||||||
sender = UnwrapEmailAddress(msg.GetSender())
|
sender = unwrapEmailAddress(msg.GetSender())
|
||||||
subject = ptr.Val(msg.GetSubject())
|
subject = ptr.Val(msg.GetSubject())
|
||||||
received = ptr.Val(msg.GetReceivedDateTime())
|
received = ptr.Val(msg.GetReceivedDateTime())
|
||||||
created = ptr.Val(msg.GetCreatedDateTime())
|
created = ptr.Val(msg.GetCreatedDateTime())
|
||||||
@ -575,7 +575,7 @@ func MailInfo(msg models.Messageable, size int64) *details.ExchangeInfo {
|
|||||||
if msg.GetToRecipients() != nil {
|
if msg.GetToRecipients() != nil {
|
||||||
ppl := msg.GetToRecipients()
|
ppl := msg.GetToRecipients()
|
||||||
for _, entry := range ppl {
|
for _, entry := range ppl {
|
||||||
temp := UnwrapEmailAddress(entry)
|
temp := unwrapEmailAddress(entry)
|
||||||
if len(temp) > 0 {
|
if len(temp) > 0 {
|
||||||
recipients = append(recipients, temp)
|
recipients = append(recipients, temp)
|
||||||
}
|
}
|
||||||
@ -594,7 +594,7 @@ func MailInfo(msg models.Messageable, size int64) *details.ExchangeInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnwrapEmailAddress(contact models.Recipientable) string {
|
func unwrapEmailAddress(contact models.Recipientable) string {
|
||||||
var empty string
|
var empty string
|
||||||
if contact == nil || contact.GetEmailAddress() == nil {
|
if contact == nil || contact.GetEmailAddress() == nil {
|
||||||
return empty
|
return empty
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -13,7 +13,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MailPagerIntgSuite struct {
|
type MailPagerIntgSuite struct {
|
||||||
@ -40,7 +39,7 @@ func (suite *MailPagerIntgSuite) TestMail_GetItemsInContainerByCollisionKey() {
|
|||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
container, err := ac.GetContainerByID(ctx, suite.its.user.id, api.MailInbox)
|
container, err := ac.GetContainerByID(ctx, suite.its.user.id, MailInbox)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
msgs, err := ac.Stable.
|
msgs, err := ac.Stable.
|
||||||
@ -57,12 +56,12 @@ func (suite *MailPagerIntgSuite) TestMail_GetItemsInContainerByCollisionKey() {
|
|||||||
expectM := map[string]struct{}{}
|
expectM := map[string]struct{}{}
|
||||||
|
|
||||||
for _, m := range ms {
|
for _, m := range ms {
|
||||||
expectM[api.MailCollisionKey(m)] = struct{}{}
|
expectM[MailCollisionKey(m)] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
expect := maps.Keys(expectM)
|
expect := maps.Keys(expectM)
|
||||||
|
|
||||||
results, err := suite.its.ac.Mail().GetItemsInContainerByCollisionKey(ctx, suite.its.user.id, api.MailInbox)
|
results, err := suite.its.ac.Mail().GetItemsInContainerByCollisionKey(ctx, suite.its.user.id, MailInbox)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
require.Less(t, 0, len(results), "requires at least one result")
|
require.Less(t, 0, len(results), "requires at least one result")
|
||||||
|
|
||||||
@ -103,7 +102,7 @@ func (suite *MailPagerIntgSuite) TestMail_GetItemsIDsInContainer() {
|
|||||||
Users().
|
Users().
|
||||||
ByUserId(suite.its.user.id).
|
ByUserId(suite.its.user.id).
|
||||||
MailFolders().
|
MailFolders().
|
||||||
ByMailFolderId(api.MailInbox).
|
ByMailFolderId(MailInbox).
|
||||||
Messages().
|
Messages().
|
||||||
Get(ctx, config)
|
Get(ctx, config)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
@ -116,7 +115,7 @@ func (suite *MailPagerIntgSuite) TestMail_GetItemsIDsInContainer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
results, err := suite.its.ac.Mail().
|
results, err := suite.its.ac.Mail().
|
||||||
GetItemIDsInContainer(ctx, suite.its.user.id, api.MailInbox)
|
GetItemIDsInContainer(ctx, suite.its.user.id, MailInbox)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
require.Less(t, 0, len(results), "requires at least one result")
|
require.Less(t, 0, len(results), "requires at least one result")
|
||||||
require.Equal(t, len(expect), len(results), "must have same count of items")
|
require.Equal(t, len(expect), len(results), "must have same count of items")
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/control/testdata"
|
"github.com/alcionai/corso/src/pkg/control/testdata"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MailAPIUnitSuite struct {
|
type MailAPIUnitSuite struct {
|
||||||
@ -150,7 +149,7 @@ func (suite *MailAPIUnitSuite) TestMailInfo() {
|
|||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
suite.Run(tt.name, func() {
|
suite.Run(tt.name, func() {
|
||||||
msg, expected := tt.msgAndRP()
|
msg, expected := tt.msgAndRP()
|
||||||
assert.Equal(suite.T(), expected, api.MailInfo(msg, 0))
|
assert.Equal(suite.T(), expected, MailInfo(msg, 0))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +178,7 @@ func (suite *MailAPIUnitSuite) TestBytesToMessagable() {
|
|||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
result, err := api.BytesToMessageable(test.byteArray)
|
result, err := BytesToMessageable(test.byteArray)
|
||||||
test.checkError(t, err, clues.ToCore(err))
|
test.checkError(t, err, clues.ToCore(err))
|
||||||
test.checkObject(t, result)
|
test.checkObject(t, result)
|
||||||
})
|
})
|
||||||
@ -224,7 +223,7 @@ func (suite *MailAPIIntgSuite) TestHugeAttachmentListDownload() {
|
|||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid).
|
interceptV1Path("users", "user", "messages", mid).
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), mitem))
|
JSON(requireParseableToMap(suite.T(), mitem))
|
||||||
},
|
},
|
||||||
expect: assert.NoError,
|
expect: assert.NoError,
|
||||||
},
|
},
|
||||||
@ -237,7 +236,7 @@ func (suite *MailAPIIntgSuite) TestHugeAttachmentListDownload() {
|
|||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid).
|
interceptV1Path("users", "user", "messages", mid).
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), email))
|
JSON(requireParseableToMap(suite.T(), email))
|
||||||
|
|
||||||
atts := models.NewAttachmentCollectionResponse()
|
atts := models.NewAttachmentCollectionResponse()
|
||||||
attch := models.NewAttachment()
|
attch := models.NewAttachment()
|
||||||
@ -248,7 +247,7 @@ func (suite *MailAPIIntgSuite) TestHugeAttachmentListDownload() {
|
|||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid, "attachments").
|
interceptV1Path("users", "user", "messages", mid, "attachments").
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), atts))
|
JSON(requireParseableToMap(suite.T(), atts))
|
||||||
},
|
},
|
||||||
attachmentCount: 1,
|
attachmentCount: 1,
|
||||||
size: 50,
|
size: 50,
|
||||||
@ -263,7 +262,7 @@ func (suite *MailAPIIntgSuite) TestHugeAttachmentListDownload() {
|
|||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid).
|
interceptV1Path("users", "user", "messages", mid).
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), email))
|
JSON(requireParseableToMap(suite.T(), email))
|
||||||
|
|
||||||
atts := models.NewAttachmentCollectionResponse()
|
atts := models.NewAttachmentCollectionResponse()
|
||||||
attch := models.NewAttachment()
|
attch := models.NewAttachment()
|
||||||
@ -279,11 +278,11 @@ func (suite *MailAPIIntgSuite) TestHugeAttachmentListDownload() {
|
|||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid, "attachments").
|
interceptV1Path("users", "user", "messages", mid, "attachments").
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), atts))
|
JSON(requireParseableToMap(suite.T(), atts))
|
||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid, "attachments", aid).
|
interceptV1Path("users", "user", "messages", mid, "attachments", aid).
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), attch))
|
JSON(requireParseableToMap(suite.T(), attch))
|
||||||
},
|
},
|
||||||
attachmentCount: 1,
|
attachmentCount: 1,
|
||||||
size: 200,
|
size: 200,
|
||||||
@ -299,7 +298,7 @@ func (suite *MailAPIIntgSuite) TestHugeAttachmentListDownload() {
|
|||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid).
|
interceptV1Path("users", "user", "messages", mid).
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), email))
|
JSON(requireParseableToMap(suite.T(), email))
|
||||||
|
|
||||||
atts := models.NewAttachmentCollectionResponse()
|
atts := models.NewAttachmentCollectionResponse()
|
||||||
attch := models.NewAttachment()
|
attch := models.NewAttachment()
|
||||||
@ -315,12 +314,12 @@ func (suite *MailAPIIntgSuite) TestHugeAttachmentListDownload() {
|
|||||||
|
|
||||||
interceptV1Path("users", "user", "messages", mid, "attachments").
|
interceptV1Path("users", "user", "messages", mid, "attachments").
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), atts))
|
JSON(requireParseableToMap(suite.T(), atts))
|
||||||
|
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
interceptV1Path("users", "user", "messages", mid, "attachments", aid).
|
interceptV1Path("users", "user", "messages", mid, "attachments", aid).
|
||||||
Reply(200).
|
Reply(200).
|
||||||
JSON(parseableToMap(suite.T(), attch))
|
JSON(requireParseableToMap(suite.T(), attch))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
attachmentCount: 5,
|
attachmentCount: 5,
|
||||||
@ -380,7 +379,7 @@ func (suite *MailAPIIntgSuite) TestMail_RestoreLargeAttachment() {
|
|||||||
|
|
||||||
folderName := testdata.DefaultRestoreConfig("maillargeattachmenttest").Location
|
folderName := testdata.DefaultRestoreConfig("maillargeattachmenttest").Location
|
||||||
msgs := suite.its.ac.Mail()
|
msgs := suite.its.ac.Mail()
|
||||||
mailfolder, err := msgs.CreateContainer(ctx, userID, api.MsgFolderRoot, folderName)
|
mailfolder, err := msgs.CreateContainer(ctx, userID, MsgFolderRoot, folderName)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
msg := models.NewMessage()
|
msg := models.NewMessage()
|
||||||
@ -419,7 +418,7 @@ func (suite *MailAPIIntgSuite) TestMail_GetContainerByName() {
|
|||||||
expectErr assert.ErrorAssertionFunc
|
expectErr assert.ErrorAssertionFunc
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: api.MailInbox,
|
name: MailInbox,
|
||||||
expectErr: assert.NoError,
|
expectErr: assert.NoError,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -478,7 +477,7 @@ func (suite *MailAPIIntgSuite) TestMail_GetContainerByName_mocked() {
|
|||||||
{
|
{
|
||||||
name: "zero",
|
name: "zero",
|
||||||
results: func(t *testing.T) map[string]any {
|
results: func(t *testing.T) map[string]any {
|
||||||
return parseableToMap(t, models.NewMailFolderCollectionResponse())
|
return requireParseableToMap(t, models.NewMailFolderCollectionResponse())
|
||||||
},
|
},
|
||||||
expectErr: assert.Error,
|
expectErr: assert.Error,
|
||||||
},
|
},
|
||||||
@ -488,7 +487,7 @@ func (suite *MailAPIIntgSuite) TestMail_GetContainerByName_mocked() {
|
|||||||
mfcr := models.NewMailFolderCollectionResponse()
|
mfcr := models.NewMailFolderCollectionResponse()
|
||||||
mfcr.SetValue([]models.MailFolderable{mf})
|
mfcr.SetValue([]models.MailFolderable{mf})
|
||||||
|
|
||||||
return parseableToMap(t, mfcr)
|
return requireParseableToMap(t, mfcr)
|
||||||
},
|
},
|
||||||
expectErr: assert.NoError,
|
expectErr: assert.NoError,
|
||||||
},
|
},
|
||||||
@ -498,7 +497,7 @@ func (suite *MailAPIIntgSuite) TestMail_GetContainerByName_mocked() {
|
|||||||
mfcr := models.NewMailFolderCollectionResponse()
|
mfcr := models.NewMailFolderCollectionResponse()
|
||||||
mfcr.SetValue([]models.MailFolderable{mf, mf})
|
mfcr.SetValue([]models.MailFolderable{mf, mf})
|
||||||
|
|
||||||
return parseableToMap(t, mfcr)
|
return requireParseableToMap(t, mfcr)
|
||||||
},
|
},
|
||||||
expectErr: assert.Error,
|
expectErr: assert.Error,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -84,7 +84,7 @@ func (c Sites) GetAll(ctx context.Context, errs *fault.Bus) ([]models.Siteable,
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ValidateSite(item)
|
err := validateSite(item)
|
||||||
if errors.Is(err, ErrKnownSkippableCase) {
|
if errors.Is(err, ErrKnownSkippableCase) {
|
||||||
// safe to no-op
|
// safe to no-op
|
||||||
return true
|
return true
|
||||||
@ -259,10 +259,10 @@ var ErrKnownSkippableCase = clues.New("case is known and skippable")
|
|||||||
|
|
||||||
const PersonalSitePath = "sharepoint.com/personal/"
|
const PersonalSitePath = "sharepoint.com/personal/"
|
||||||
|
|
||||||
// ValidateSite ensures the item is a Siteable, and contains the necessary
|
// validateSite ensures the item is a Siteable, and contains the necessary
|
||||||
// identifiers that we handle with all users.
|
// identifiers that we handle with all users.
|
||||||
// returns the item as a Siteable model.
|
// returns the item as a Siteable model.
|
||||||
func ValidateSite(item models.Siteable) error {
|
func validateSite(item models.Siteable) error {
|
||||||
id := ptr.Val(item.GetId())
|
id := ptr.Val(item.GetId())
|
||||||
if len(id) == 0 {
|
if len(id) == 0 {
|
||||||
return clues.New("missing ID")
|
return clues.New("missing ID")
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
@ -16,7 +16,6 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SitesUnitSuite struct {
|
type SitesUnitSuite struct {
|
||||||
@ -79,7 +78,7 @@ func (suite *SitesUnitSuite) TestValidateSite() {
|
|||||||
args: func() *models.Site {
|
args: func() *models.Site {
|
||||||
s := models.NewSite()
|
s := models.NewSite()
|
||||||
s.SetId(ptr.To("id"))
|
s.SetId(ptr.To("id"))
|
||||||
s.SetWebUrl(ptr.To("https://" + api.PersonalSitePath + "/someone's/onedrive"))
|
s.SetWebUrl(ptr.To("https://" + PersonalSitePath + "/someone's/onedrive"))
|
||||||
return s
|
return s
|
||||||
}(),
|
}(),
|
||||||
errCheck: assert.Error,
|
errCheck: assert.Error,
|
||||||
@ -95,11 +94,11 @@ func (suite *SitesUnitSuite) TestValidateSite() {
|
|||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
err := api.ValidateSite(test.args)
|
err := validateSite(test.args)
|
||||||
test.errCheck(t, err, clues.ToCore(err))
|
test.errCheck(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
if test.errIsSkippable {
|
if test.errIsSkippable {
|
||||||
assert.ErrorIs(t, err, api.ErrKnownSkippableCase)
|
assert.ErrorIs(t, err, ErrKnownSkippableCase)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -135,7 +134,7 @@ func (suite *SitesIntgSuite) TestGetAll() {
|
|||||||
require.NotZero(t, len(sites), "must have at least one site")
|
require.NotZero(t, len(sites), "must have at least one site")
|
||||||
|
|
||||||
for _, site := range sites {
|
for _, site := range sites {
|
||||||
assert.NotContains(t, ptr.Val(site.GetWebUrl()), api.PersonalSitePath, "must not return onedrive sites")
|
assert.NotContains(t, ptr.Val(site.GetWebUrl()), PersonalSitePath, "must not return onedrive sites")
|
||||||
assert.NotContains(t, ptr.Val(site.GetWebUrl()), "sharepoint.com/search", "must not return search site")
|
assert.NotContains(t, ptr.Val(site.GetWebUrl()), "sharepoint.com/search", "must not return search site")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,7 +232,7 @@ func (suite *SitesIntgSuite) TestSites_GetByID() {
|
|||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
cc := api.CallConfig{
|
cc := CallConfig{
|
||||||
Expand: []string{"drive"},
|
Expand: []string{"drive"},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +256,7 @@ func (suite *SitesIntgSuite) TestGetRoot() {
|
|||||||
ctx, flush := tester.NewContext(t)
|
ctx, flush := tester.NewContext(t)
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
result, err := suite.its.ac.Sites().GetRoot(ctx, api.CallConfig{Expand: []string{"drive"}})
|
result, err := suite.its.ac.Sites().GetRoot(ctx, CallConfig{Expand: []string{"drive"}})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, result, "must find the root site")
|
require.NotNil(t, result, "must find the root site")
|
||||||
require.NotEmpty(t, ptr.Val(result.GetId()), "must have an id")
|
require.NotEmpty(t, ptr.Val(result.GetId()), "must have an id")
|
||||||
|
|||||||
@ -95,7 +95,7 @@ func (c Users) GetAll(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ValidateUser(item)
|
err := validateUser(item)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
el.AddRecoverable(ctx, graph.Wrap(ctx, err, "validating user"))
|
el.AddRecoverable(ctx, graph.Wrap(ctx, err, "validating user"))
|
||||||
} else {
|
} else {
|
||||||
@ -297,9 +297,9 @@ func (c Users) GetFirstInboxMessage(
|
|||||||
// helpers
|
// helpers
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
// ValidateUser ensures the item is a Userable, and contains the necessary
|
// validateUser ensures the item is a Userable, and contains the necessary
|
||||||
// identifiers that we handle with all users.
|
// identifiers that we handle with all users.
|
||||||
func ValidateUser(item models.Userable) error {
|
func validateUser(item models.Userable) error {
|
||||||
if item.GetId() == nil {
|
if item.GetId() == nil {
|
||||||
return clues.New("missing ID")
|
return clues.New("missing ID")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package api_test
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/m365/graph"
|
"github.com/alcionai/corso/src/internal/m365/graph"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UsersUnitSuite struct {
|
type UsersUnitSuite struct {
|
||||||
@ -59,7 +58,7 @@ func (suite *UsersUnitSuite) TestValidateUser() {
|
|||||||
suite.Run(tt.name, func() {
|
suite.Run(tt.name, func() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
err := api.ValidateUser(tt.args)
|
err := validateUser(tt.args)
|
||||||
tt.errCheck(t, err, clues.ToCore(err))
|
tt.errCheck(t, err, clues.ToCore(err))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -116,7 +115,7 @@ func (suite *UsersUnitSuite) TestEvaluateMailboxError() {
|
|||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
test.expect(suite.T(), api.EvaluateMailboxError(test.err))
|
test.expect(suite.T(), EvaluateMailboxError(test.err))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +135,7 @@ func (suite *UsersUnitSuite) TestIsAnyErrMailboxNotFound() {
|
|||||||
name: "mailbox not found error",
|
name: "mailbox not found error",
|
||||||
errs: []error{
|
errs: []error{
|
||||||
clues.New("an error"),
|
clues.New("an error"),
|
||||||
api.ErrMailBoxNotFound,
|
ErrMailBoxNotFound,
|
||||||
clues.New("an error"),
|
clues.New("an error"),
|
||||||
},
|
},
|
||||||
expect: true,
|
expect: true,
|
||||||
@ -145,7 +144,7 @@ func (suite *UsersUnitSuite) TestIsAnyErrMailboxNotFound() {
|
|||||||
name: "other errors",
|
name: "other errors",
|
||||||
errs: []error{
|
errs: []error{
|
||||||
clues.New("an error"),
|
clues.New("an error"),
|
||||||
api.ErrMailBoxSettingsAccessDenied,
|
ErrMailBoxSettingsAccessDenied,
|
||||||
clues.New("an error"),
|
clues.New("an error"),
|
||||||
},
|
},
|
||||||
expect: false,
|
expect: false,
|
||||||
@ -153,7 +152,7 @@ func (suite *UsersUnitSuite) TestIsAnyErrMailboxNotFound() {
|
|||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.Run(test.name, func() {
|
suite.Run(test.name, func() {
|
||||||
assert.Equal(suite.T(), test.expect, api.IsAnyErrMailboxNotFound(test.errs))
|
assert.Equal(suite.T(), test.expect, IsAnyErrMailboxNotFound(test.errs))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,6 @@ func (suite *siteIntegrationSuite) TestSites() {
|
|||||||
t := suite.T()
|
t := suite.T()
|
||||||
assert.NotEmpty(t, s.WebURL)
|
assert.NotEmpty(t, s.WebURL)
|
||||||
assert.NotEmpty(t, s.ID)
|
assert.NotEmpty(t, s.ID)
|
||||||
assert.NotEmpty(t, s.DisplayName)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +81,6 @@ func (suite *siteIntegrationSuite) TestSites_GetByID() {
|
|||||||
assert.NoError(t, err, clues.ToCore(err))
|
assert.NoError(t, err, clues.ToCore(err))
|
||||||
assert.NotEmpty(t, site.WebURL)
|
assert.NotEmpty(t, site.WebURL)
|
||||||
assert.NotEmpty(t, site.ID)
|
assert.NotEmpty(t, site.ID)
|
||||||
assert.NotEmpty(t, site.DisplayName)
|
|
||||||
assert.NotEmpty(t, site.OwnerType)
|
assert.NotEmpty(t, site.OwnerType)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -242,7 +240,6 @@ func (suite *siteUnitSuite) TestGetSites() {
|
|||||||
expectSite: func(t *testing.T, site *Site) {
|
expectSite: func(t *testing.T, site *Site) {
|
||||||
assert.NotEmpty(t, site.ID)
|
assert.NotEmpty(t, site.ID)
|
||||||
assert.NotEmpty(t, site.WebURL)
|
assert.NotEmpty(t, site.WebURL)
|
||||||
assert.NotEmpty(t, site.DisplayName)
|
|
||||||
assert.Empty(t, site.OwnerID)
|
assert.Empty(t, site.OwnerID)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -257,7 +254,6 @@ func (suite *siteUnitSuite) TestGetSites() {
|
|||||||
expectSite: func(t *testing.T, site *Site) {
|
expectSite: func(t *testing.T, site *Site) {
|
||||||
assert.NotEmpty(t, site.ID)
|
assert.NotEmpty(t, site.ID)
|
||||||
assert.NotEmpty(t, site.WebURL)
|
assert.NotEmpty(t, site.WebURL)
|
||||||
assert.NotEmpty(t, site.DisplayName)
|
|
||||||
assert.Equal(t, site.OwnerID, "userid")
|
assert.Equal(t, site.OwnerID, "userid")
|
||||||
assert.Equal(t, site.OwnerEmail, "useremail")
|
assert.Equal(t, site.OwnerEmail, "useremail")
|
||||||
assert.Equal(t, site.OwnerType, SiteOwnerUser)
|
assert.Equal(t, site.OwnerType, SiteOwnerUser)
|
||||||
@ -274,7 +270,6 @@ func (suite *siteUnitSuite) TestGetSites() {
|
|||||||
expectSite: func(t *testing.T, site *Site) {
|
expectSite: func(t *testing.T, site *Site) {
|
||||||
assert.NotEmpty(t, site.ID)
|
assert.NotEmpty(t, site.ID)
|
||||||
assert.NotEmpty(t, site.WebURL)
|
assert.NotEmpty(t, site.WebURL)
|
||||||
assert.NotEmpty(t, site.DisplayName)
|
|
||||||
assert.Equal(t, SiteOwnerGroup, site.OwnerType)
|
assert.Equal(t, SiteOwnerGroup, site.OwnerType)
|
||||||
assert.Equal(t, "groupid", site.OwnerID)
|
assert.Equal(t, "groupid", site.OwnerID)
|
||||||
assert.Equal(t, "groupemail", site.OwnerEmail)
|
assert.Equal(t, "groupemail", site.OwnerEmail)
|
||||||
@ -291,7 +286,6 @@ func (suite *siteUnitSuite) TestGetSites() {
|
|||||||
expectSite: func(t *testing.T, site *Site) {
|
expectSite: func(t *testing.T, site *Site) {
|
||||||
assert.NotEmpty(t, site.ID)
|
assert.NotEmpty(t, site.ID)
|
||||||
assert.NotEmpty(t, site.WebURL)
|
assert.NotEmpty(t, site.WebURL)
|
||||||
assert.NotEmpty(t, site.DisplayName)
|
|
||||||
assert.Equal(t, SiteOwnerGroup, site.OwnerType)
|
assert.Equal(t, SiteOwnerGroup, site.OwnerType)
|
||||||
assert.Equal(t, "", site.OwnerID)
|
assert.Equal(t, "", site.OwnerID)
|
||||||
assert.Equal(t, "groupemail", site.OwnerEmail)
|
assert.Equal(t, "groupemail", site.OwnerEmail)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user