Some minor test cleanup (#1194)
## Description * switch up email restore/backup test slightly to cover multiple folders * remove multi-folder mail backup, now overlaps with the above * remove stale TODO * remove unused struct field * factor out common struct ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [x] 🤖 Test - [ ] 💻 CI/Deployment - [x] 🐹 Trivial/Minor ## Issue(s) * #913 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
3e3c21ab1b
commit
b752d1da8d
@ -156,6 +156,12 @@ type colInfo struct {
|
|||||||
items []itemInfo
|
items []itemInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type restoreBackupInfo struct {
|
||||||
|
name string
|
||||||
|
service path.ServiceType
|
||||||
|
collections []colInfo
|
||||||
|
}
|
||||||
|
|
||||||
func attachmentEqual(
|
func attachmentEqual(
|
||||||
expected models.Attachmentable,
|
expected models.Attachmentable,
|
||||||
got models.Attachmentable,
|
got models.Attachmentable,
|
||||||
|
|||||||
@ -450,21 +450,14 @@ func (suite *GraphConnectorIntegrationSuite) TestEmptyCollections() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestRestoreAndBackup
|
|
||||||
func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
||||||
bodyText := "This email has some text. However, all the text is on the same line."
|
bodyText := "This email has some text. However, all the text is on the same line."
|
||||||
subjectText := "Test message for restore"
|
subjectText := "Test message for restore"
|
||||||
|
|
||||||
table := []struct {
|
table := []restoreBackupInfo{
|
||||||
name string
|
|
||||||
service path.ServiceType
|
|
||||||
collections []colInfo
|
|
||||||
expectedRestoreFolders int
|
|
||||||
}{
|
|
||||||
{
|
{
|
||||||
name: "EmailsWithAttachments",
|
name: "EmailsWithAttachments",
|
||||||
service: path.ExchangeService,
|
service: path.ExchangeService,
|
||||||
expectedRestoreFolders: 1,
|
|
||||||
collections: []colInfo{
|
collections: []colInfo{
|
||||||
{
|
{
|
||||||
pathElements: []string{"Inbox"},
|
pathElements: []string{"Inbox"},
|
||||||
@ -489,9 +482,8 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "MultipleEmailsSingleFolder",
|
name: "MultipleEmailsMultipleFolders",
|
||||||
service: path.ExchangeService,
|
service: path.ExchangeService,
|
||||||
expectedRestoreFolders: 1,
|
|
||||||
collections: []colInfo{
|
collections: []colInfo{
|
||||||
{
|
{
|
||||||
pathElements: []string{"Inbox"},
|
pathElements: []string{"Inbox"},
|
||||||
@ -505,6 +497,12 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
),
|
),
|
||||||
lookupKey: subjectText + "-1",
|
lookupKey: subjectText + "-1",
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pathElements: []string{"Work"},
|
||||||
|
category: path.EmailCategory,
|
||||||
|
items: []itemInfo{
|
||||||
{
|
{
|
||||||
name: "someencodeditemID2",
|
name: "someencodeditemID2",
|
||||||
data: mockconnector.GetMockMessageWithBodyBytes(
|
data: mockconnector.GetMockMessageWithBodyBytes(
|
||||||
@ -717,66 +715,17 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
|
|||||||
checkCollections(t, totalItems, expectedData, dcs)
|
checkCollections(t, totalItems, expectedData, dcs)
|
||||||
|
|
||||||
status = backupGC.AwaitStatus()
|
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.ObjectCount, "status.ObjectCount")
|
||||||
assert.Equal(t, totalItems, status.Successful, "status.Successful")
|
assert.Equal(t, totalItems, status.Successful, "status.Successful")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestMultiFolderBackupDifferentNames
|
|
||||||
func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames() {
|
func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames() {
|
||||||
bodyText := "This email has some text. However, all the text is on the same line."
|
table := []restoreBackupInfo{
|
||||||
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
|
|
||||||
}{
|
|
||||||
{
|
{
|
||||||
name: "Email",
|
name: "Contacts",
|
||||||
service: path.ExchangeService,
|
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,
|
|
||||||
collections: []colInfo{
|
collections: []colInfo{
|
||||||
{
|
{
|
||||||
pathElements: []string{"Work"},
|
pathElements: []string{"Work"},
|
||||||
@ -803,9 +752,8 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Events",
|
name: "Events",
|
||||||
service: path.ExchangeService,
|
service: path.ExchangeService,
|
||||||
category: path.EventsCategory,
|
|
||||||
collections: []colInfo{
|
collections: []colInfo{
|
||||||
{
|
{
|
||||||
pathElements: []string{"Work"},
|
pathElements: []string{"Work"},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user