Compare commits
1 Commits
main
...
reference_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8840116380 |
@ -55,7 +55,7 @@ func uploadAttachment(ctx context.Context, service graph.Service, userID, folder
|
|||||||
Attachments().
|
Attachments().
|
||||||
Post(ctx, attachment, nil)
|
Post(ctx, attachment, nil)
|
||||||
|
|
||||||
return err
|
return errors.Wrapf(err, "failed to post attachment: "+support.ConnectorStackErrorTrace(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
return uploadLargeAttachment(ctx, service, userID, folderID, messageID, attachment)
|
return uploadLargeAttachment(ctx, service, userID, folderID, messageID, attachment)
|
||||||
|
|||||||
@ -397,85 +397,98 @@ func (suite *ExchangeServiceSuite) TestRestoreExchangeObject() {
|
|||||||
cleanupFunc func(context.Context, graph.Service, string, string) error
|
cleanupFunc func(context.Context, graph.Service, string, string) error
|
||||||
destination func(context.Context) string
|
destination func(context.Context) string
|
||||||
}{
|
}{
|
||||||
|
// {
|
||||||
|
// name: "Test Mail",
|
||||||
|
// bytes: mockconnector.GetMockMessageBytes("Restore Exchange Object"),
|
||||||
|
// category: path.EmailCategory,
|
||||||
|
// cleanupFunc: DeleteMailFolder,
|
||||||
|
// destination: func(ctx context.Context) string {
|
||||||
|
// folderName := "TestRestoreMailObject: " + common.FormatSimpleDateTime(now)
|
||||||
|
// folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
||||||
|
// require.NoError(t, err)
|
||||||
|
|
||||||
|
// return *folder.GetId()
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: "Test Mail: One Direct Attachment",
|
||||||
|
// bytes: mockconnector.GetMockMessageWithDirectAttachment("Restore 1 Attachment"),
|
||||||
|
// category: path.EmailCategory,
|
||||||
|
// cleanupFunc: DeleteMailFolder,
|
||||||
|
// destination: func(ctx context.Context) string {
|
||||||
|
// folderName := "TestRestoreMailwithAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
|
// folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
||||||
|
// require.NoError(t, err)
|
||||||
|
|
||||||
|
// return *folder.GetId()
|
||||||
|
// },
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
name: "Test Mail",
|
name: "Test Mail: One Reference Attachment",
|
||||||
bytes: mockconnector.GetMockMessageBytes("Restore Exchange Object"),
|
bytes: mockconnector.GetMessageWithOneDriveAttachment("Restore 1 Attachment"),
|
||||||
category: path.EmailCategory,
|
category: path.EmailCategory,
|
||||||
cleanupFunc: DeleteMailFolder,
|
cleanupFunc: DeleteMailFolder,
|
||||||
destination: func(ctx context.Context) string {
|
destination: func(ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailObject: " + common.FormatSimpleDateTime(now)
|
folderName := "TestRestoreMailwithReferenceAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
return *folder.GetId()
|
return *folder.GetId()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: "Test Mail: One Direct Attachment",
|
// name: "Test Mail: One Large Attachment",
|
||||||
bytes: mockconnector.GetMockMessageWithDirectAttachment("Restore 1 Attachment"),
|
// bytes: mockconnector.GetMockMessageWithLargeAttachment("Restore Large Attachment"),
|
||||||
category: path.EmailCategory,
|
// category: path.EmailCategory,
|
||||||
cleanupFunc: DeleteMailFolder,
|
// cleanupFunc: DeleteMailFolder,
|
||||||
destination: func(ctx context.Context) string {
|
// destination: func(ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailwithAttachment: " + common.FormatSimpleDateTime(now)
|
// folderName := "TestRestoreMailwithLargeAttachment: " + common.FormatSimpleDateTime(now)
|
||||||
folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
// folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
||||||
require.NoError(t, err)
|
// require.NoError(t, err)
|
||||||
|
|
||||||
return *folder.GetId()
|
// return *folder.GetId()
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: "Test Mail: One Large Attachment",
|
// name: "Test Mail: Two Attachments",
|
||||||
bytes: mockconnector.GetMockMessageWithLargeAttachment("Restore Large Attachment"),
|
// bytes: mockconnector.GetMockMessageWithTwoAttachments("Restore 2 Attachments"),
|
||||||
category: path.EmailCategory,
|
// category: path.EmailCategory,
|
||||||
cleanupFunc: DeleteMailFolder,
|
// cleanupFunc: DeleteMailFolder,
|
||||||
destination: func(ctx context.Context) string {
|
// destination: func(ctx context.Context) string {
|
||||||
folderName := "TestRestoreMailwithLargeAttachment: " + common.FormatSimpleDateTime(now)
|
// folderName := "TestRestoreMailwithAttachments: " + common.FormatSimpleDateTime(now)
|
||||||
folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
// folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
||||||
require.NoError(t, err)
|
// require.NoError(t, err)
|
||||||
|
|
||||||
return *folder.GetId()
|
// return *folder.GetId()
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// // TODO: #884 - reinstate when able to specify root folder by name
|
||||||
name: "Test Mail: Two Attachments",
|
// {
|
||||||
bytes: mockconnector.GetMockMessageWithTwoAttachments("Restore 2 Attachments"),
|
// name: "Test Contact",
|
||||||
category: path.EmailCategory,
|
// bytes: mockconnector.GetMockContactBytes("Test_Omega"),
|
||||||
cleanupFunc: DeleteMailFolder,
|
// category: path.ContactsCategory,
|
||||||
destination: func(ctx context.Context) string {
|
// cleanupFunc: DeleteContactFolder,
|
||||||
folderName := "TestRestoreMailwithAttachments: " + common.FormatSimpleDateTime(now)
|
// destination: func(ctx context.Context) string {
|
||||||
folder, err := CreateMailFolder(ctx, suite.es, userID, folderName)
|
// folderName := "TestRestoreContactObject: " + common.FormatSimpleDateTime(now)
|
||||||
require.NoError(t, err)
|
// folder, err := CreateContactFolder(ctx, suite.es, userID, folderName)
|
||||||
|
// require.NoError(t, err)
|
||||||
|
|
||||||
return *folder.GetId()
|
// return *folder.GetId()
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
// TODO: #884 - reinstate when able to specify root folder by name
|
// {
|
||||||
{
|
// name: "Test Events",
|
||||||
name: "Test Contact",
|
// bytes: mockconnector.GetDefaultMockEventBytes("Restored Event Object"),
|
||||||
bytes: mockconnector.GetMockContactBytes("Test_Omega"),
|
// category: path.EventsCategory,
|
||||||
category: path.ContactsCategory,
|
// cleanupFunc: DeleteCalendar,
|
||||||
cleanupFunc: DeleteContactFolder,
|
// destination: func(ctx context.Context) string {
|
||||||
destination: func(ctx context.Context) string {
|
// calendarName := "TestRestoreEventObject: " + common.FormatSimpleDateTime(now)
|
||||||
folderName := "TestRestoreContactObject: " + common.FormatSimpleDateTime(now)
|
// calendar, err := CreateCalendar(ctx, suite.es, userID, calendarName)
|
||||||
folder, err := CreateContactFolder(ctx, suite.es, userID, folderName)
|
// require.NoError(t, err)
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
return *folder.GetId()
|
// return *calendar.GetId()
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
|
||||||
name: "Test Events",
|
|
||||||
bytes: mockconnector.GetDefaultMockEventBytes("Restored Event Object"),
|
|
||||||
category: path.EventsCategory,
|
|
||||||
cleanupFunc: DeleteCalendar,
|
|
||||||
destination: func(ctx context.Context) string {
|
|
||||||
calendarName := "TestRestoreEventObject: " + common.FormatSimpleDateTime(now)
|
|
||||||
calendar, err := CreateCalendar(ctx, suite.es, userID, calendarName)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
return *calendar.GetId()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user