Reenable email tests (#1171)

## Description

Helper code for getting output destination has been merged so it's possible to reenable these tests now.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

* closes #1169

merge after:
* #1184 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2022-10-17 14:36:03 -07:00 committed by GitHub
parent 8c495f8866
commit 0963bbe364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 106 additions and 111 deletions

View File

@ -800,10 +800,9 @@ func backupOutputPathFromRestore(
} }
} }
// TODO(ashmrtn): Uncomment when exchange mail supports restoring to subfolders. if inputPath.Service() == path.ExchangeService && inputPath.Category() == path.EmailCategory {
// if inputPath.Service == path.ExchangeService && inputPath.Category() == path.EmailCategory { base = append(base, inputPath.Folders()...)
// base = append(base, inputPath.Folders()...) }
// }
return mustToDataLayerPath( return mustToDataLayerPath(
t, t,

View File

@ -451,11 +451,9 @@ func (suite *GraphConnectorIntegrationSuite) TestEmptyCollections() {
} }
// TestRestoreAndBackup // TestRestoreAndBackup
// nolint:wsl
func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() { func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
// nolint:gofmt 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 := []struct {
name string name string
@ -463,70 +461,70 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
collections []colInfo collections []colInfo
expectedRestoreFolders int expectedRestoreFolders int
}{ }{
// { {
// name: "EmailsWithAttachments", name: "EmailsWithAttachments",
// service: path.ExchangeService, service: path.ExchangeService,
// expectedRestoreFolders: 1, expectedRestoreFolders: 1,
// collections: []colInfo{ collections: []colInfo{
// { {
// pathElements: []string{"Inbox"}, pathElements: []string{"Inbox"},
// category: path.EmailCategory, category: path.EmailCategory,
// items: []itemInfo{ items: []itemInfo{
// { {
// name: "someencodeditemID", name: "someencodeditemID",
// data: mockconnector.GetMockMessageWithDirectAttachment( data: mockconnector.GetMockMessageWithDirectAttachment(
// subjectText + "-1", subjectText + "-1",
// ), ),
// lookupKey: subjectText + "-1", lookupKey: subjectText + "-1",
// }, },
// { {
// name: "someencodeditemID2", name: "someencodeditemID2",
// data: mockconnector.GetMockMessageWithTwoAttachments( data: mockconnector.GetMockMessageWithTwoAttachments(
// subjectText + "-2", subjectText + "-2",
// ), ),
// lookupKey: subjectText + "-2", lookupKey: subjectText + "-2",
// }, },
// }, },
// }, },
// }, },
// }, },
// { {
// name: "MultipleEmailsSingleFolder", name: "MultipleEmailsSingleFolder",
// service: path.ExchangeService, service: path.ExchangeService,
// expectedRestoreFolders: 1, expectedRestoreFolders: 1,
// collections: []colInfo{ collections: []colInfo{
// { {
// pathElements: []string{"Inbox"}, pathElements: []string{"Inbox"},
// category: path.EmailCategory, category: path.EmailCategory,
// items: []itemInfo{ items: []itemInfo{
// { {
// name: "someencodeditemID", name: "someencodeditemID",
// data: mockconnector.GetMockMessageWithBodyBytes( data: mockconnector.GetMockMessageWithBodyBytes(
// subjectText+"-1", subjectText+"-1",
// bodyText+" 1.", bodyText+" 1.",
// ), ),
// lookupKey: subjectText + "-1", lookupKey: subjectText + "-1",
// }, },
// { {
// name: "someencodeditemID2", name: "someencodeditemID2",
// data: mockconnector.GetMockMessageWithBodyBytes( data: mockconnector.GetMockMessageWithBodyBytes(
// subjectText+"-2", subjectText+"-2",
// bodyText+" 2.", bodyText+" 2.",
// ), ),
// lookupKey: subjectText + "-2", lookupKey: subjectText + "-2",
// }, },
// { {
// name: "someencodeditemID3", name: "someencodeditemID3",
// data: mockconnector.GetMockMessageWithBodyBytes( data: mockconnector.GetMockMessageWithBodyBytes(
// subjectText+"-3", subjectText+"-3",
// bodyText+" 3.", bodyText+" 3.",
// ), ),
// lookupKey: subjectText + "-3", lookupKey: subjectText + "-3",
// }, },
// }, },
// }, },
// }, },
// }, },
{ {
name: "MultipleContactsSingleFolder", name: "MultipleContactsSingleFolder",
service: path.ExchangeService, service: path.ExchangeService,
@ -728,11 +726,9 @@ func (suite *GraphConnectorIntegrationSuite) TestRestoreAndBackup() {
} }
// TestMultiFolderBackupDifferentNames // TestMultiFolderBackupDifferentNames
//nolint:wsl
func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames() { func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames() {
//nolint:gofumpt 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 := []struct {
name string name string
@ -742,41 +738,41 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
// backup later. // backup later.
collections []colInfo collections []colInfo
}{ }{
// { {
// name: "Email", name: "Email",
// service: path.ExchangeService, service: path.ExchangeService,
// category: path.EmailCategory, category: path.EmailCategory,
// collections: []colInfo{ collections: []colInfo{
// { {
// pathElements: []string{"Inbox"}, pathElements: []string{"Inbox"},
// category: path.EmailCategory, category: path.EmailCategory,
// items: []itemInfo{ items: []itemInfo{
// { {
// name: "someencodeditemID", name: "someencodeditemID",
// data: mockconnector.GetMockMessageWithBodyBytes( data: mockconnector.GetMockMessageWithBodyBytes(
// subjectText+"-1", subjectText+"-1",
// bodyText+" 1.", bodyText+" 1.",
// ), ),
// lookupKey: subjectText + "-1", lookupKey: subjectText + "-1",
// }, },
// }, },
// }, },
// { {
// pathElements: []string{"Archive"}, pathElements: []string{"Archive"},
// category: path.EmailCategory, category: path.EmailCategory,
// items: []itemInfo{ items: []itemInfo{
// { {
// name: "someencodeditemID2", name: "someencodeditemID2",
// data: mockconnector.GetMockMessageWithBodyBytes( data: mockconnector.GetMockMessageWithBodyBytes(
// subjectText+"-2", subjectText+"-2",
// bodyText+" 2.", bodyText+" 2.",
// ), ),
// lookupKey: subjectText + "-2", lookupKey: subjectText + "-2",
// }, },
// }, },
// }, },
// }, },
// }, },
{ {
name: "Contacts", name: "Contacts",
service: path.ExchangeService, service: path.ExchangeService,