relocate connector mocks (#3048)
It makes more sense for mock data types to be owned by the service package, not by the connector package as a whole. --- #### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
c90f587769
commit
86f9d60bf7
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/alcionai/corso/src/cli/print"
|
"github.com/alcionai/corso/src/cli/print"
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
"github.com/alcionai/corso/src/internal/connector"
|
"github.com/alcionai/corso/src/internal/connector"
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/version"
|
"github.com/alcionai/corso/src/internal/version"
|
||||||
"github.com/alcionai/corso/src/pkg/account"
|
"github.com/alcionai/corso/src/pkg/account"
|
||||||
@ -183,7 +183,7 @@ func buildCollections(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
mc := mockconnector.NewMockExchangeCollection(pth, pth, len(c.items))
|
mc := exchMock.NewCollection(pth, pth, len(c.items))
|
||||||
|
|
||||||
for i := 0; i < len(c.items); i++ {
|
for i := 0; i < len(c.items); i++ {
|
||||||
mc.Names[i] = c.items[i].name
|
mc.Names[i] = c.items[i].name
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
. "github.com/alcionai/corso/src/cli/print"
|
. "github.com/alcionai/corso/src/cli/print"
|
||||||
"github.com/alcionai/corso/src/cli/utils"
|
"github.com/alcionai/corso/src/cli/utils"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/pkg/control"
|
"github.com/alcionai/corso/src/pkg/control"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/logger"
|
"github.com/alcionai/corso/src/pkg/logger"
|
||||||
@ -66,7 +66,7 @@ func handleExchangeEmailFactory(cmd *cobra.Command, args []string) error {
|
|||||||
Tenant, User, Destination,
|
Tenant, User, Destination,
|
||||||
Count,
|
Count,
|
||||||
func(id, now, subject, body string) []byte {
|
func(id, now, subject, body string) []byte {
|
||||||
return mockconnector.GetMockMessageWith(
|
return exchMock.MessageWith(
|
||||||
User, User, User,
|
User, User, User,
|
||||||
subject, body, body,
|
subject, body, body,
|
||||||
now, now, now, now)
|
now, now, now, now)
|
||||||
@ -113,9 +113,9 @@ func handleExchangeCalendarEventFactory(cmd *cobra.Command, args []string) error
|
|||||||
Tenant, User, Destination,
|
Tenant, User, Destination,
|
||||||
Count,
|
Count,
|
||||||
func(id, now, subject, body string) []byte {
|
func(id, now, subject, body string) []byte {
|
||||||
return mockconnector.GetMockEventWith(
|
return exchMock.EventWith(
|
||||||
User, subject, body, body,
|
User, subject, body, body,
|
||||||
now, now, mockconnector.NoRecurrence, mockconnector.NoAttendees, false)
|
now, now, exchMock.NoRecurrence, exchMock.NoAttendees, false)
|
||||||
},
|
},
|
||||||
control.Options{},
|
control.Options{},
|
||||||
errs)
|
errs)
|
||||||
@ -161,7 +161,7 @@ func handleExchangeContactFactory(cmd *cobra.Command, args []string) error {
|
|||||||
func(id, now, subject, body string) []byte {
|
func(id, now, subject, body string) []byte {
|
||||||
given, mid, sur := id[:8], id[9:13], id[len(id)-12:]
|
given, mid, sur := id[:8], id[9:13], id[len(id)-12:]
|
||||||
|
|
||||||
return mockconnector.GetMockContactBytesWith(
|
return exchMock.ContactBytesWith(
|
||||||
given+" "+sur,
|
given+" "+sur,
|
||||||
sur+", "+given,
|
sur+", "+given,
|
||||||
given, mid, sur,
|
given, mid, sur,
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/account"
|
"github.com/alcionai/corso/src/pkg/account"
|
||||||
@ -97,7 +97,7 @@ func (suite *ExchangeServiceSuite) TestHasAttachments() {
|
|||||||
name: "Mock w/out attachment",
|
name: "Mock w/out attachment",
|
||||||
hasAttachment: assert.False,
|
hasAttachment: assert.False,
|
||||||
getBodyable: func(t *testing.T) models.ItemBodyable {
|
getBodyable: func(t *testing.T) models.ItemBodyable {
|
||||||
byteArray := mockconnector.GetMockMessageWithBodyBytes(
|
byteArray := exchMock.MessageWithBodyBytes(
|
||||||
"Test",
|
"Test",
|
||||||
"This is testing",
|
"This is testing",
|
||||||
"This is testing",
|
"This is testing",
|
||||||
@ -111,7 +111,7 @@ func (suite *ExchangeServiceSuite) TestHasAttachments() {
|
|||||||
name: "Mock w/ inline attachment",
|
name: "Mock w/ inline attachment",
|
||||||
hasAttachment: assert.True,
|
hasAttachment: assert.True,
|
||||||
getBodyable: func(t *testing.T) models.ItemBodyable {
|
getBodyable: func(t *testing.T) models.ItemBodyable {
|
||||||
byteArray := mockconnector.GetMessageWithOneDriveAttachment("Test legacy")
|
byteArray := exchMock.MessageWithOneDriveAttachment("Test legacy")
|
||||||
message, err := support.CreateMessageFromBytes(byteArray)
|
message, err := support.CreateMessageFromBytes(byteArray)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
return message.GetBody()
|
return message.GetBody()
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"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"
|
||||||
@ -123,7 +123,7 @@ func (suite *EventsAPIUnitSuite) TestEventInfo() {
|
|||||||
var (
|
var (
|
||||||
organizer = "foobar3@8qzvrj.onmicrosoft.com"
|
organizer = "foobar3@8qzvrj.onmicrosoft.com"
|
||||||
subject = " Test Mock Review + Lunch"
|
subject = " Test Mock Review + Lunch"
|
||||||
bytes = mockconnector.GetDefaultMockEventBytes("Test Mock")
|
bytes = exchMock.EventBytes("Test Mock")
|
||||||
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)
|
||||||
|
|||||||
@ -8,8 +8,8 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
@ -24,7 +24,7 @@ func TestExchangeIteratorSuite(t *testing.T) {
|
|||||||
|
|
||||||
func (suite *ExchangeIteratorSuite) TestDisplayable() {
|
func (suite *ExchangeIteratorSuite) TestDisplayable() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
bytes := mockconnector.GetMockContactBytes("Displayable")
|
bytes := exchMock.ContactBytes("Displayable")
|
||||||
contact, err := support.CreateContactFromBytes(bytes)
|
contact, err := support.CreateContactFromBytes(bytes)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ func (suite *ExchangeIteratorSuite) TestDisplayable() {
|
|||||||
|
|
||||||
func (suite *ExchangeIteratorSuite) TestDescendable() {
|
func (suite *ExchangeIteratorSuite) TestDescendable() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
bytes := mockconnector.GetMockMessageBytes("Descendable")
|
bytes := exchMock.MessageBytes("Descendable")
|
||||||
message, err := support.CreateMessageFromBytes(bytes)
|
message, err := support.CreateMessageFromBytes(bytes)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package mockconnector
|
package mock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/alcionai/corso/src/pkg/path"
|
"github.com/alcionai/corso/src/pkg/path"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockExchangeDataCollection represents a mock exchange mailbox
|
// DataCollection represents a mock exchange mailbox
|
||||||
type MockExchangeDataCollection struct {
|
type DataCollection struct {
|
||||||
fullPath path.Path
|
fullPath path.Path
|
||||||
LocPath path.Path
|
LocPath path.Path
|
||||||
messageCount int
|
messageCount int
|
||||||
@ -30,20 +30,34 @@ type MockExchangeDataCollection struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ data.BackupCollection = &MockExchangeDataCollection{}
|
_ data.BackupCollection = &DataCollection{}
|
||||||
_ data.Stream = &MockExchangeData{}
|
_ data.Stream = &Data{}
|
||||||
_ data.StreamInfo = &MockExchangeData{}
|
_ data.StreamInfo = &Data{}
|
||||||
_ data.StreamSize = &MockExchangeData{}
|
_ data.StreamSize = &Data{}
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewMockExchangeDataCollection creates an data collection that will return the specified number of
|
func (medc DataCollection) FullPath() path.Path { return medc.fullPath }
|
||||||
|
|
||||||
|
func (medc DataCollection) LocationPath() *path.Builder {
|
||||||
|
if medc.LocPath == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.Builder{}.Append(medc.LocPath.Folders()...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (medc DataCollection) PreviousPath() path.Path { return medc.PrevPath }
|
||||||
|
func (medc DataCollection) State() data.CollectionState { return medc.ColState }
|
||||||
|
func (medc DataCollection) DoNotMergeItems() bool { return medc.DoNotMerge }
|
||||||
|
|
||||||
|
// NewCollection creates an data collection that will return the specified number of
|
||||||
// mock messages when iterated. Exchange type mail
|
// mock messages when iterated. Exchange type mail
|
||||||
func NewMockExchangeCollection(
|
func NewCollection(
|
||||||
storagePath path.Path,
|
storagePath path.Path,
|
||||||
locationPath path.Path,
|
locationPath path.Path,
|
||||||
numMessagesToReturn int,
|
numMessagesToReturn int,
|
||||||
) *MockExchangeDataCollection {
|
) *DataCollection {
|
||||||
c := &MockExchangeDataCollection{
|
c := &DataCollection{
|
||||||
fullPath: storagePath,
|
fullPath: storagePath,
|
||||||
LocPath: locationPath,
|
LocPath: locationPath,
|
||||||
messageCount: numMessagesToReturn,
|
messageCount: numMessagesToReturn,
|
||||||
@ -56,7 +70,7 @@ func NewMockExchangeCollection(
|
|||||||
|
|
||||||
for i := 0; i < c.messageCount; i++ {
|
for i := 0; i < c.messageCount; i++ {
|
||||||
// We can plug in whatever data we want here (can be an io.Reader to a test data file if needed)
|
// We can plug in whatever data we want here (can be an io.Reader to a test data file if needed)
|
||||||
c.Data = append(c.Data, GetMockMessageBytes("From: NewMockExchangeCollection"))
|
c.Data = append(c.Data, MessageBytes("From: NewMockCollection"))
|
||||||
c.Names = append(c.Names, uuid.NewString())
|
c.Names = append(c.Names, uuid.NewString())
|
||||||
c.ModTimes = append(c.ModTimes, baseTime.Add(1*time.Hour))
|
c.ModTimes = append(c.ModTimes, baseTime.Add(1*time.Hour))
|
||||||
c.DeletedItems = append(c.DeletedItems, false)
|
c.DeletedItems = append(c.DeletedItems, false)
|
||||||
@ -65,10 +79,10 @@ func NewMockExchangeCollection(
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMockExchangeDataCollection creates an data collection that will return the specified number of
|
// NewContactCollection creates an data collection that will return the specified number of
|
||||||
// mock messages when iterated. Exchange type mail
|
// mock messages when iterated. Exchange type mail
|
||||||
func NewMockContactCollection(pathRepresentation path.Path, numMessagesToReturn int) *MockExchangeDataCollection {
|
func NewContactCollection(pathRepresentation path.Path, numMessagesToReturn int) *DataCollection {
|
||||||
c := &MockExchangeDataCollection{
|
c := &DataCollection{
|
||||||
fullPath: pathRepresentation,
|
fullPath: pathRepresentation,
|
||||||
messageCount: numMessagesToReturn,
|
messageCount: numMessagesToReturn,
|
||||||
Data: [][]byte{},
|
Data: [][]byte{},
|
||||||
@ -94,30 +108,16 @@ func NewMockContactCollection(pathRepresentation path.Path, numMessagesToReturn
|
|||||||
|
|
||||||
for i := 0; i < c.messageCount; i++ {
|
for i := 0; i < c.messageCount; i++ {
|
||||||
// We can plug in whatever data we want here (can be an io.Reader to a test data file if needed)
|
// We can plug in whatever data we want here (can be an io.Reader to a test data file if needed)
|
||||||
c.Data = append(c.Data, GetMockContactBytes(middleNames[rand.Intn(len(middleNames))]))
|
c.Data = append(c.Data, ContactBytes(middleNames[rand.Intn(len(middleNames))]))
|
||||||
c.Names = append(c.Names, uuid.NewString())
|
c.Names = append(c.Names, uuid.NewString())
|
||||||
}
|
}
|
||||||
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (medc MockExchangeDataCollection) FullPath() path.Path { return medc.fullPath }
|
|
||||||
|
|
||||||
func (medc MockExchangeDataCollection) LocationPath() *path.Builder {
|
|
||||||
if medc.LocPath == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return path.Builder{}.Append(medc.LocPath.Folders()...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (medc MockExchangeDataCollection) PreviousPath() path.Path { return medc.PrevPath }
|
|
||||||
func (medc MockExchangeDataCollection) State() data.CollectionState { return medc.ColState }
|
|
||||||
func (medc MockExchangeDataCollection) DoNotMergeItems() bool { return medc.DoNotMerge }
|
|
||||||
|
|
||||||
// Items returns a channel that has the next items in the collection. The
|
// Items returns a channel that has the next items in the collection. The
|
||||||
// channel is closed when there are no more items available.
|
// channel is closed when there are no more items available.
|
||||||
func (medc *MockExchangeDataCollection) Items(
|
func (medc *DataCollection) Items(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
_ *fault.Bus, // unused
|
_ *fault.Bus, // unused
|
||||||
) <-chan data.Stream {
|
) <-chan data.Stream {
|
||||||
@ -127,7 +127,7 @@ func (medc *MockExchangeDataCollection) Items(
|
|||||||
defer close(res)
|
defer close(res)
|
||||||
|
|
||||||
for i := 0; i < medc.messageCount; i++ {
|
for i := 0; i < medc.messageCount; i++ {
|
||||||
res <- &MockExchangeData{
|
res <- &Data{
|
||||||
ID: medc.Names[i],
|
ID: medc.Names[i],
|
||||||
Reader: io.NopCloser(bytes.NewReader(medc.Data[i])),
|
Reader: io.NopCloser(bytes.NewReader(medc.Data[i])),
|
||||||
size: int64(len(medc.Data[i])),
|
size: int64(len(medc.Data[i])),
|
||||||
@ -140,8 +140,8 @@ func (medc *MockExchangeDataCollection) Items(
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExchangeData represents a single item retrieved from exchange
|
// Data represents a single item retrieved from exchange
|
||||||
type MockExchangeData struct {
|
type Data struct {
|
||||||
ID string
|
ID string
|
||||||
Reader io.ReadCloser
|
Reader io.ReadCloser
|
||||||
ReadErr error
|
ReadErr error
|
||||||
@ -150,15 +150,12 @@ type MockExchangeData struct {
|
|||||||
deleted bool
|
deleted bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (med *MockExchangeData) UUID() string {
|
func (med *Data) UUID() string { return med.ID }
|
||||||
return med.ID
|
func (med *Data) Deleted() bool { return med.deleted }
|
||||||
}
|
func (med *Data) Size() int64 { return med.size }
|
||||||
|
func (med *Data) ModTime() time.Time { return med.modifiedTime }
|
||||||
|
|
||||||
func (med MockExchangeData) Deleted() bool {
|
func (med *Data) ToReader() io.ReadCloser {
|
||||||
return med.deleted
|
|
||||||
}
|
|
||||||
|
|
||||||
func (med *MockExchangeData) ToReader() io.ReadCloser {
|
|
||||||
if med.ReadErr != nil {
|
if med.ReadErr != nil {
|
||||||
return io.NopCloser(errReader{med.ReadErr})
|
return io.NopCloser(errReader{med.ReadErr})
|
||||||
}
|
}
|
||||||
@ -166,7 +163,7 @@ func (med *MockExchangeData) ToReader() io.ReadCloser {
|
|||||||
return med.Reader
|
return med.Reader
|
||||||
}
|
}
|
||||||
|
|
||||||
func (med *MockExchangeData) Info() details.ItemInfo {
|
func (med *Data) Info() details.ItemInfo {
|
||||||
return details.ItemInfo{
|
return details.ItemInfo{
|
||||||
Exchange: &details.ExchangeInfo{
|
Exchange: &details.ExchangeInfo{
|
||||||
Sender: "foo@bar.com",
|
Sender: "foo@bar.com",
|
||||||
@ -176,14 +173,6 @@ func (med *MockExchangeData) Info() details.ItemInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (med *MockExchangeData) Size() int64 {
|
|
||||||
return med.size
|
|
||||||
}
|
|
||||||
|
|
||||||
func (med *MockExchangeData) ModTime() time.Time {
|
|
||||||
return med.modifiedTime
|
|
||||||
}
|
|
||||||
|
|
||||||
type errReader struct {
|
type errReader struct {
|
||||||
readErr error
|
readErr error
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package mockconnector
|
package mock
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
@ -43,12 +43,12 @@ const (
|
|||||||
defaultContactSurname = "Quail"
|
defaultContactSurname = "Quail"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetMockContactBytes returns bytes for Contactable item.
|
// ContactBytes returns bytes for Contactable item.
|
||||||
// When hydrated: contact.GetGivenName() shows differences
|
// When hydrated: contact.GetGivenName() shows differences
|
||||||
func GetMockContactBytes(middleName string) []byte {
|
func ContactBytes(middleName string) []byte {
|
||||||
phone := generatePhoneNumber()
|
phone := generatePhoneNumber()
|
||||||
|
|
||||||
return GetMockContactBytesWith(
|
return ContactBytesWith(
|
||||||
defaultContactDisplayName,
|
defaultContactDisplayName,
|
||||||
defaultContactFileAsName,
|
defaultContactFileAsName,
|
||||||
defaultContactGivenName,
|
defaultContactGivenName,
|
||||||
@ -58,7 +58,7 @@ func GetMockContactBytes(middleName string) []byte {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockContactBytesWith(
|
func ContactBytesWith(
|
||||||
displayName, fileAsName,
|
displayName, fileAsName,
|
||||||
givenName, middleName, surname,
|
givenName, middleName, surname,
|
||||||
phone string,
|
phone string,
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package mockconnector
|
package mock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -213,37 +213,37 @@ func generatePhoneNumber() string {
|
|||||||
return phoneNo
|
return phoneNo
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockEventBytes returns test byte array representative of full Eventable item.
|
// EventBytes returns test byte array representative of full Eventable item.
|
||||||
func GetDefaultMockEventBytes(subject string) []byte {
|
func EventBytes(subject string) []byte {
|
||||||
return GetMockEventWithSubjectBytes(" " + subject + " Review + Lunch")
|
return EventWithSubjectBytes(" " + subject + " Review + Lunch")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockEventWithSubjectBytes(subject string) []byte {
|
func EventWithSubjectBytes(subject string) []byte {
|
||||||
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
||||||
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
||||||
atTime := common.FormatTime(at)
|
atTime := common.FormatTime(at)
|
||||||
endTime := common.FormatTime(at.Add(30 * time.Minute))
|
endTime := common.FormatTime(at.Add(30 * time.Minute))
|
||||||
|
|
||||||
return GetMockEventWith(
|
return EventWith(
|
||||||
defaultEventOrganizer, subject,
|
defaultEventOrganizer, subject,
|
||||||
defaultEventBody, defaultEventBodyPreview,
|
defaultEventBody, defaultEventBodyPreview,
|
||||||
atTime, endTime, NoRecurrence, NoAttendees, false,
|
atTime, endTime, NoRecurrence, NoAttendees, false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockEventWithAttachment(subject string) []byte {
|
func EventWithAttachment(subject string) []byte {
|
||||||
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
||||||
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
||||||
atTime := common.FormatTime(at)
|
atTime := common.FormatTime(at)
|
||||||
|
|
||||||
return GetMockEventWith(
|
return EventWith(
|
||||||
defaultEventOrganizer, subject,
|
defaultEventOrganizer, subject,
|
||||||
defaultEventBody, defaultEventBodyPreview,
|
defaultEventBody, defaultEventBodyPreview,
|
||||||
atTime, atTime, NoRecurrence, NoAttendees, true,
|
atTime, atTime, NoRecurrence, NoAttendees, true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockEventWithRecurrenceBytes(subject, recurrenceTimeZone string) []byte {
|
func EventWithRecurrenceBytes(subject, recurrenceTimeZone string) []byte {
|
||||||
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
||||||
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
||||||
atTime := common.FormatTime(at)
|
atTime := common.FormatTime(at)
|
||||||
@ -255,31 +255,31 @@ func GetMockEventWithRecurrenceBytes(subject, recurrenceTimeZone string) []byte
|
|||||||
recurrenceTimeZone,
|
recurrenceTimeZone,
|
||||||
))
|
))
|
||||||
|
|
||||||
return GetMockEventWith(
|
return EventWith(
|
||||||
defaultEventOrganizer, subject,
|
defaultEventOrganizer, subject,
|
||||||
defaultEventBody, defaultEventBodyPreview,
|
defaultEventBody, defaultEventBodyPreview,
|
||||||
atTime, atTime, recurrence, attendeesTmpl, true,
|
atTime, atTime, recurrence, attendeesTmpl, true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockEventWithAttendeesBytes(subject string) []byte {
|
func EventWithAttendeesBytes(subject string) []byte {
|
||||||
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
tomorrow := time.Now().UTC().AddDate(0, 0, 1)
|
||||||
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
at := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), tomorrow.Hour(), 0, 0, 0, time.UTC)
|
||||||
atTime := common.FormatTime(at)
|
atTime := common.FormatTime(at)
|
||||||
|
|
||||||
return GetMockEventWith(
|
return EventWith(
|
||||||
defaultEventOrganizer, subject,
|
defaultEventOrganizer, subject,
|
||||||
defaultEventBody, defaultEventBodyPreview,
|
defaultEventBody, defaultEventBodyPreview,
|
||||||
atTime, atTime, NoRecurrence, attendeesTmpl, true,
|
atTime, atTime, NoRecurrence, attendeesTmpl, true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockEventWith returns bytes for an Eventable item.
|
// EventWith returns bytes for an Eventable item.
|
||||||
// start and end times should be in the format 2006-01-02T15:04:05.0000000Z.
|
// start and end times should be in the format 2006-01-02T15:04:05.0000000Z.
|
||||||
// The timezone (Z) will be automatically stripped. A non-utc timezone may
|
// The timezone (Z) will be automatically stripped. A non-utc timezone may
|
||||||
// produce unexpected results.
|
// produce unexpected results.
|
||||||
// Body must contain a well-formatted string, consumable in a json payload. IE: no unescaped newlines.
|
// Body must contain a well-formatted string, consumable in a json payload. IE: no unescaped newlines.
|
||||||
func GetMockEventWith(
|
func EventWith(
|
||||||
organizer, subject, body, bodyPreview,
|
organizer, subject, body, bodyPreview,
|
||||||
startDateTime, endDateTime, recurrence, attendees string,
|
startDateTime, endDateTime, recurrence, attendees string,
|
||||||
hasAttachments bool,
|
hasAttachments bool,
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package mockconnector
|
package mock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
@ -103,19 +103,19 @@ const (
|
|||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetMockMessageBytes returns bytes for a Messageable item.
|
// MessageBytes returns bytes for a Messageable item.
|
||||||
// Contents verified as working with sample data from kiota-serialization-json-go v0.5.5
|
// Contents verified as working with sample data from kiota-serialization-json-go v0.5.5
|
||||||
func GetMockMessageBytes(subject string) []byte {
|
func MessageBytes(subject string) []byte {
|
||||||
return GetMockMessageWithBodyBytes(
|
return MessageWithBodyBytes(
|
||||||
"TPS Report "+subject+" "+common.FormatNow(common.SimpleDateTime),
|
"TPS Report "+subject+" "+common.FormatNow(common.SimpleDateTime),
|
||||||
defaultMessageBody, defaultMessagePreview)
|
defaultMessageBody, defaultMessagePreview)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockMessageBytes returns bytes for a Messageable item.
|
// MessageWithBodyBytes returns bytes for a Messageable item.
|
||||||
// Contents verified as working with sample data from kiota-serialization-json-go v0.5.5
|
// Contents verified as working with sample data from kiota-serialization-json-go v0.5.5
|
||||||
// Body must contain a well-formatted string, consumable in a json payload. IE: no unescaped newlines.
|
// Body must contain a well-formatted string, consumable in a json payload. IE: no unescaped newlines.
|
||||||
func GetMockMessageWithBodyBytes(subject, body, preview string) []byte {
|
func MessageWithBodyBytes(subject, body, preview string) []byte {
|
||||||
return GetMockMessageWith(
|
return MessageWith(
|
||||||
defaultMessageTo,
|
defaultMessageTo,
|
||||||
defaultMessageFrom,
|
defaultMessageFrom,
|
||||||
defaultMessageSender,
|
defaultMessageSender,
|
||||||
@ -129,11 +129,11 @@ func GetMockMessageWithBodyBytes(subject, body, preview string) []byte {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockMessageWith returns bytes for a Messageable item.
|
// MessageWith returns bytes for a Messageable item.
|
||||||
// Contents verified as working with sample data from kiota-serialization-json-go v0.5.5
|
// Contents verified as working with sample data from kiota-serialization-json-go v0.5.5
|
||||||
// created, modified, sent, and received should be in the format 2006-01-02T15:04:05Z
|
// created, modified, sent, and received should be in the format 2006-01-02T15:04:05Z
|
||||||
// Body must contain a well-formatted string, consumable in a json payload. IE: no unescaped newlines.
|
// Body must contain a well-formatted string, consumable in a json payload. IE: no unescaped newlines.
|
||||||
func GetMockMessageWith(
|
func MessageWith(
|
||||||
to, from, sender, // user PNs
|
to, from, sender, // user PNs
|
||||||
subject, body, preview, // arbitrary data
|
subject, body, preview, // arbitrary data
|
||||||
created, modified, sent, received string, // legacy datetimes
|
created, modified, sent, received string, // legacy datetimes
|
||||||
@ -162,10 +162,10 @@ func GetMockMessageWith(
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockMessageWithDirectAttachment returns a message an attachment that contains n MB of data.
|
// MessageWithDirectAttachment returns a message an attachment that contains n MB of data.
|
||||||
// Max limit on N is 35 (imposed by exchange) .
|
// Max limit on N is 35 (imposed by exchange) .
|
||||||
// Serialized with: kiota-serialization-json-go v0.7.1
|
// Serialized with: kiota-serialization-json-go v0.7.1
|
||||||
func GetMockMessageWithSizedAttachment(subject string, n int) []byte {
|
func MessageWithSizedAttachment(subject string, n int) []byte {
|
||||||
// I know we said 35, but after base64encoding, 24mb of base content
|
// I know we said 35, but after base64encoding, 24mb of base content
|
||||||
// bloats up to 34mb (35 balloons to 49). So we have to restrict n
|
// bloats up to 34mb (35 balloons to 49). So we have to restrict n
|
||||||
// appropriately.
|
// appropriately.
|
||||||
@ -197,9 +197,9 @@ func GetMockMessageWithSizedAttachment(subject string, n int) []byte {
|
|||||||
return []byte(fmt.Sprintf(messageFmt, attachmentSize, base64.StdEncoding.EncodeToString([]byte(attachmentBytes))))
|
return []byte(fmt.Sprintf(messageFmt, attachmentSize, base64.StdEncoding.EncodeToString([]byte(attachmentBytes))))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockMessageWithDirectAttachment returns a message with inline attachment
|
// MessageWithDirectAttachment returns a message with inline attachment
|
||||||
// Serialized with: kiota-serialization-json-go v0.7.1
|
// Serialized with: kiota-serialization-json-go v0.7.1
|
||||||
func GetMockMessageWithDirectAttachment(subject string) []byte {
|
func MessageWithDirectAttachment(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
message := "{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB4moqeAAA=\"," +
|
message := "{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB4moqeAAA=\"," +
|
||||||
"\"@odata.type\":\"#microsoft.graph.message\",\"@odata.etag\":\"W/\\\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB3maFQ\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('a4a472f8-ccb0-43ec-bf52-3697a91b926c')/messages/$entity\",\"categories\":[]," +
|
"\"@odata.type\":\"#microsoft.graph.message\",\"@odata.etag\":\"W/\\\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB3maFQ\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('a4a472f8-ccb0-43ec-bf52-3697a91b926c')/messages/$entity\",\"categories\":[]," +
|
||||||
@ -266,16 +266,16 @@ func GetMockMessageWithDirectAttachment(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockMessageWithDirectAttachment returns a message with a large attachment. This is derived from the message
|
// MessageWithDirectAttachment returns a message with a large attachment. This is derived from the message
|
||||||
// used in GetMockMessageWithDirectAttachment
|
// used in MessageWithDirectAttachment
|
||||||
// Serialized with: kiota-serialization-json-go v0.7.1
|
// Serialized with: kiota-serialization-json-go v0.7.1
|
||||||
func GetMockMessageWithLargeAttachment(subject string) []byte {
|
func MessageWithLargeAttachment(subject string) []byte {
|
||||||
return GetMockMessageWithSizedAttachment(subject, 3)
|
return MessageWithSizedAttachment(subject, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMessageWithOneDriveAttachment returns a message with an OneDrive attachment represented in bytes
|
// GetMessageWithOneDriveAttachment returns a message with an OneDrive attachment represented in bytes
|
||||||
// Serialized with: kiota-serialization-json-go v0.7.1
|
// Serialized with: kiota-serialization-json-go v0.7.1
|
||||||
func GetMessageWithOneDriveAttachment(subject string) []byte {
|
func MessageWithOneDriveAttachment(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
message := "{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB4moqfAAA=\"," +
|
message := "{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB4moqfAAA=\"," +
|
||||||
"\"@odata.type\":\"#microsoft.graph.message\",\"@odata.etag\":\"W/\\\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB3maFw\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('a4a472f8-ccb0-43ec-bf52-3697a91b926c')/messages/$entity\",\"categories\":[]," +
|
"\"@odata.type\":\"#microsoft.graph.message\",\"@odata.etag\":\"W/\\\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB3maFw\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('a4a472f8-ccb0-43ec-bf52-3697a91b926c')/messages/$entity\",\"categories\":[]," +
|
||||||
@ -293,9 +293,9 @@ func GetMessageWithOneDriveAttachment(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockMessageWithTwoAttachments returns byte representation of message with two attachments
|
// MessageWithTwoAttachments returns byte representation of message with two attachments
|
||||||
// Serialized with: kiota-serialization-json-go v0.7.1
|
// Serialized with: kiota-serialization-json-go v0.7.1
|
||||||
func GetMockMessageWithTwoAttachments(subject string) []byte {
|
func MessageWithTwoAttachments(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
message := "{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB6LpD0AAA=\",\"@odata.type\":\"#microsoft.graph.message\",\"@odata.etag\":\"W/\\\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB5JBpO\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('a4a472f8-ccb0-43ec-bf52-3697a91b926c')/messages/$entity\",\"categories\":[],\"changeKey\":\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB5JBpO\"," +
|
message := "{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB6LpD0AAA=\",\"@odata.type\":\"#microsoft.graph.message\",\"@odata.etag\":\"W/\\\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB5JBpO\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('a4a472f8-ccb0-43ec-bf52-3697a91b926c')/messages/$entity\",\"categories\":[],\"changeKey\":\"CQAAABYAAADSEBNbUIB9RL6ePDeF3FIYAAB5JBpO\"," +
|
||||||
"\"createdDateTime\":\"2022-09-30T20:31:22Z\",\"lastModifiedDateTime\":\"2022-09-30T20:31:25Z\",\"attachments\":[{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB6LpD0AAABEgAQAMIBac0_D4pPgtgr9mhVWaM=\",\"@odata.type\":\"#microsoft.graph.fileAttachment\",\"@odata.mediaContentType\":\"text/plain\",\"contentType\":\"text/plain\",\"isInline\":false,\"lastModifiedDateTime\":\"2022-09-30T20:31:22Z\"," +
|
"\"createdDateTime\":\"2022-09-30T20:31:22Z\",\"lastModifiedDateTime\":\"2022-09-30T20:31:25Z\",\"attachments\":[{\"id\":\"AAMkAGZmNjNlYjI3LWJlZWYtNGI4Mi04YjMyLTIxYThkNGQ4NmY1MwBGAAAAAADCNgjhM9QmQYWNcI7hCpPrBwDSEBNbUIB9RL6ePDeF3FIYAAAAAAEMAADSEBNbUIB9RL6ePDeF3FIYAAB6LpD0AAABEgAQAMIBac0_D4pPgtgr9mhVWaM=\",\"@odata.type\":\"#microsoft.graph.fileAttachment\",\"@odata.mediaContentType\":\"text/plain\",\"contentType\":\"text/plain\",\"isInline\":false,\"lastModifiedDateTime\":\"2022-09-30T20:31:22Z\"," +
|
||||||
@ -313,9 +313,9 @@ func GetMockMessageWithTwoAttachments(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockEventMessageResponse returns byte representation of EventMessageResponse
|
// EventMessageResponse returns byte representation of EventMessageResponse
|
||||||
// Special Mock to ensure that EventMessageResponse emails are transformed properly
|
// Special Mock to ensure that EventMessageResponse emails are transformed properly
|
||||||
func GetMockEventMessageResponse(subject string) []byte {
|
func EventMessageResponse(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
message := "{\"id\":\"AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8_7BwB8wYc0thTTTYl3RpEYIUq_AAAAAAEMAAB8wYc0thTTTYl3RpEYIUq_AACL4y38AAA=\"," +
|
message := "{\"id\":\"AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8_7BwB8wYc0thTTTYl3RpEYIUq_AAAAAAEMAAB8wYc0thTTTYl3RpEYIUq_AACL4y38AAA=\"," +
|
||||||
"\"@odata.type\":\"#microsoft.graph.eventMessageResponse\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('dustina%408qzvrj.onmicrosoft.com')/messages/$entity\"," +
|
"\"@odata.type\":\"#microsoft.graph.eventMessageResponse\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('dustina%408qzvrj.onmicrosoft.com')/messages/$entity\"," +
|
||||||
@ -329,9 +329,9 @@ func GetMockEventMessageResponse(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockEventMessageRequest returns byte representation of EventMessageRequest
|
// EventMessageRequest returns byte representation of EventMessageRequest
|
||||||
// Special Mock to ensure that EventMessageRequests are transformed properly
|
// Special Mock to ensure that EventMessageRequests are transformed properly
|
||||||
func GetMockEventMessageRequest(subject string) []byte {
|
func EventMessageRequest(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
message := "{\"id\":\"AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8_7BwB8wYc0thTTTYl3RpEYIUq_AAAAAAEJAAB8wYc0thTTTYl3RpEYIUq_AACL5VwSAAA=\"," +
|
message := "{\"id\":\"AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8_7BwB8wYc0thTTTYl3RpEYIUq_AAAAAAEJAAB8wYc0thTTTYl3RpEYIUq_AACL5VwSAAA=\"," +
|
||||||
"\"@odata.type\":\"#microsoft.graph.eventMessageRequest\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('dustina%408qzvrj.onmicrosoft.com')/messages/$entity\"," +
|
"\"@odata.type\":\"#microsoft.graph.eventMessageRequest\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('dustina%408qzvrj.onmicrosoft.com')/messages/$entity\"," +
|
||||||
@ -344,7 +344,7 @@ func GetMockEventMessageRequest(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockMessageWithItemAttachmentEvent(subject string) []byte {
|
func MessageWithItemAttachmentEvent(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
message := "{\"id\":\"AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8_7BwB8wYc0thTTTYl3RpEYIUq_AAAAAAEMAAB8wYc0thTTTYl3RpEYIUq_AADFfThMAAA=\",\"@odata.type\":\"#microsoft.graph.message\"," +
|
message := "{\"id\":\"AAMkAGQ1NzViZTdhLTEwMTMtNGJjNi05YWI2LTg4NWRlZDA2Y2UxOABGAAAAAAAPvVwUramXT7jlSGpVU8_7BwB8wYc0thTTTYl3RpEYIUq_AAAAAAEMAAB8wYc0thTTTYl3RpEYIUq_AADFfThMAAA=\",\"@odata.type\":\"#microsoft.graph.message\"," +
|
||||||
"\"@odata.etag\":\"W/\\\"CQAAABYAAAB8wYc0thTTTYl3RpEYIUq+AADFK3BH\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('dustina%408qzvrj.onmicrosoft.com')/messages/$entity\",\"categories\":[]," +
|
"\"@odata.etag\":\"W/\\\"CQAAABYAAAB8wYc0thTTTYl3RpEYIUq+AADFK3BH\\\"\",\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#users('dustina%408qzvrj.onmicrosoft.com')/messages/$entity\",\"categories\":[]," +
|
||||||
@ -367,7 +367,7 @@ func GetMockMessageWithItemAttachmentEvent(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockMessageWithItemAttachmentMail(subject string) []byte {
|
func MessageWithItemAttachmentMail(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
// Order of fields:
|
// Order of fields:
|
||||||
// 1. subject
|
// 1. subject
|
||||||
@ -504,7 +504,7 @@ func GetMockMessageWithItemAttachmentMail(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockMessageWithNestedItemAttachmentEvent(subject string) []byte {
|
func MessageWithNestedItemAttachmentEvent(subject string) []byte {
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
// Order of fields:
|
// Order of fields:
|
||||||
// 1. subject
|
// 1. subject
|
||||||
@ -690,8 +690,8 @@ func GetMockMessageWithNestedItemAttachmentEvent(subject string) []byte {
|
|||||||
return []byte(message)
|
return []byte(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockMessageWithNestedItemAttachmentMail(t *testing.T, nested []byte, subject string) []byte {
|
func MessageWithNestedItemAttachmentMail(t *testing.T, nested []byte, subject string) []byte {
|
||||||
base := GetMockMessageBytes(subject)
|
base := MessageBytes(subject)
|
||||||
message, err := hydrateMessage(base)
|
message, err := hydrateMessage(base)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
@ -710,8 +710,8 @@ func GetMockMessageWithNestedItemAttachmentMail(t *testing.T, nested []byte, sub
|
|||||||
return serialize(t, message)
|
return serialize(t, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetMockMessageWithNestedItemAttachmentContact(t *testing.T, nested []byte, subject string) []byte {
|
func MessageWithNestedItemAttachmentContact(t *testing.T, nested []byte, subject string) []byte {
|
||||||
base := GetMockMessageBytes(subject)
|
base := MessageBytes(subject)
|
||||||
message, err := hydrateMessage(base)
|
message, err := hydrateMessage(base)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package mockconnector_test
|
package mock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@ -6,32 +6,30 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
kioser "github.com/microsoft/kiota-serialization-json-go"
|
|
||||||
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MockExchangeCollectionSuite struct {
|
type MockSuite struct {
|
||||||
tester.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMockExchangeCollectionSuite(t *testing.T) {
|
func TestMockSuite(t *testing.T) {
|
||||||
suite.Run(t, &MockExchangeCollectionSuite{Suite: tester.NewUnitSuite(t)})
|
suite.Run(t, &MockSuite{Suite: tester.NewUnitSuite(t)})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *MockExchangeCollectionSuite) TestMockExchangeCollection() {
|
func (suite *MockSuite) TestMockExchangeCollection() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
mdc := mockconnector.NewMockExchangeCollection(nil, nil, 2)
|
mdc := NewCollection(nil, nil, 2)
|
||||||
messagesRead := 0
|
messagesRead := 0
|
||||||
|
|
||||||
for item := range mdc.Items(ctx, fault.New(true)) {
|
for item := range mdc.Items(ctx, fault.New(true)) {
|
||||||
@ -43,12 +41,12 @@ func (suite *MockExchangeCollectionSuite) TestMockExchangeCollection() {
|
|||||||
assert.Equal(suite.T(), 2, messagesRead)
|
assert.Equal(suite.T(), 2, messagesRead)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *MockExchangeCollectionSuite) TestMockExchangeCollectionItemSize() {
|
func (suite *MockSuite) TestMockExchangeCollectionItemSize() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
mdc := mockconnector.NewMockExchangeCollection(nil, nil, 2)
|
mdc := NewCollection(nil, nil, 2)
|
||||||
mdc.Data[1] = []byte("This is some buffer of data so that the size is different than the default")
|
mdc.Data[1] = []byte("This is some buffer of data so that the size is different than the default")
|
||||||
|
|
||||||
for item := range mdc.Items(ctx, fault.New(true)) {
|
for item := range mdc.Items(ctx, fault.New(true)) {
|
||||||
@ -63,12 +61,12 @@ func (suite *MockExchangeCollectionSuite) TestMockExchangeCollectionItemSize() {
|
|||||||
|
|
||||||
// NewExchangeCollectionMail_Hydration tests that mock exchange mail data collection can be used for restoration
|
// NewExchangeCollectionMail_Hydration tests that mock exchange mail data collection can be used for restoration
|
||||||
// functions by verifying no failures on (de)serializing steps using kiota serialization library
|
// functions by verifying no failures on (de)serializing steps using kiota serialization library
|
||||||
func (suite *MockExchangeCollectionSuite) TestMockExchangeCollection_NewExchangeCollectionMail_Hydration() {
|
func (suite *MockSuite) TestMockExchangeCollection_NewExchangeCollectionMail_Hydration() {
|
||||||
ctx, flush := tester.NewContext()
|
ctx, flush := tester.NewContext()
|
||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
mdc := mockconnector.NewMockExchangeCollection(nil, nil, 3)
|
mdc := NewCollection(nil, nil, 3)
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
|
|
||||||
for stream := range mdc.Items(ctx, fault.New(true)) {
|
for stream := range mdc.Items(ctx, fault.New(true)) {
|
||||||
@ -96,12 +94,12 @@ func (suite *MockExchangeDataSuite) TestMockExchangeData() {
|
|||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
reader *mockconnector.MockExchangeData
|
reader *Data
|
||||||
check require.ErrorAssertionFunc
|
check require.ErrorAssertionFunc
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "NoError",
|
name: "NoError",
|
||||||
reader: &mockconnector.MockExchangeData{
|
reader: &Data{
|
||||||
ID: id,
|
ID: id,
|
||||||
Reader: io.NopCloser(bytes.NewReader(itemData)),
|
Reader: io.NopCloser(bytes.NewReader(itemData)),
|
||||||
},
|
},
|
||||||
@ -109,7 +107,7 @@ func (suite *MockExchangeDataSuite) TestMockExchangeData() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Error",
|
name: "Error",
|
||||||
reader: &mockconnector.MockExchangeData{
|
reader: &Data{
|
||||||
ID: id,
|
ID: id,
|
||||||
ReadErr: assert.AnError,
|
ReadErr: assert.AnError,
|
||||||
},
|
},
|
||||||
@ -143,7 +141,7 @@ func (suite *MockExchangeDataSuite) TestMockByteHydration() {
|
|||||||
{
|
{
|
||||||
name: "Message Bytes",
|
name: "Message Bytes",
|
||||||
transformation: func(t *testing.T) error {
|
transformation: func(t *testing.T) error {
|
||||||
bytes := mockconnector.GetMockMessageBytes(subject)
|
bytes := MessageBytes(subject)
|
||||||
_, err := support.CreateMessageFromBytes(bytes)
|
_, err := support.CreateMessageFromBytes(bytes)
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
@ -151,7 +149,7 @@ func (suite *MockExchangeDataSuite) TestMockByteHydration() {
|
|||||||
{
|
{
|
||||||
name: "Event Message Response: Regression",
|
name: "Event Message Response: Regression",
|
||||||
transformation: func(t *testing.T) error {
|
transformation: func(t *testing.T) error {
|
||||||
bytes := mockconnector.GetMockEventMessageResponse(subject)
|
bytes := EventMessageResponse(subject)
|
||||||
_, err := support.CreateMessageFromBytes(bytes)
|
_, err := support.CreateMessageFromBytes(bytes)
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
@ -159,7 +157,7 @@ func (suite *MockExchangeDataSuite) TestMockByteHydration() {
|
|||||||
{
|
{
|
||||||
name: "Event Message Request: Regression",
|
name: "Event Message Request: Regression",
|
||||||
transformation: func(t *testing.T) error {
|
transformation: func(t *testing.T) error {
|
||||||
bytes := mockconnector.GetMockEventMessageRequest(subject)
|
bytes := EventMessageRequest(subject)
|
||||||
_, err := support.CreateMessageFromBytes(bytes)
|
_, err := support.CreateMessageFromBytes(bytes)
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
@ -167,7 +165,7 @@ func (suite *MockExchangeDataSuite) TestMockByteHydration() {
|
|||||||
{
|
{
|
||||||
name: "Contact Bytes",
|
name: "Contact Bytes",
|
||||||
transformation: func(t *testing.T) error {
|
transformation: func(t *testing.T) error {
|
||||||
bytes := mockconnector.GetMockContactBytes(subject)
|
bytes := ContactBytes(subject)
|
||||||
_, err := support.CreateContactFromBytes(bytes)
|
_, err := support.CreateContactFromBytes(bytes)
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
@ -175,54 +173,11 @@ func (suite *MockExchangeDataSuite) TestMockByteHydration() {
|
|||||||
{
|
{
|
||||||
name: "Event No Attendees Bytes",
|
name: "Event No Attendees Bytes",
|
||||||
transformation: func(t *testing.T) error {
|
transformation: func(t *testing.T) error {
|
||||||
bytes := mockconnector.GetDefaultMockEventBytes(subject)
|
bytes := EventBytes(subject)
|
||||||
_, err := support.CreateEventFromBytes(bytes)
|
_, err := support.CreateEventFromBytes(bytes)
|
||||||
return err
|
return err
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Event w/ Attendees Bytes",
|
|
||||||
transformation: func(t *testing.T) error {
|
|
||||||
bytes := mockconnector.GetMockEventWithAttendeesBytes(subject)
|
|
||||||
_, err := support.CreateEventFromBytes(bytes)
|
|
||||||
return err
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "SharePoint: List Empty",
|
|
||||||
transformation: func(t *testing.T) error {
|
|
||||||
emptyMap := make(map[string]string)
|
|
||||||
temp := mockconnector.GetMockList(subject, "Artist", emptyMap)
|
|
||||||
writer := kioser.NewJsonSerializationWriter()
|
|
||||||
err := writer.WriteObjectValue("", temp)
|
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
|
||||||
|
|
||||||
bytes, err := writer.GetSerializedContent()
|
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
|
||||||
|
|
||||||
_, err = support.CreateListFromBytes(bytes)
|
|
||||||
|
|
||||||
return err
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "SharePoint: List 6 Items",
|
|
||||||
transformation: func(t *testing.T) error {
|
|
||||||
bytes, err := mockconnector.GetMockListBytes(subject)
|
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
|
||||||
_, err = support.CreateListFromBytes(bytes)
|
|
||||||
return err
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "SharePoint: Page",
|
|
||||||
transformation: func(t *testing.T) error {
|
|
||||||
bytes := mockconnector.GetMockPage(subject)
|
|
||||||
_, err := support.CreatePageFromBytes(bytes)
|
|
||||||
|
|
||||||
return err
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
@ -13,8 +13,8 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"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"
|
||||||
@ -84,7 +84,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreContact() {
|
|||||||
|
|
||||||
info, err := RestoreExchangeContact(
|
info, err := RestoreExchangeContact(
|
||||||
ctx,
|
ctx,
|
||||||
mockconnector.GetMockContactBytes("Corso TestContact"),
|
exchMock.ContactBytes("Corso TestContact"),
|
||||||
suite.gs,
|
suite.gs,
|
||||||
control.Copy,
|
control.Copy,
|
||||||
folderID,
|
folderID,
|
||||||
@ -122,11 +122,11 @@ func (suite *ExchangeRestoreSuite) TestRestoreEvent() {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Test Event With Attendees",
|
name: "Test Event With Attendees",
|
||||||
bytes: mockconnector.GetMockEventWithAttendeesBytes(subject),
|
bytes: exchMock.EventWithAttendeesBytes(subject),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test recurrenceTimeZone: Empty",
|
name: "Test recurrenceTimeZone: Empty",
|
||||||
bytes: mockconnector.GetMockEventWithRecurrenceBytes(subject, `""`),
|
bytes: exchMock.EventWithRecurrenceBytes(subject, `""`),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Test Mail",
|
name: "Test Mail",
|
||||||
bytes: mockconnector.GetMockMessageBytes("Restore Exchange Object"),
|
bytes: exchMock.MessageBytes("Restore Exchange Object"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailObject: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreMailObject: " + common.FormatSimpleDateTime(now)
|
||||||
@ -193,7 +193,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: One Direct Attachment",
|
name: "Test Mail: One Direct Attachment",
|
||||||
bytes: mockconnector.GetMockMessageWithDirectAttachment("Restore 1 Attachment"),
|
bytes: exchMock.MessageWithDirectAttachment("Restore 1 Attachment"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailwithAttachment: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreMailwithAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
@ -205,7 +205,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: Item Attachment_Event",
|
name: "Test Mail: Item Attachment_Event",
|
||||||
bytes: mockconnector.GetMockMessageWithItemAttachmentEvent("Event Item Attachment"),
|
bytes: exchMock.MessageWithItemAttachmentEvent("Event Item Attachment"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreEventItemAttachment: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreEventItemAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
@ -217,7 +217,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: Item Attachment_Mail",
|
name: "Test Mail: Item Attachment_Mail",
|
||||||
bytes: mockconnector.GetMockMessageWithItemAttachmentMail("Mail Item Attachment"),
|
bytes: exchMock.MessageWithItemAttachmentMail("Mail Item Attachment"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailItemAttachment: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreMailItemAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
@ -229,8 +229,8 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: Hydrated Item Attachment Mail",
|
name: "Test Mail: Hydrated Item Attachment Mail",
|
||||||
bytes: mockconnector.GetMockMessageWithNestedItemAttachmentMail(t,
|
bytes: exchMock.MessageWithNestedItemAttachmentMail(t,
|
||||||
mockconnector.GetMockMessageBytes("Basic Item Attachment"),
|
exchMock.MessageBytes("Basic Item Attachment"),
|
||||||
"Mail Item Attachment",
|
"Mail Item Attachment",
|
||||||
),
|
),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
@ -244,8 +244,8 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: Hydrated Item Attachment Mail One Attach",
|
name: "Test Mail: Hydrated Item Attachment Mail One Attach",
|
||||||
bytes: mockconnector.GetMockMessageWithNestedItemAttachmentMail(t,
|
bytes: exchMock.MessageWithNestedItemAttachmentMail(t,
|
||||||
mockconnector.GetMockMessageWithDirectAttachment("Item Attachment Included"),
|
exchMock.MessageWithDirectAttachment("Item Attachment Included"),
|
||||||
"Mail Item Attachment",
|
"Mail Item Attachment",
|
||||||
),
|
),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
@ -259,8 +259,8 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: Item Attachment_Contact",
|
name: "Test Mail: Item Attachment_Contact",
|
||||||
bytes: mockconnector.GetMockMessageWithNestedItemAttachmentContact(t,
|
bytes: exchMock.MessageWithNestedItemAttachmentContact(t,
|
||||||
mockconnector.GetMockContactBytes("Victor"),
|
exchMock.ContactBytes("Victor"),
|
||||||
"Contact Item Attachment",
|
"Contact Item Attachment",
|
||||||
),
|
),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
@ -274,7 +274,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{ // Restore will upload the Message without uploading the attachment
|
{ // Restore will upload the Message without uploading the attachment
|
||||||
name: "Test Mail: Item Attachment_NestedEvent",
|
name: "Test Mail: Item Attachment_NestedEvent",
|
||||||
bytes: mockconnector.GetMockMessageWithNestedItemAttachmentEvent("Nested Item Attachment"),
|
bytes: exchMock.MessageWithNestedItemAttachmentEvent("Nested Item Attachment"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreNestedEventItemAttachment: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreNestedEventItemAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
@ -286,7 +286,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: One Large Attachment",
|
name: "Test Mail: One Large Attachment",
|
||||||
bytes: mockconnector.GetMockMessageWithLargeAttachment("Restore Large Attachment"),
|
bytes: exchMock.MessageWithLargeAttachment("Restore Large Attachment"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailwithLargeAttachment: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreMailwithLargeAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
@ -298,7 +298,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: Two Attachments",
|
name: "Test Mail: Two Attachments",
|
||||||
bytes: mockconnector.GetMockMessageWithTwoAttachments("Restore 2 Attachments"),
|
bytes: exchMock.MessageWithTwoAttachments("Restore 2 Attachments"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailwithAttachments: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreMailwithAttachments: " + common.FormatSimpleDateTime(now)
|
||||||
@ -310,7 +310,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Mail: Reference(OneDrive) Attachment",
|
name: "Test Mail: Reference(OneDrive) Attachment",
|
||||||
bytes: mockconnector.GetMessageWithOneDriveAttachment("Restore Reference(OneDrive) Attachment"),
|
bytes: exchMock.MessageWithOneDriveAttachment("Restore Reference(OneDrive) Attachment"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailwithReferenceAttachment: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreMailwithReferenceAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
@ -323,7 +323,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
// TODO: #884 - reinstate when able to specify root folder by name
|
// TODO: #884 - reinstate when able to specify root folder by name
|
||||||
{
|
{
|
||||||
name: "Test Contact",
|
name: "Test Contact",
|
||||||
bytes: mockconnector.GetMockContactBytes("Test_Omega"),
|
bytes: exchMock.ContactBytes("Test_Omega"),
|
||||||
category: path.ContactsCategory,
|
category: path.ContactsCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
folderName := "TestRestoreContactObject: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreContactObject: " + common.FormatSimpleDateTime(now)
|
||||||
@ -335,7 +335,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Events",
|
name: "Test Events",
|
||||||
bytes: mockconnector.GetDefaultMockEventBytes("Restored Event Object"),
|
bytes: exchMock.EventBytes("Restored Event Object"),
|
||||||
category: path.EventsCategory,
|
category: path.EventsCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
calendarName := "TestRestoreEventObject: " + common.FormatSimpleDateTime(now)
|
calendarName := "TestRestoreEventObject: " + common.FormatSimpleDateTime(now)
|
||||||
@ -347,7 +347,7 @@ func (suite *ExchangeRestoreSuite) TestRestoreExchangeObject() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test Event with Attachment",
|
name: "Test Event with Attachment",
|
||||||
bytes: mockconnector.GetMockEventWithAttachment("Restored Event Attachment"),
|
bytes: exchMock.EventWithAttachment("Restored Event Attachment"),
|
||||||
category: path.EventsCategory,
|
category: path.EventsCategory,
|
||||||
destination: func(t *testing.T, ctx context.Context) string {
|
destination: func(t *testing.T, ctx context.Context) string {
|
||||||
calendarName := "TestRestoreEventObject_" + common.FormatSimpleDateTime(now)
|
calendarName := "TestRestoreEventObject_" + common.FormatSimpleDateTime(now)
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import (
|
|||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
@ -1208,7 +1208,7 @@ func collectionsForInfo(
|
|||||||
info.pathElements,
|
info.pathElements,
|
||||||
false)
|
false)
|
||||||
|
|
||||||
mc := mockconnector.NewMockExchangeCollection(pth, pth, len(info.items))
|
mc := exchMock.NewCollection(pth, pth, len(info.items))
|
||||||
baseDestPath := backupOutputPathFromRestore(t, dest, pth)
|
baseDestPath := backupOutputPathFromRestore(t, dest, pth)
|
||||||
|
|
||||||
baseExpected := expectedData[baseDestPath.String()]
|
baseExpected := expectedData[baseDestPath.String()]
|
||||||
@ -1237,7 +1237,7 @@ func collectionsForInfo(
|
|||||||
c := mockRestoreCollection{Collection: mc, auxItems: map[string]data.Stream{}}
|
c := mockRestoreCollection{Collection: mc, auxItems: map[string]data.Stream{}}
|
||||||
|
|
||||||
for _, aux := range info.auxItems {
|
for _, aux := range info.auxItems {
|
||||||
c.auxItems[aux.name] = &mockconnector.MockExchangeData{
|
c.auxItems[aux.name] = &exchMock.Data{
|
||||||
ID: aux.name,
|
ID: aux.name,
|
||||||
Reader: io.NopCloser(bytes.NewReader(aux.data)),
|
Reader: io.NopCloser(bytes.NewReader(aux.data)),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,9 @@ import (
|
|||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
"github.com/alcionai/corso/src/internal/connector/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
@ -39,19 +40,6 @@ func TestGraphConnectorUnitSuite(t *testing.T) {
|
|||||||
suite.Run(t, &GraphConnectorUnitSuite{Suite: tester.NewUnitSuite(t)})
|
suite.Run(t, &GraphConnectorUnitSuite{Suite: tester.NewUnitSuite(t)})
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ getIDAndNamer = &mockNameIDGetter{}
|
|
||||||
|
|
||||||
type mockNameIDGetter struct {
|
|
||||||
id, name string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mnig mockNameIDGetter) GetIDAndName(
|
|
||||||
_ context.Context,
|
|
||||||
_ string,
|
|
||||||
) (string, string, error) {
|
|
||||||
return mnig.id, mnig.name, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (suite *GraphConnectorUnitSuite) TestPopulateOwnerIDAndNamesFrom() {
|
func (suite *GraphConnectorUnitSuite) TestPopulateOwnerIDAndNamesFrom() {
|
||||||
const (
|
const (
|
||||||
id = "owner-id"
|
id = "owner-id"
|
||||||
@ -63,9 +51,9 @@ func (suite *GraphConnectorUnitSuite) TestPopulateOwnerIDAndNamesFrom() {
|
|||||||
nti = map[string]string{name: id}
|
nti = map[string]string{name: id}
|
||||||
lookup = &resourceClient{
|
lookup = &resourceClient{
|
||||||
enum: Users,
|
enum: Users,
|
||||||
getter: &mockNameIDGetter{id: id, name: name},
|
getter: &mock.IDNameGetter{ID: id, Name: name},
|
||||||
}
|
}
|
||||||
noLookup = &resourceClient{enum: Users, getter: &mockNameIDGetter{}}
|
noLookup = &resourceClient{enum: Users, getter: &mock.IDNameGetter{}}
|
||||||
)
|
)
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
@ -719,14 +707,14 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID",
|
name: "someencodeditemID",
|
||||||
data: mockconnector.GetMockMessageWithDirectAttachment(
|
data: exchMock.MessageWithDirectAttachment(
|
||||||
subjectText + "-1",
|
subjectText + "-1",
|
||||||
),
|
),
|
||||||
lookupKey: subjectText + "-1",
|
lookupKey: subjectText + "-1",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "someencodeditemID2",
|
name: "someencodeditemID2",
|
||||||
data: mockconnector.GetMockMessageWithTwoAttachments(
|
data: exchMock.MessageWithTwoAttachments(
|
||||||
subjectText + "-2",
|
subjectText + "-2",
|
||||||
),
|
),
|
||||||
lookupKey: subjectText + "-2",
|
lookupKey: subjectText + "-2",
|
||||||
@ -746,7 +734,7 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID",
|
name: "someencodeditemID",
|
||||||
data: mockconnector.GetMockMessageWithBodyBytes(
|
data: exchMock.MessageWithBodyBytes(
|
||||||
subjectText+"-1",
|
subjectText+"-1",
|
||||||
bodyText+" 1.",
|
bodyText+" 1.",
|
||||||
bodyText+" 1.",
|
bodyText+" 1.",
|
||||||
@ -761,7 +749,7 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID2",
|
name: "someencodeditemID2",
|
||||||
data: mockconnector.GetMockMessageWithBodyBytes(
|
data: exchMock.MessageWithBodyBytes(
|
||||||
subjectText+"-2",
|
subjectText+"-2",
|
||||||
bodyText+" 2.",
|
bodyText+" 2.",
|
||||||
bodyText+" 2.",
|
bodyText+" 2.",
|
||||||
@ -770,7 +758,7 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "someencodeditemID3",
|
name: "someencodeditemID3",
|
||||||
data: mockconnector.GetMockMessageWithBodyBytes(
|
data: exchMock.MessageWithBodyBytes(
|
||||||
subjectText+"-3",
|
subjectText+"-3",
|
||||||
bodyText+" 3.",
|
bodyText+" 3.",
|
||||||
bodyText+" 3.",
|
bodyText+" 3.",
|
||||||
@ -785,7 +773,7 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID4",
|
name: "someencodeditemID4",
|
||||||
data: mockconnector.GetMockMessageWithBodyBytes(
|
data: exchMock.MessageWithBodyBytes(
|
||||||
subjectText+"-4",
|
subjectText+"-4",
|
||||||
bodyText+" 4.",
|
bodyText+" 4.",
|
||||||
bodyText+" 4.",
|
bodyText+" 4.",
|
||||||
@ -800,7 +788,7 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID5",
|
name: "someencodeditemID5",
|
||||||
data: mockconnector.GetMockMessageWithBodyBytes(
|
data: exchMock.MessageWithBodyBytes(
|
||||||
subjectText+"-5",
|
subjectText+"-5",
|
||||||
bodyText+" 5.",
|
bodyText+" 5.",
|
||||||
bodyText+" 5.",
|
bodyText+" 5.",
|
||||||
@ -822,17 +810,17 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID",
|
name: "someencodeditemID",
|
||||||
data: mockconnector.GetMockContactBytes("Ghimley"),
|
data: exchMock.ContactBytes("Ghimley"),
|
||||||
lookupKey: "Ghimley",
|
lookupKey: "Ghimley",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "someencodeditemID2",
|
name: "someencodeditemID2",
|
||||||
data: mockconnector.GetMockContactBytes("Irgot"),
|
data: exchMock.ContactBytes("Irgot"),
|
||||||
lookupKey: "Irgot",
|
lookupKey: "Irgot",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "someencodeditemID3",
|
name: "someencodeditemID3",
|
||||||
data: mockconnector.GetMockContactBytes("Jannes"),
|
data: exchMock.ContactBytes("Jannes"),
|
||||||
lookupKey: "Jannes",
|
lookupKey: "Jannes",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -850,17 +838,17 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID",
|
name: "someencodeditemID",
|
||||||
data: mockconnector.GetMockContactBytes("Ghimley"),
|
data: exchMock.ContactBytes("Ghimley"),
|
||||||
lookupKey: "Ghimley",
|
lookupKey: "Ghimley",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "someencodeditemID2",
|
name: "someencodeditemID2",
|
||||||
data: mockconnector.GetMockContactBytes("Irgot"),
|
data: exchMock.ContactBytes("Irgot"),
|
||||||
lookupKey: "Irgot",
|
lookupKey: "Irgot",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "someencodeditemID3",
|
name: "someencodeditemID3",
|
||||||
data: mockconnector.GetMockContactBytes("Jannes"),
|
data: exchMock.ContactBytes("Jannes"),
|
||||||
lookupKey: "Jannes",
|
lookupKey: "Jannes",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -871,12 +859,12 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID4",
|
name: "someencodeditemID4",
|
||||||
data: mockconnector.GetMockContactBytes("Argon"),
|
data: exchMock.ContactBytes("Argon"),
|
||||||
lookupKey: "Argon",
|
lookupKey: "Argon",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "someencodeditemID5",
|
name: "someencodeditemID5",
|
||||||
data: mockconnector.GetMockContactBytes("Bernard"),
|
data: exchMock.ContactBytes("Bernard"),
|
||||||
lookupKey: "Bernard",
|
lookupKey: "Bernard",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -893,17 +881,17 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
// items: []itemInfo{
|
// items: []itemInfo{
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID",
|
// name: "someencodeditemID",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Ghimley"),
|
// data: exchMock.EventWithSubjectBytes("Ghimley"),
|
||||||
// lookupKey: "Ghimley",
|
// lookupKey: "Ghimley",
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID2",
|
// name: "someencodeditemID2",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Irgot"),
|
// data: exchMock.EventWithSubjectBytes("Irgot"),
|
||||||
// lookupKey: "Irgot",
|
// lookupKey: "Irgot",
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID3",
|
// name: "someencodeditemID3",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Jannes"),
|
// data: exchMock.EventWithSubjectBytes("Jannes"),
|
||||||
// lookupKey: "Jannes",
|
// lookupKey: "Jannes",
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
@ -920,17 +908,17 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
// items: []itemInfo{
|
// items: []itemInfo{
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID",
|
// name: "someencodeditemID",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Ghimley"),
|
// data: exchMock.EventWithSubjectBytes("Ghimley"),
|
||||||
// lookupKey: "Ghimley",
|
// lookupKey: "Ghimley",
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID2",
|
// name: "someencodeditemID2",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Irgot"),
|
// data: exchMock.EventWithSubjectBytes("Irgot"),
|
||||||
// lookupKey: "Irgot",
|
// lookupKey: "Irgot",
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID3",
|
// name: "someencodeditemID3",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Jannes"),
|
// data: exchMock.EventWithSubjectBytes("Jannes"),
|
||||||
// lookupKey: "Jannes",
|
// lookupKey: "Jannes",
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
@ -941,12 +929,12 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
// items: []itemInfo{
|
// items: []itemInfo{
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID4",
|
// name: "someencodeditemID4",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Argon"),
|
// data: exchMock.EventWithSubjectBytes("Argon"),
|
||||||
// lookupKey: "Argon",
|
// lookupKey: "Argon",
|
||||||
// },
|
// },
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID5",
|
// name: "someencodeditemID5",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Bernard"),
|
// data: exchMock.EventWithSubjectBytes("Bernard"),
|
||||||
// lookupKey: "Bernard",
|
// lookupKey: "Bernard",
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
@ -985,7 +973,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID",
|
name: "someencodeditemID",
|
||||||
data: mockconnector.GetMockContactBytes("Ghimley"),
|
data: exchMock.ContactBytes("Ghimley"),
|
||||||
lookupKey: "Ghimley",
|
lookupKey: "Ghimley",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -996,7 +984,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID2",
|
name: "someencodeditemID2",
|
||||||
data: mockconnector.GetMockContactBytes("Irgot"),
|
data: exchMock.ContactBytes("Irgot"),
|
||||||
lookupKey: "Irgot",
|
lookupKey: "Irgot",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1013,7 +1001,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
|
|||||||
// items: []itemInfo{
|
// items: []itemInfo{
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID",
|
// name: "someencodeditemID",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Ghimley"),
|
// data: exchMock.EventWithSubjectBytes("Ghimley"),
|
||||||
// lookupKey: "Ghimley",
|
// lookupKey: "Ghimley",
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
@ -1024,7 +1012,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
|
|||||||
// items: []itemInfo{
|
// items: []itemInfo{
|
||||||
// {
|
// {
|
||||||
// name: "someencodeditemID2",
|
// name: "someencodeditemID2",
|
||||||
// data: mockconnector.GetMockEventWithSubjectBytes("Irgot"),
|
// data: exchMock.EventWithSubjectBytes("Irgot"),
|
||||||
// lookupKey: "Irgot",
|
// lookupKey: "Irgot",
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
@ -1162,7 +1150,7 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup_largeMailAttac
|
|||||||
items: []itemInfo{
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "35mbAttachment",
|
name: "35mbAttachment",
|
||||||
data: mockconnector.GetMockMessageWithSizedAttachment(subjectText, 35),
|
data: exchMock.MessageWithSizedAttachment(subjectText, 35),
|
||||||
lookupKey: subjectText,
|
lookupKey: subjectText,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package mockconnector
|
package mock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
15
src/internal/connector/mock/id_name_getter.go
Normal file
15
src/internal/connector/mock/id_name_getter.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package mock
|
||||||
|
|
||||||
|
import "context"
|
||||||
|
|
||||||
|
type IDNameGetter struct {
|
||||||
|
ID, Name string
|
||||||
|
Err error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ing IDNameGetter) GetIDAndName(
|
||||||
|
_ context.Context,
|
||||||
|
_ string,
|
||||||
|
) (string, string, error) {
|
||||||
|
return ing.ID, ing.Name, ing.Err
|
||||||
|
}
|
||||||
@ -12,9 +12,9 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
discover "github.com/alcionai/corso/src/internal/connector/discovery/api"
|
discover "github.com/alcionai/corso/src/internal/connector/discovery/api"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/sharepoint"
|
"github.com/alcionai/corso/src/internal/connector/sharepoint"
|
||||||
"github.com/alcionai/corso/src/internal/connector/sharepoint/api"
|
"github.com/alcionai/corso/src/internal/connector/sharepoint/api"
|
||||||
|
spMock "github.com/alcionai/corso/src/internal/connector/sharepoint/mock"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/account"
|
"github.com/alcionai/corso/src/pkg/account"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
@ -86,7 +86,7 @@ func (suite *SharePointPageSuite) TestRestoreSinglePage() {
|
|||||||
|
|
||||||
// Create Test Page
|
// Create Test Page
|
||||||
//nolint:lll
|
//nolint:lll
|
||||||
byteArray := mockconnector.GetMockPage("Byte Test")
|
byteArray := spMock.Page("Byte Test")
|
||||||
|
|
||||||
pageData := sharepoint.NewItem(
|
pageData := sharepoint.NewItem(
|
||||||
testName,
|
testName,
|
||||||
|
|||||||
@ -14,9 +14,9 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||||
"github.com/alcionai/corso/src/internal/connector/sharepoint/api"
|
"github.com/alcionai/corso/src/internal/connector/sharepoint/api"
|
||||||
|
spMock "github.com/alcionai/corso/src/internal/connector/sharepoint/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
@ -97,7 +97,7 @@ func (suite *SharePointCollectionSuite) TestCollection_Items() {
|
|||||||
},
|
},
|
||||||
getItem: func(t *testing.T, name string) *Item {
|
getItem: func(t *testing.T, name string) *Item {
|
||||||
ow := kioser.NewJsonSerializationWriter()
|
ow := kioser.NewJsonSerializationWriter()
|
||||||
listing := mockconnector.GetMockListDefault(name)
|
listing := spMock.ListDefault(name)
|
||||||
listing.SetDisplayName(&name)
|
listing.SetDisplayName(&name)
|
||||||
|
|
||||||
err := ow.WriteObjectValue("", listing)
|
err := ow.WriteObjectValue("", listing)
|
||||||
@ -132,7 +132,7 @@ func (suite *SharePointCollectionSuite) TestCollection_Items() {
|
|||||||
return dir
|
return dir
|
||||||
},
|
},
|
||||||
getItem: func(t *testing.T, itemName string) *Item {
|
getItem: func(t *testing.T, itemName string) *Item {
|
||||||
byteArray := mockconnector.GetMockPage(itemName)
|
byteArray := spMock.Page(itemName)
|
||||||
page, err := support.CreatePageFromBytes(byteArray)
|
page, err := support.CreatePageFromBytes(byteArray)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ func (suite *SharePointCollectionSuite) TestListCollection_Restore() {
|
|||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
service := createTestService(t, suite.creds)
|
service := createTestService(t, suite.creds)
|
||||||
listing := mockconnector.GetMockListDefault("Mock List")
|
listing := spMock.ListDefault("Mock List")
|
||||||
testName := "MockListing"
|
testName := "MockListing"
|
||||||
listing.SetDisplayName(&testName)
|
listing.SetDisplayName(&testName)
|
||||||
byteArray, err := service.Serialize(listing)
|
byteArray, err := service.Serialize(listing)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package mockconnector
|
package mock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@ -17,37 +17,37 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ data.Stream = &MockListData{}
|
_ data.Stream = &ListData{}
|
||||||
_ data.BackupCollection = &MockListCollection{}
|
_ data.BackupCollection = &ListCollection{}
|
||||||
)
|
)
|
||||||
|
|
||||||
type MockListCollection struct {
|
type ListCollection struct {
|
||||||
fullPath path.Path
|
fullPath path.Path
|
||||||
Data []*MockListData
|
Data []*ListData
|
||||||
Names []string
|
Names []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlc *MockListCollection) SetPath(p path.Path) {
|
func (mlc *ListCollection) SetPath(p path.Path) {
|
||||||
mlc.fullPath = p
|
mlc.fullPath = p
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlc *MockListCollection) State() data.CollectionState {
|
func (mlc *ListCollection) State() data.CollectionState {
|
||||||
return data.NewState
|
return data.NewState
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlc *MockListCollection) FullPath() path.Path {
|
func (mlc *ListCollection) FullPath() path.Path {
|
||||||
return mlc.fullPath
|
return mlc.fullPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlc *MockListCollection) DoNotMergeItems() bool {
|
func (mlc *ListCollection) DoNotMergeItems() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlc *MockListCollection) PreviousPath() path.Path {
|
func (mlc *ListCollection) PreviousPath() path.Path {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlc *MockListCollection) Items(
|
func (mlc *ListCollection) Items(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
_ *fault.Bus, // unused
|
_ *fault.Bus, // unused
|
||||||
) <-chan data.Stream {
|
) <-chan data.Stream {
|
||||||
@ -64,7 +64,7 @@ func (mlc *MockListCollection) Items(
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
type MockListData struct {
|
type ListData struct {
|
||||||
ID string
|
ID string
|
||||||
Reader io.ReadCloser
|
Reader io.ReadCloser
|
||||||
ReadErr error
|
ReadErr error
|
||||||
@ -72,25 +72,25 @@ type MockListData struct {
|
|||||||
deleted bool
|
deleted bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mld *MockListData) UUID() string {
|
func (mld *ListData) UUID() string {
|
||||||
return mld.ID
|
return mld.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mld MockListData) Deleted() bool {
|
func (mld ListData) Deleted() bool {
|
||||||
return mld.deleted
|
return mld.deleted
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mld *MockListData) ToReader() io.ReadCloser {
|
func (mld *ListData) ToReader() io.ReadCloser {
|
||||||
return mld.Reader
|
return mld.Reader
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockList returns a Listable object with two columns.
|
// List returns a Listable object with two columns.
|
||||||
// @param: Name of the displayable list
|
// @param: Name of the displayable list
|
||||||
// @param: Column Name: Defines the 2nd Column Name of the created list the values from the map.
|
// @param: Column Name: Defines the 2nd Column Name of the created list the values from the map.
|
||||||
// The key values of the input map are used for the `Title` column.
|
// The key values of the input map are used for the `Title` column.
|
||||||
// The values of the map are placed within the 2nd column.
|
// The values of the map are placed within the 2nd column.
|
||||||
// Source: https://learn.microsoft.com/en-us/graph/api/list-create?view=graph-rest-1.0&tabs=go
|
// Source: https://learn.microsoft.com/en-us/graph/api/list-create?view=graph-rest-1.0&tabs=go
|
||||||
func GetMockList(title, columnName string, items map[string]string) models.Listable {
|
func List(title, columnName string, items map[string]string) models.Listable {
|
||||||
requestBody := models.NewList()
|
requestBody := models.NewList()
|
||||||
requestBody.SetDisplayName(&title)
|
requestBody.SetDisplayName(&title)
|
||||||
requestBody.SetName(&title)
|
requestBody.SetName(&title)
|
||||||
@ -135,15 +135,15 @@ func GetMockList(title, columnName string, items map[string]string) models.Lista
|
|||||||
return requestBody
|
return requestBody
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockListDefault returns a two-list column list of
|
// ListDefault returns a two-list column list of
|
||||||
// Music lbums and the associated artist.
|
// Music lbums and the associated artist.
|
||||||
func GetMockListDefault(title string) models.Listable {
|
func ListDefault(title string) models.Listable {
|
||||||
return GetMockList(title, "Artist", getItems())
|
return List(title, "Artist", getItems())
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockListBytes returns the byte representation of GetMockList
|
// ListBytes returns the byte representation of List
|
||||||
func GetMockListBytes(title string) ([]byte, error) {
|
func ListBytes(title string) ([]byte, error) {
|
||||||
list := GetMockListDefault(title)
|
list := ListDefault(title)
|
||||||
|
|
||||||
objectWriter := kjson.NewJsonSerializationWriter()
|
objectWriter := kjson.NewJsonSerializationWriter()
|
||||||
defer objectWriter.Close()
|
defer objectWriter.Close()
|
||||||
@ -156,13 +156,13 @@ func GetMockListBytes(title string) ([]byte, error) {
|
|||||||
return objectWriter.GetSerializedContent()
|
return objectWriter.GetSerializedContent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMockListStream returns the data.Stream representation
|
// ListStream returns the data.Stream representation
|
||||||
// of the Mocked SharePoint List
|
// of the Mocked SharePoint List
|
||||||
func GetMockListStream(t *testing.T, title string, numOfItems int) *MockListData {
|
func ListStream(t *testing.T, title string, numOfItems int) *ListData {
|
||||||
byteArray, err := GetMockListBytes(title)
|
byteArray, err := ListBytes(title)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
listData := &MockListData{
|
listData := &ListData{
|
||||||
ID: title,
|
ID: title,
|
||||||
Reader: io.NopCloser(bytes.NewReader(byteArray)),
|
Reader: io.NopCloser(bytes.NewReader(byteArray)),
|
||||||
size: int64(len(byteArray)),
|
size: int64(len(byteArray)),
|
||||||
75
src/internal/connector/sharepoint/mock/mock_test.go
Normal file
75
src/internal/connector/sharepoint/mock/mock_test.go
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package mock
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/alcionai/clues"
|
||||||
|
kioser "github.com/microsoft/kiota-serialization-json-go"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MockSuite struct {
|
||||||
|
tester.Suite
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMockSuite(t *testing.T) {
|
||||||
|
suite.Run(t, &MockSuite{Suite: tester.NewUnitSuite(t)})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *MockSuite) TestMockByteHydration() {
|
||||||
|
subject := "Mock Hydration"
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
transformation func(t *testing.T) error
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "SharePoint: List Empty",
|
||||||
|
transformation: func(t *testing.T) error {
|
||||||
|
emptyMap := make(map[string]string)
|
||||||
|
temp := List(subject, "Artist", emptyMap)
|
||||||
|
writer := kioser.NewJsonSerializationWriter()
|
||||||
|
err := writer.WriteObjectValue("", temp)
|
||||||
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
|
bytes, err := writer.GetSerializedContent()
|
||||||
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
|
_, err = support.CreateListFromBytes(bytes)
|
||||||
|
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "SharePoint: List 6 Items",
|
||||||
|
transformation: func(t *testing.T) error {
|
||||||
|
bytes, err := ListBytes(subject)
|
||||||
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
_, err = support.CreateListFromBytes(bytes)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "SharePoint: Page",
|
||||||
|
transformation: func(t *testing.T) error {
|
||||||
|
bytes := Page(subject)
|
||||||
|
_, err := support.CreatePageFromBytes(bytes)
|
||||||
|
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
suite.Run(test.name, func() {
|
||||||
|
t := suite.T()
|
||||||
|
|
||||||
|
err := test.transformation(t)
|
||||||
|
assert.NoError(t, err, clues.ToCore(err))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package mockconnector
|
package mock
|
||||||
|
|
||||||
// GetMockPage returns bytes for models.SitePageable object
|
// Page returns bytes for models.SitePageable object
|
||||||
// Title string changes of fields: name and title
|
// Title string changes of fields: name and title
|
||||||
func GetMockPage(title string) []byte {
|
func Page(title string) []byte {
|
||||||
fileName := title + ".aspx"
|
fileName := title + ".aspx"
|
||||||
|
|
||||||
// Create Test Page
|
// Create Test Page
|
||||||
@ -9,8 +9,9 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
bmodels "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models"
|
bmodels "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
spMock "github.com/alcionai/corso/src/internal/connector/sharepoint/mock"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ func (suite *DataSupportSuite) TestCreateMessageFromBytes() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "aMessage bytes",
|
name: "aMessage bytes",
|
||||||
byteArray: mockconnector.GetMockMessageBytes("m365 mail support test"),
|
byteArray: exchMock.MessageBytes("m365 mail support test"),
|
||||||
checkError: assert.NoError,
|
checkError: assert.NoError,
|
||||||
checkObject: assert.NotNil,
|
checkObject: assert.NotNil,
|
||||||
},
|
},
|
||||||
@ -83,7 +84,7 @@ func (suite *DataSupportSuite) TestCreateContactFromBytes() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Valid Contact",
|
name: "Valid Contact",
|
||||||
byteArray: mockconnector.GetMockContactBytes("Support Test"),
|
byteArray: exchMock.ContactBytes("Support Test"),
|
||||||
checkError: assert.NoError,
|
checkError: assert.NoError,
|
||||||
isNil: assert.NotNil,
|
isNil: assert.NotNil,
|
||||||
},
|
},
|
||||||
@ -120,7 +121,7 @@ func (suite *DataSupportSuite) TestCreateEventFromBytes() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Valid Event",
|
name: "Valid Event",
|
||||||
byteArray: mockconnector.GetDefaultMockEventBytes("Event Test"),
|
byteArray: exchMock.EventBytes("Event Test"),
|
||||||
checkError: assert.NoError,
|
checkError: assert.NoError,
|
||||||
isNil: assert.NotNil,
|
isNil: assert.NotNil,
|
||||||
},
|
},
|
||||||
@ -137,7 +138,7 @@ func (suite *DataSupportSuite) TestCreateEventFromBytes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *DataSupportSuite) TestCreateListFromBytes() {
|
func (suite *DataSupportSuite) TestCreateListFromBytes() {
|
||||||
listBytes, err := mockconnector.GetMockListBytes("DataSupportSuite")
|
listBytes, err := spMock.ListBytes("DataSupportSuite")
|
||||||
require.NoError(suite.T(), err)
|
require.NoError(suite.T(), err)
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ func TestSupportTestSuite(t *testing.T) {
|
|||||||
func (suite *SupportTestSuite) TestToMessage() {
|
func (suite *SupportTestSuite) TestToMessage() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|
||||||
bytes := mockconnector.GetMockMessageBytes("m365 mail support test")
|
bytes := exchMock.MessageBytes("m365 mail support test")
|
||||||
message, err := CreateMessageFromBytes(bytes)
|
message, err := CreateMessageFromBytes(bytes)
|
||||||
require.NoError(suite.T(), err, clues.ToCore(err))
|
require.NoError(suite.T(), err, clues.ToCore(err))
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ func (suite *SupportTestSuite) TestToMessage() {
|
|||||||
|
|
||||||
func (suite *SupportTestSuite) TestToEventSimplified_attendees() {
|
func (suite *SupportTestSuite) TestToEventSimplified_attendees() {
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
bytes := mockconnector.GetMockEventWithAttendeesBytes("M365 Event Support Test")
|
bytes := exchMock.EventWithAttendeesBytes("M365 Event Support Test")
|
||||||
event, err := CreateEventFromBytes(bytes)
|
event, err := CreateEventFromBytes(bytes)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ func (suite *SupportTestSuite) TestToEventSimplified_recurrence() {
|
|||||||
{
|
{
|
||||||
name: "Test recurrence: Unspecified",
|
name: "Test recurrence: Unspecified",
|
||||||
event: func() models.Eventable {
|
event: func() models.Eventable {
|
||||||
bytes := mockconnector.GetMockEventWithSubjectBytes(subject)
|
bytes := exchMock.EventWithSubjectBytes(subject)
|
||||||
e, err := CreateEventFromBytes(bytes)
|
e, err := CreateEventFromBytes(bytes)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
return e
|
return e
|
||||||
@ -84,7 +84,7 @@ func (suite *SupportTestSuite) TestToEventSimplified_recurrence() {
|
|||||||
{
|
{
|
||||||
name: "Test recurrenceTimeZone: Unspecified",
|
name: "Test recurrenceTimeZone: Unspecified",
|
||||||
event: func() models.Eventable {
|
event: func() models.Eventable {
|
||||||
bytes := mockconnector.GetMockEventWithRecurrenceBytes(subject, `null`)
|
bytes := exchMock.EventWithRecurrenceBytes(subject, `null`)
|
||||||
e, err := CreateEventFromBytes(bytes)
|
e, err := CreateEventFromBytes(bytes)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
return e
|
return e
|
||||||
@ -97,7 +97,7 @@ func (suite *SupportTestSuite) TestToEventSimplified_recurrence() {
|
|||||||
{
|
{
|
||||||
name: "Test recurrenceTimeZone: Empty",
|
name: "Test recurrenceTimeZone: Empty",
|
||||||
event: func() models.Eventable {
|
event: func() models.Eventable {
|
||||||
bytes := mockconnector.GetMockEventWithRecurrenceBytes(subject, `""`)
|
bytes := exchMock.EventWithRecurrenceBytes(subject, `""`)
|
||||||
event, err := CreateEventFromBytes(bytes)
|
event, err := CreateEventFromBytes(bytes)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
return event
|
return event
|
||||||
@ -110,7 +110,7 @@ func (suite *SupportTestSuite) TestToEventSimplified_recurrence() {
|
|||||||
{
|
{
|
||||||
name: "Test recurrenceTimeZone: Valid",
|
name: "Test recurrenceTimeZone: Valid",
|
||||||
event: func() models.Eventable {
|
event: func() models.Eventable {
|
||||||
bytes := mockconnector.GetMockEventWithRecurrenceBytes(subject, `"Pacific Standard Time"`)
|
bytes := exchMock.EventWithRecurrenceBytes(subject, `"Pacific Standard Time"`)
|
||||||
event, err := CreateEventFromBytes(bytes)
|
event, err := CreateEventFromBytes(bytes)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
return event
|
return event
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
@ -168,7 +168,7 @@ func (suite *KopiaDataCollectionUnitSuite) TestFetch() {
|
|||||||
|
|
||||||
noErrFileData = "foo bar baz"
|
noErrFileData = "foo bar baz"
|
||||||
|
|
||||||
errReader = &mockconnector.MockExchangeData{
|
errReader = &exchMock.Data{
|
||||||
ReadErr: assert.AnError,
|
ReadErr: assert.AnError,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"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"
|
||||||
@ -717,11 +717,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
collections := []data.BackupCollection{
|
collections := []data.BackupCollection{
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
suite.testStoragePath,
|
suite.testStoragePath,
|
||||||
suite.testLocationPath,
|
suite.testLocationPath,
|
||||||
expectedFileCount[user1Encoded]),
|
expectedFileCount[user1Encoded]),
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
storeP2,
|
storeP2,
|
||||||
locP2,
|
locP2,
|
||||||
expectedFileCount[user2Encoded]),
|
expectedFileCount[user2Encoded]),
|
||||||
@ -800,11 +800,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_MixedDirectory()
|
|||||||
{
|
{
|
||||||
name: "SubdirFirst",
|
name: "SubdirFirst",
|
||||||
layout: []data.BackupCollection{
|
layout: []data.BackupCollection{
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
storeP2,
|
storeP2,
|
||||||
locP2,
|
locP2,
|
||||||
5),
|
5),
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
suite.testStoragePath,
|
suite.testStoragePath,
|
||||||
suite.testLocationPath,
|
suite.testLocationPath,
|
||||||
42),
|
42),
|
||||||
@ -813,11 +813,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_MixedDirectory()
|
|||||||
{
|
{
|
||||||
name: "SubdirLast",
|
name: "SubdirLast",
|
||||||
layout: []data.BackupCollection{
|
layout: []data.BackupCollection{
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
suite.testStoragePath,
|
suite.testStoragePath,
|
||||||
suite.testLocationPath,
|
suite.testLocationPath,
|
||||||
42),
|
42),
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
storeP2,
|
storeP2,
|
||||||
locP2,
|
locP2,
|
||||||
5),
|
5),
|
||||||
@ -908,11 +908,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_Fails() {
|
|||||||
// - Inbox
|
// - Inbox
|
||||||
// - 42 separate files
|
// - 42 separate files
|
||||||
[]data.BackupCollection{
|
[]data.BackupCollection{
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
suite.testStoragePath,
|
suite.testStoragePath,
|
||||||
suite.testLocationPath,
|
suite.testLocationPath,
|
||||||
5),
|
5),
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
storeP2,
|
storeP2,
|
||||||
locP2,
|
locP2,
|
||||||
42),
|
42),
|
||||||
@ -921,7 +921,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_Fails() {
|
|||||||
{
|
{
|
||||||
"NoCollectionPath",
|
"NoCollectionPath",
|
||||||
[]data.BackupCollection{
|
[]data.BackupCollection{
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
5),
|
5),
|
||||||
@ -1047,7 +1047,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeErrors() {
|
|||||||
nowPath = storePath2
|
nowPath = storePath2
|
||||||
}
|
}
|
||||||
|
|
||||||
mc := mockconnector.NewMockExchangeCollection(nowPath, locPath, 0)
|
mc := exchMock.NewCollection(nowPath, locPath, 0)
|
||||||
mc.ColState = s
|
mc.ColState = s
|
||||||
mc.PrevPath = prevPath
|
mc.PrevPath = prevPath
|
||||||
|
|
||||||
@ -1113,7 +1113,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
|||||||
{
|
{
|
||||||
name: "SkipsDeletedItems",
|
name: "SkipsDeletedItems",
|
||||||
inputCollections: func() []data.BackupCollection {
|
inputCollections: func() []data.BackupCollection {
|
||||||
mc := mockconnector.NewMockExchangeCollection(storePath, locPath, 1)
|
mc := exchMock.NewCollection(storePath, locPath, 1)
|
||||||
mc.Names[0] = testFileName
|
mc.Names[0] = testFileName
|
||||||
mc.DeletedItems[0] = true
|
mc.DeletedItems[0] = true
|
||||||
|
|
||||||
@ -1137,7 +1137,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
|||||||
{
|
{
|
||||||
name: "AddsNewItems",
|
name: "AddsNewItems",
|
||||||
inputCollections: func() []data.BackupCollection {
|
inputCollections: func() []data.BackupCollection {
|
||||||
mc := mockconnector.NewMockExchangeCollection(storePath, locPath, 1)
|
mc := exchMock.NewCollection(storePath, locPath, 1)
|
||||||
mc.Names[0] = testFileName2
|
mc.Names[0] = testFileName2
|
||||||
mc.Data[0] = testFileData2
|
mc.Data[0] = testFileData2
|
||||||
mc.ColState = data.NotMovedState
|
mc.ColState = data.NotMovedState
|
||||||
@ -1172,7 +1172,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
|||||||
{
|
{
|
||||||
name: "SkipsUpdatedItems",
|
name: "SkipsUpdatedItems",
|
||||||
inputCollections: func() []data.BackupCollection {
|
inputCollections: func() []data.BackupCollection {
|
||||||
mc := mockconnector.NewMockExchangeCollection(storePath, locPath, 1)
|
mc := exchMock.NewCollection(storePath, locPath, 1)
|
||||||
mc.Names[0] = testFileName
|
mc.Names[0] = testFileName
|
||||||
mc.Data[0] = testFileData2
|
mc.Data[0] = testFileData2
|
||||||
mc.ColState = data.NotMovedState
|
mc.ColState = data.NotMovedState
|
||||||
@ -1203,11 +1203,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
|||||||
{
|
{
|
||||||
name: "DeleteAndNew",
|
name: "DeleteAndNew",
|
||||||
inputCollections: func() []data.BackupCollection {
|
inputCollections: func() []data.BackupCollection {
|
||||||
mc1 := mockconnector.NewMockExchangeCollection(storePath, locPath, 0)
|
mc1 := exchMock.NewCollection(storePath, locPath, 0)
|
||||||
mc1.ColState = data.DeletedState
|
mc1.ColState = data.DeletedState
|
||||||
mc1.PrevPath = storePath
|
mc1.PrevPath = storePath
|
||||||
|
|
||||||
mc2 := mockconnector.NewMockExchangeCollection(storePath, locPath, 1)
|
mc2 := exchMock.NewCollection(storePath, locPath, 1)
|
||||||
mc2.ColState = data.NewState
|
mc2.ColState = data.NewState
|
||||||
mc2.Names[0] = testFileName2
|
mc2.Names[0] = testFileName2
|
||||||
mc2.Data[0] = testFileData2
|
mc2.Data[0] = testFileData2
|
||||||
@ -1238,11 +1238,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
|||||||
{
|
{
|
||||||
name: "MovedAndNew",
|
name: "MovedAndNew",
|
||||||
inputCollections: func() []data.BackupCollection {
|
inputCollections: func() []data.BackupCollection {
|
||||||
mc1 := mockconnector.NewMockExchangeCollection(storePath2, locPath2, 0)
|
mc1 := exchMock.NewCollection(storePath2, locPath2, 0)
|
||||||
mc1.ColState = data.MovedState
|
mc1.ColState = data.MovedState
|
||||||
mc1.PrevPath = storePath
|
mc1.PrevPath = storePath
|
||||||
|
|
||||||
mc2 := mockconnector.NewMockExchangeCollection(storePath, locPath, 1)
|
mc2 := exchMock.NewCollection(storePath, locPath, 1)
|
||||||
mc2.ColState = data.NewState
|
mc2.ColState = data.NewState
|
||||||
mc2.Names[0] = testFileName2
|
mc2.Names[0] = testFileName2
|
||||||
mc2.Data[0] = testFileData2
|
mc2.Data[0] = testFileData2
|
||||||
@ -1282,7 +1282,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
|||||||
{
|
{
|
||||||
name: "NewDoesntMerge",
|
name: "NewDoesntMerge",
|
||||||
inputCollections: func() []data.BackupCollection {
|
inputCollections: func() []data.BackupCollection {
|
||||||
mc1 := mockconnector.NewMockExchangeCollection(storePath, locPath, 1)
|
mc1 := exchMock.NewCollection(storePath, locPath, 1)
|
||||||
mc1.ColState = data.NewState
|
mc1.ColState = data.NewState
|
||||||
mc1.Names[0] = testFileName2
|
mc1.Names[0] = testFileName2
|
||||||
mc1.Data[0] = testFileData2
|
mc1.Data[0] = testFileData2
|
||||||
@ -1517,7 +1517,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
[]string{testTenant, service, testUser, category, testInboxDir + "2"},
|
[]string{testTenant, service, testUser, category, testInboxDir + "2"},
|
||||||
false)
|
false)
|
||||||
|
|
||||||
mc := mockconnector.NewMockExchangeCollection(newStorePath, newLocPath, 0)
|
mc := exchMock.NewCollection(newStorePath, newLocPath, 0)
|
||||||
mc.PrevPath = inboxStorePath
|
mc.PrevPath = inboxStorePath
|
||||||
mc.ColState = data.MovedState
|
mc.ColState = data.MovedState
|
||||||
|
|
||||||
@ -1585,11 +1585,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
[]string{testTenant, service, testUser, category, workID},
|
[]string{testTenant, service, testUser, category, workID},
|
||||||
false)
|
false)
|
||||||
|
|
||||||
inbox := mockconnector.NewMockExchangeCollection(newInboxStorePath, newInboxLocPath, 0)
|
inbox := exchMock.NewCollection(newInboxStorePath, newInboxLocPath, 0)
|
||||||
inbox.PrevPath = inboxStorePath
|
inbox.PrevPath = inboxStorePath
|
||||||
inbox.ColState = data.MovedState
|
inbox.ColState = data.MovedState
|
||||||
|
|
||||||
work := mockconnector.NewMockExchangeCollection(newWorkStorePath, newWorkLocPath, 0)
|
work := exchMock.NewCollection(newWorkStorePath, newWorkLocPath, 0)
|
||||||
work.PrevPath = workStorePath
|
work.PrevPath = workStorePath
|
||||||
work.ColState = data.MovedState
|
work.ColState = data.MovedState
|
||||||
|
|
||||||
@ -1649,11 +1649,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
[]string{testTenant, service, testUser, category, workDir},
|
[]string{testTenant, service, testUser, category, workDir},
|
||||||
false)
|
false)
|
||||||
|
|
||||||
inbox := mockconnector.NewMockExchangeCollection(inboxStorePath, inboxLocPath, 0)
|
inbox := exchMock.NewCollection(inboxStorePath, inboxLocPath, 0)
|
||||||
inbox.PrevPath = inboxStorePath
|
inbox.PrevPath = inboxStorePath
|
||||||
inbox.ColState = data.DeletedState
|
inbox.ColState = data.DeletedState
|
||||||
|
|
||||||
work := mockconnector.NewMockExchangeCollection(newWorkStorePath, newWorkLocPath, 0)
|
work := exchMock.NewCollection(newWorkStorePath, newWorkLocPath, 0)
|
||||||
work.PrevPath = workStorePath
|
work.PrevPath = workStorePath
|
||||||
work.ColState = data.MovedState
|
work.ColState = data.MovedState
|
||||||
|
|
||||||
@ -1682,11 +1682,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
{
|
{
|
||||||
name: "ReplaceDeletedDirectory",
|
name: "ReplaceDeletedDirectory",
|
||||||
inputCollections: func(t *testing.T) []data.BackupCollection {
|
inputCollections: func(t *testing.T) []data.BackupCollection {
|
||||||
personal := mockconnector.NewMockExchangeCollection(personalStorePath, personalLocPath, 0)
|
personal := exchMock.NewCollection(personalStorePath, personalLocPath, 0)
|
||||||
personal.PrevPath = personalStorePath
|
personal.PrevPath = personalStorePath
|
||||||
personal.ColState = data.DeletedState
|
personal.ColState = data.DeletedState
|
||||||
|
|
||||||
work := mockconnector.NewMockExchangeCollection(personalStorePath, personalLocPath, 0)
|
work := exchMock.NewCollection(personalStorePath, personalLocPath, 0)
|
||||||
work.PrevPath = workStorePath
|
work.PrevPath = workStorePath
|
||||||
work.ColState = data.MovedState
|
work.ColState = data.MovedState
|
||||||
|
|
||||||
@ -1723,11 +1723,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
{
|
{
|
||||||
name: "ReplaceDeletedDirectoryWithNew",
|
name: "ReplaceDeletedDirectoryWithNew",
|
||||||
inputCollections: func(t *testing.T) []data.BackupCollection {
|
inputCollections: func(t *testing.T) []data.BackupCollection {
|
||||||
personal := mockconnector.NewMockExchangeCollection(personalStorePath, personalLocPath, 0)
|
personal := exchMock.NewCollection(personalStorePath, personalLocPath, 0)
|
||||||
personal.PrevPath = personalStorePath
|
personal.PrevPath = personalStorePath
|
||||||
personal.ColState = data.DeletedState
|
personal.ColState = data.DeletedState
|
||||||
|
|
||||||
newCol := mockconnector.NewMockExchangeCollection(personalStorePath, personalLocPath, 1)
|
newCol := exchMock.NewCollection(personalStorePath, personalLocPath, 1)
|
||||||
newCol.ColState = data.NewState
|
newCol.ColState = data.NewState
|
||||||
newCol.Names[0] = workFileName2
|
newCol.Names[0] = workFileName2
|
||||||
newCol.Data[0] = workFileData2
|
newCol.Data[0] = workFileData2
|
||||||
@ -1774,11 +1774,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
{
|
{
|
||||||
name: "ReplaceDeletedSubtreeWithNew",
|
name: "ReplaceDeletedSubtreeWithNew",
|
||||||
inputCollections: func(t *testing.T) []data.BackupCollection {
|
inputCollections: func(t *testing.T) []data.BackupCollection {
|
||||||
oldInbox := mockconnector.NewMockExchangeCollection(inboxStorePath, inboxLocPath, 0)
|
oldInbox := exchMock.NewCollection(inboxStorePath, inboxLocPath, 0)
|
||||||
oldInbox.PrevPath = inboxStorePath
|
oldInbox.PrevPath = inboxStorePath
|
||||||
oldInbox.ColState = data.DeletedState
|
oldInbox.ColState = data.DeletedState
|
||||||
|
|
||||||
newCol := mockconnector.NewMockExchangeCollection(inboxStorePath, inboxLocPath, 1)
|
newCol := exchMock.NewCollection(inboxStorePath, inboxLocPath, 1)
|
||||||
newCol.ColState = data.NewState
|
newCol.ColState = data.NewState
|
||||||
newCol.Names[0] = workFileName2
|
newCol.Names[0] = workFileName2
|
||||||
newCol.Data[0] = workFileData2
|
newCol.Data[0] = workFileData2
|
||||||
@ -1817,11 +1817,11 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
[]string{testTenant, service, testUser, category, personalDir},
|
[]string{testTenant, service, testUser, category, personalDir},
|
||||||
false)
|
false)
|
||||||
|
|
||||||
personal := mockconnector.NewMockExchangeCollection(newPersonalStorePath, newPersonalLocPath, 0)
|
personal := exchMock.NewCollection(newPersonalStorePath, newPersonalLocPath, 0)
|
||||||
personal.PrevPath = personalStorePath
|
personal.PrevPath = personalStorePath
|
||||||
personal.ColState = data.MovedState
|
personal.ColState = data.MovedState
|
||||||
|
|
||||||
work := mockconnector.NewMockExchangeCollection(personalStorePath, personalLocPath, 0)
|
work := exchMock.NewCollection(personalStorePath, personalLocPath, 0)
|
||||||
work.PrevPath = workStorePath
|
work.PrevPath = workStorePath
|
||||||
work.ColState = data.MovedState
|
work.ColState = data.MovedState
|
||||||
|
|
||||||
@ -1878,7 +1878,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
[]string{testTenant, service, testUser, category, workDir},
|
[]string{testTenant, service, testUser, category, workDir},
|
||||||
false)
|
false)
|
||||||
|
|
||||||
personal := mockconnector.NewMockExchangeCollection(newPersonalStorePath, newPersonalLocPath, 2)
|
personal := exchMock.NewCollection(newPersonalStorePath, newPersonalLocPath, 2)
|
||||||
personal.PrevPath = personalStorePath
|
personal.PrevPath = personalStorePath
|
||||||
personal.ColState = data.MovedState
|
personal.ColState = data.MovedState
|
||||||
personal.Names[0] = personalFileName2
|
personal.Names[0] = personalFileName2
|
||||||
@ -1957,7 +1957,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
[]string{testTenant, service, testUser, category, personalDir, workDir},
|
[]string{testTenant, service, testUser, category, personalDir, workDir},
|
||||||
false)
|
false)
|
||||||
|
|
||||||
inbox := mockconnector.NewMockExchangeCollection(newInboxStorePath, newInboxLocPath, 1)
|
inbox := exchMock.NewCollection(newInboxStorePath, newInboxLocPath, 1)
|
||||||
inbox.PrevPath = inboxStorePath
|
inbox.PrevPath = inboxStorePath
|
||||||
inbox.ColState = data.MovedState
|
inbox.ColState = data.MovedState
|
||||||
inbox.DoNotMerge = true
|
inbox.DoNotMerge = true
|
||||||
@ -1966,7 +1966,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
inbox.Names[0] = inboxFileName2
|
inbox.Names[0] = inboxFileName2
|
||||||
inbox.Data[0] = inboxFileData2
|
inbox.Data[0] = inboxFileData2
|
||||||
|
|
||||||
work := mockconnector.NewMockExchangeCollection(newWorkStorePath, newWorkLocPath, 1)
|
work := exchMock.NewCollection(newWorkStorePath, newWorkLocPath, 1)
|
||||||
work.PrevPath = workStorePath
|
work.PrevPath = workStorePath
|
||||||
work.ColState = data.MovedState
|
work.ColState = data.MovedState
|
||||||
work.Names[0] = testFileName6
|
work.Names[0] = testFileName6
|
||||||
@ -2025,7 +2025,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
{
|
{
|
||||||
name: "NoMoveParentDeleteFileNoMergeSubtreeMerge",
|
name: "NoMoveParentDeleteFileNoMergeSubtreeMerge",
|
||||||
inputCollections: func(t *testing.T) []data.BackupCollection {
|
inputCollections: func(t *testing.T) []data.BackupCollection {
|
||||||
inbox := mockconnector.NewMockExchangeCollection(inboxStorePath, inboxLocPath, 1)
|
inbox := exchMock.NewCollection(inboxStorePath, inboxLocPath, 1)
|
||||||
inbox.PrevPath = inboxStorePath
|
inbox.PrevPath = inboxStorePath
|
||||||
inbox.ColState = data.NotMovedState
|
inbox.ColState = data.NotMovedState
|
||||||
inbox.DoNotMerge = true
|
inbox.DoNotMerge = true
|
||||||
@ -2034,7 +2034,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto
|
|||||||
inbox.Names[0] = inboxFileName2
|
inbox.Names[0] = inboxFileName2
|
||||||
inbox.Data[0] = inboxFileData2
|
inbox.Data[0] = inboxFileData2
|
||||||
|
|
||||||
work := mockconnector.NewMockExchangeCollection(workStorePath, workLocPath, 1)
|
work := exchMock.NewCollection(workStorePath, workLocPath, 1)
|
||||||
work.PrevPath = workStorePath
|
work.PrevPath = workStorePath
|
||||||
work.ColState = data.NotMovedState
|
work.ColState = data.NotMovedState
|
||||||
work.Names[0] = testFileName6
|
work.Names[0] = testFileName6
|
||||||
@ -2255,7 +2255,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSkipsDeletedSubtre
|
|||||||
toMerge: newMergeDetails(),
|
toMerge: newMergeDetails(),
|
||||||
errs: fault.New(true),
|
errs: fault.New(true),
|
||||||
}
|
}
|
||||||
mc := mockconnector.NewMockExchangeCollection(suite.testStoragePath, suite.testStoragePath, 1)
|
mc := exchMock.NewCollection(suite.testStoragePath, suite.testStoragePath, 1)
|
||||||
mc.PrevPath = mc.FullPath()
|
mc.PrevPath = mc.FullPath()
|
||||||
mc.ColState = data.DeletedState
|
mc.ColState = data.DeletedState
|
||||||
msw := &mockSnapshotWalker{
|
msw := &mockSnapshotWalker{
|
||||||
@ -2357,7 +2357,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_HandleEmptyBase()
|
|||||||
toMerge: newMergeDetails(),
|
toMerge: newMergeDetails(),
|
||||||
errs: fault.New(true),
|
errs: fault.New(true),
|
||||||
}
|
}
|
||||||
mc := mockconnector.NewMockExchangeCollection(archiveStorePath, archiveLocPath, 1)
|
mc := exchMock.NewCollection(archiveStorePath, archiveLocPath, 1)
|
||||||
mc.ColState = data.NewState
|
mc.ColState = data.NewState
|
||||||
mc.Names[0] = testFileName2
|
mc.Names[0] = testFileName2
|
||||||
mc.Data[0] = testFileData2
|
mc.Data[0] = testFileData2
|
||||||
@ -2614,7 +2614,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSelectsCorrectSubt
|
|||||||
errs: fault.New(true),
|
errs: fault.New(true),
|
||||||
}
|
}
|
||||||
|
|
||||||
mc := mockconnector.NewMockExchangeCollection(inboxPath, inboxPath, 1)
|
mc := exchMock.NewCollection(inboxPath, inboxPath, 1)
|
||||||
mc.PrevPath = mc.FullPath()
|
mc.PrevPath = mc.FullPath()
|
||||||
mc.ColState = data.NotMovedState
|
mc.ColState = data.NotMovedState
|
||||||
mc.Names[0] = inboxFileName2
|
mc.Names[0] = inboxFileName2
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
@ -209,11 +209,11 @@ func (suite *KopiaIntegrationSuite) TearDownTest() {
|
|||||||
|
|
||||||
func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
func (suite *KopiaIntegrationSuite) TestBackupCollections() {
|
||||||
collections := []data.BackupCollection{
|
collections := []data.BackupCollection{
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
suite.storePath1,
|
suite.storePath1,
|
||||||
suite.locPath1,
|
suite.locPath1,
|
||||||
5),
|
5),
|
||||||
mockconnector.NewMockExchangeCollection(
|
exchMock.NewCollection(
|
||||||
suite.storePath2,
|
suite.storePath2,
|
||||||
suite.locPath2,
|
suite.locPath2,
|
||||||
42),
|
42),
|
||||||
@ -385,7 +385,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_NoDetailsForMeta() {
|
|||||||
numDeetsEntries: 3,
|
numDeetsEntries: 3,
|
||||||
hasMetaDeets: true,
|
hasMetaDeets: true,
|
||||||
cols: func() []data.BackupCollection {
|
cols: func() []data.BackupCollection {
|
||||||
mc := mockconnector.NewMockExchangeCollection(
|
mc := exchMock.NewCollection(
|
||||||
storePath,
|
storePath,
|
||||||
locPath,
|
locPath,
|
||||||
3)
|
3)
|
||||||
@ -404,7 +404,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_NoDetailsForMeta() {
|
|||||||
numDeetsEntries: 1,
|
numDeetsEntries: 1,
|
||||||
hasMetaDeets: false,
|
hasMetaDeets: false,
|
||||||
cols: func() []data.BackupCollection {
|
cols: func() []data.BackupCollection {
|
||||||
mc := mockconnector.NewMockExchangeCollection(
|
mc := exchMock.NewCollection(
|
||||||
storePath,
|
storePath,
|
||||||
locPath,
|
locPath,
|
||||||
1)
|
1)
|
||||||
@ -512,8 +512,8 @@ func (suite *KopiaIntegrationSuite) TestRestoreAfterCompressionChange() {
|
|||||||
tags[k] = ""
|
tags[k] = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
dc1 := mockconnector.NewMockExchangeCollection(suite.storePath1, suite.locPath1, 1)
|
dc1 := exchMock.NewCollection(suite.storePath1, suite.locPath1, 1)
|
||||||
dc2 := mockconnector.NewMockExchangeCollection(suite.storePath2, suite.locPath2, 1)
|
dc2 := exchMock.NewCollection(suite.storePath2, suite.locPath2, 1)
|
||||||
|
|
||||||
fp1, err := suite.storePath1.Append(dc1.Names[0], true)
|
fp1, err := suite.storePath1.Append(dc1.Names[0], true)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
@ -607,11 +607,11 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_ReaderError() {
|
|||||||
&mockBackupCollection{
|
&mockBackupCollection{
|
||||||
path: suite.storePath1,
|
path: suite.storePath1,
|
||||||
streams: []data.Stream{
|
streams: []data.Stream{
|
||||||
&mockconnector.MockExchangeData{
|
&exchMock.Data{
|
||||||
ID: testFileName,
|
ID: testFileName,
|
||||||
Reader: io.NopCloser(bytes.NewReader(testFileData)),
|
Reader: io.NopCloser(bytes.NewReader(testFileData)),
|
||||||
},
|
},
|
||||||
&mockconnector.MockExchangeData{
|
&exchMock.Data{
|
||||||
ID: testFileName2,
|
ID: testFileName2,
|
||||||
Reader: io.NopCloser(bytes.NewReader(testFileData2)),
|
Reader: io.NopCloser(bytes.NewReader(testFileData2)),
|
||||||
},
|
},
|
||||||
@ -620,19 +620,19 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_ReaderError() {
|
|||||||
&mockBackupCollection{
|
&mockBackupCollection{
|
||||||
path: suite.storePath2,
|
path: suite.storePath2,
|
||||||
streams: []data.Stream{
|
streams: []data.Stream{
|
||||||
&mockconnector.MockExchangeData{
|
&exchMock.Data{
|
||||||
ID: testFileName3,
|
ID: testFileName3,
|
||||||
Reader: io.NopCloser(bytes.NewReader(testFileData3)),
|
Reader: io.NopCloser(bytes.NewReader(testFileData3)),
|
||||||
},
|
},
|
||||||
&mockconnector.MockExchangeData{
|
&exchMock.Data{
|
||||||
ID: testFileName4,
|
ID: testFileName4,
|
||||||
ReadErr: assert.AnError,
|
ReadErr: assert.AnError,
|
||||||
},
|
},
|
||||||
&mockconnector.MockExchangeData{
|
&exchMock.Data{
|
||||||
ID: testFileName5,
|
ID: testFileName5,
|
||||||
Reader: io.NopCloser(bytes.NewReader(testFileData5)),
|
Reader: io.NopCloser(bytes.NewReader(testFileData5)),
|
||||||
},
|
},
|
||||||
&mockconnector.MockExchangeData{
|
&exchMock.Data{
|
||||||
ID: testFileName6,
|
ID: testFileName6,
|
||||||
Reader: io.NopCloser(bytes.NewReader(testFileData6)),
|
Reader: io.NopCloser(bytes.NewReader(testFileData6)),
|
||||||
},
|
},
|
||||||
@ -841,7 +841,7 @@ func (suite *KopiaSimpleRepoIntegrationSuite) SetupTest() {
|
|||||||
for _, item := range suite.files[parent.String()] {
|
for _, item := range suite.files[parent.String()] {
|
||||||
collection.streams = append(
|
collection.streams = append(
|
||||||
collection.streams,
|
collection.streams,
|
||||||
&mockconnector.MockExchangeData{
|
&exchMock.Data{
|
||||||
ID: item.itemPath.Item(),
|
ID: item.itemPath.Item(),
|
||||||
Reader: io.NopCloser(bytes.NewReader(item.data)),
|
Reader: io.NopCloser(bytes.NewReader(item.data)),
|
||||||
},
|
},
|
||||||
@ -978,7 +978,7 @@ func (suite *KopiaSimpleRepoIntegrationSuite) TestBackupExcludeItem() {
|
|||||||
expectedCachedItems: len(suite.filesByPath),
|
expectedCachedItems: len(suite.filesByPath),
|
||||||
expectedUncachedItems: 1,
|
expectedUncachedItems: 1,
|
||||||
cols: func() []data.BackupCollection {
|
cols: func() []data.BackupCollection {
|
||||||
c := mockconnector.NewMockExchangeCollection(
|
c := exchMock.NewCollection(
|
||||||
suite.testPath1,
|
suite.testPath1,
|
||||||
suite.testPath1,
|
suite.testPath1,
|
||||||
1)
|
1)
|
||||||
|
|||||||
@ -21,8 +21,9 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/connector"
|
"github.com/alcionai/corso/src/internal/connector"
|
||||||
"github.com/alcionai/corso/src/internal/connector/exchange"
|
"github.com/alcionai/corso/src/internal/connector/exchange"
|
||||||
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
"github.com/alcionai/corso/src/internal/connector/exchange/api"
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
"github.com/alcionai/corso/src/internal/connector/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
@ -457,7 +458,7 @@ func buildCollections(
|
|||||||
c.pathFolders,
|
c.pathFolders,
|
||||||
false)
|
false)
|
||||||
|
|
||||||
mc := mockconnector.NewMockExchangeCollection(pth, pth, len(c.items))
|
mc := exchMock.NewCollection(pth, pth, len(c.items))
|
||||||
|
|
||||||
for i := 0; i < len(c.items); i++ {
|
for i := 0; i < len(c.items); i++ {
|
||||||
mc.Names[i] = c.items[i].name
|
mc.Names[i] = c.items[i].name
|
||||||
@ -548,7 +549,7 @@ func (suite *BackupOpIntegrationSuite) SetupSuite() {
|
|||||||
func (suite *BackupOpIntegrationSuite) TestNewBackupOperation() {
|
func (suite *BackupOpIntegrationSuite) TestNewBackupOperation() {
|
||||||
kw := &kopia.Wrapper{}
|
kw := &kopia.Wrapper{}
|
||||||
sw := &store.Wrapper{}
|
sw := &store.Wrapper{}
|
||||||
gc := &mockconnector.GraphConnector{}
|
gc := &mock.GraphConnector{}
|
||||||
acct := tester.NewM365Account(suite.T())
|
acct := tester.NewM365Account(suite.T())
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
@ -770,7 +771,7 @@ func (suite *BackupOpIntegrationSuite) TestBackup_Run_exchangeIncrementals() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mailDBF := func(id, timeStamp, subject, body string) []byte {
|
mailDBF := func(id, timeStamp, subject, body string) []byte {
|
||||||
return mockconnector.GetMockMessageWith(
|
return exchMock.MessageWith(
|
||||||
suite.user, suite.user, suite.user,
|
suite.user, suite.user, suite.user,
|
||||||
subject, body, body,
|
subject, body, body,
|
||||||
now, now, now, now)
|
now, now, now, now)
|
||||||
@ -779,7 +780,7 @@ func (suite *BackupOpIntegrationSuite) TestBackup_Run_exchangeIncrementals() {
|
|||||||
contactDBF := func(id, timeStamp, subject, body string) []byte {
|
contactDBF := func(id, timeStamp, subject, body string) []byte {
|
||||||
given, mid, sur := id[:8], id[9:13], id[len(id)-12:]
|
given, mid, sur := id[:8], id[9:13], id[len(id)-12:]
|
||||||
|
|
||||||
return mockconnector.GetMockContactBytesWith(
|
return exchMock.ContactBytesWith(
|
||||||
given+" "+sur,
|
given+" "+sur,
|
||||||
sur+", "+given,
|
sur+", "+given,
|
||||||
given, mid, sur,
|
given, mid, sur,
|
||||||
@ -788,9 +789,9 @@ func (suite *BackupOpIntegrationSuite) TestBackup_Run_exchangeIncrementals() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eventDBF := func(id, timeStamp, subject, body string) []byte {
|
eventDBF := func(id, timeStamp, subject, body string) []byte {
|
||||||
return mockconnector.GetMockEventWith(
|
return exchMock.EventWith(
|
||||||
suite.user, subject, body, body,
|
suite.user, subject, body, body,
|
||||||
now, now, mockconnector.NoRecurrence, mockconnector.NoAttendees, false)
|
now, now, exchMock.NoRecurrence, exchMock.NoAttendees, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// test data set
|
// test data set
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
"github.com/alcionai/corso/src/internal/connector/mock"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
evmock "github.com/alcionai/corso/src/internal/events/mock"
|
evmock "github.com/alcionai/corso/src/internal/events/mock"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
"github.com/alcionai/corso/src/internal/kopia"
|
||||||
@ -397,7 +397,7 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_PersistResults() {
|
|||||||
var (
|
var (
|
||||||
kw = &kopia.Wrapper{}
|
kw = &kopia.Wrapper{}
|
||||||
sw = &store.Wrapper{}
|
sw = &store.Wrapper{}
|
||||||
gc = &mockconnector.GraphConnector{}
|
gc = &mock.GraphConnector{}
|
||||||
acct = account.Account{}
|
acct = account.Account{}
|
||||||
now = time.Now()
|
now = time.Now()
|
||||||
)
|
)
|
||||||
|
|||||||
@ -13,8 +13,9 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
"github.com/alcionai/corso/src/internal/connector"
|
"github.com/alcionai/corso/src/internal/connector"
|
||||||
"github.com/alcionai/corso/src/internal/connector/exchange"
|
"github.com/alcionai/corso/src/internal/connector/exchange"
|
||||||
|
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mockconnector"
|
"github.com/alcionai/corso/src/internal/connector/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
"github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
"github.com/alcionai/corso/src/internal/events"
|
"github.com/alcionai/corso/src/internal/events"
|
||||||
@ -50,7 +51,7 @@ func (suite *RestoreOpSuite) TestRestoreOperation_PersistResults() {
|
|||||||
var (
|
var (
|
||||||
kw = &kopia.Wrapper{}
|
kw = &kopia.Wrapper{}
|
||||||
sw = &store.Wrapper{}
|
sw = &store.Wrapper{}
|
||||||
gc = &mockconnector.GraphConnector{}
|
gc = &mock.GraphConnector{}
|
||||||
acct = account.Account{}
|
acct = account.Account{}
|
||||||
now = time.Now()
|
now = time.Now()
|
||||||
dest = tester.DefaultTestRestoreDestination()
|
dest = tester.DefaultTestRestoreDestination()
|
||||||
@ -72,7 +73,7 @@ func (suite *RestoreOpSuite) TestRestoreOperation_PersistResults() {
|
|||||||
},
|
},
|
||||||
cs: []data.RestoreCollection{
|
cs: []data.RestoreCollection{
|
||||||
data.NotFoundRestoreCollection{
|
data.NotFoundRestoreCollection{
|
||||||
Collection: &mockconnector.MockExchangeDataCollection{},
|
Collection: &exchMock.DataCollection{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
gc: &data.CollectionStats{
|
gc: &data.CollectionStats{
|
||||||
@ -215,7 +216,7 @@ func (suite *RestoreOpIntegrationSuite) TearDownSuite() {
|
|||||||
func (suite *RestoreOpIntegrationSuite) TestNewRestoreOperation() {
|
func (suite *RestoreOpIntegrationSuite) TestNewRestoreOperation() {
|
||||||
kw := &kopia.Wrapper{}
|
kw := &kopia.Wrapper{}
|
||||||
sw := &store.Wrapper{}
|
sw := &store.Wrapper{}
|
||||||
gc := &mockconnector.GraphConnector{}
|
gc := &mock.GraphConnector{}
|
||||||
acct := tester.NewM365Account(suite.T())
|
acct := tester.NewM365Account(suite.T())
|
||||||
dest := tester.DefaultTestRestoreDestination()
|
dest := tester.DefaultTestRestoreDestination()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user