diff --git a/src/internal/connector/graph_connector_helper_test.go b/src/internal/connector/graph_connector_helper_test.go index 71be15fea..ae06014c7 100644 --- a/src/internal/connector/graph_connector_helper_test.go +++ b/src/internal/connector/graph_connector_helper_test.go @@ -156,6 +156,12 @@ type colInfo struct { items []itemInfo } +type restoreBackupInfo struct { + name string + service path.ServiceType + collections []colInfo +} + func attachmentEqual( expected models.Attachmentable, got models.Attachmentable, diff --git a/src/internal/connector/graph_connector_test.go b/src/internal/connector/graph_connector_test.go index 5b7b893ff..5f0a6b5b7 100644 --- a/src/internal/connector/graph_connector_test.go +++ b/src/internal/connector/graph_connector_test.go @@ -450,21 +450,14 @@ func (suite *GraphConnectorIntegrationSuite) TestEmptyCollections() { } } -// TestRestoreAndBackup func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() { bodyText := "This email has some text. However, all the text is on the same line." subjectText := "Test message for restore" - table := []struct { - name string - service path.ServiceType - collections []colInfo - expectedRestoreFolders int - }{ + table := []restoreBackupInfo{ { - name: "EmailsWithAttachments", - service: path.ExchangeService, - expectedRestoreFolders: 1, + name: "EmailsWithAttachments", + service: path.ExchangeService, collections: []colInfo{ { pathElements: []string{"Inbox"}, @@ -489,9 +482,8 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() { }, }, { - name: "MultipleEmailsSingleFolder", - service: path.ExchangeService, - expectedRestoreFolders: 1, + name: "MultipleEmailsMultipleFolders", + service: path.ExchangeService, collections: []colInfo{ { pathElements: []string{"Inbox"}, @@ -505,6 +497,12 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() { ), lookupKey: subjectText + "-1", }, + }, + }, + { + pathElements: []string{"Work"}, + category: path.EmailCategory, + items: []itemInfo{ { name: "someencodeditemID2", data: mockconnector.GetMockMessageWithBodyBytes( @@ -717,66 +715,17 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() { checkCollections(t, totalItems, expectedData, dcs) status = backupGC.AwaitStatus() - // TODO(ashmrtn): This will need to change when the restore layout is - // updated. assert.Equal(t, totalItems, status.ObjectCount, "status.ObjectCount") assert.Equal(t, totalItems, status.Successful, "status.Successful") }) } } -// TestMultiFolderBackupDifferentNames func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames() { - bodyText := "This email has some text. However, all the text is on the same line." - subjectText := "Test message for restore" - - table := []struct { - name string - service path.ServiceType - category path.CategoryType - // Each collection will be restored separately, creating multiple folders to - // backup later. - collections []colInfo - }{ + table := []restoreBackupInfo{ { - name: "Email", - service: path.ExchangeService, - category: path.EmailCategory, - collections: []colInfo{ - { - pathElements: []string{"Inbox"}, - category: path.EmailCategory, - items: []itemInfo{ - { - name: "someencodeditemID", - data: mockconnector.GetMockMessageWithBodyBytes( - subjectText+"-1", - bodyText+" 1.", - ), - lookupKey: subjectText + "-1", - }, - }, - }, - { - pathElements: []string{"Archive"}, - category: path.EmailCategory, - items: []itemInfo{ - { - name: "someencodeditemID2", - data: mockconnector.GetMockMessageWithBodyBytes( - subjectText+"-2", - bodyText+" 2.", - ), - lookupKey: subjectText + "-2", - }, - }, - }, - }, - }, - { - name: "Contacts", - service: path.ExchangeService, - category: path.ContactsCategory, + name: "Contacts", + service: path.ExchangeService, collections: []colInfo{ { pathElements: []string{"Work"}, @@ -803,9 +752,8 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames }, }, { - name: "Events", - service: path.ExchangeService, - category: path.EventsCategory, + name: "Events", + service: path.ExchangeService, collections: []colInfo{ { pathElements: []string{"Work"},