Fix no restore permissions/backup test (#2639)

Don't restore permissions like the test says

---

#### Does this PR need a docs update or release note?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

* closes #2638

#### Test Plan

- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2023-02-27 09:41:37 -08:00 committed by GitHub
parent 29c6ac4874
commit d3e1ee8516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 50 deletions

View File

@ -196,7 +196,6 @@ type restoreBackupInfoMultiVersion struct {
collectionsPrevious []colInfo
resource resource
backupVersion int
countMeta bool
}
func attachmentEqual(

View File

@ -425,7 +425,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestRestoreAndBackup_Multip
service: path.OneDriveService,
resource: Users,
backupVersion: vn,
countMeta: vn == 0,
collectionsPrevious: input,
collectionsLatest: expected,
}
@ -626,7 +625,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsRestoreAndBa
service: path.OneDriveService,
resource: Users,
backupVersion: vn,
countMeta: vn == 0,
collectionsPrevious: input,
collectionsLatest: expected,
}
@ -646,8 +644,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsRestoreAndBa
}
}
// TODO(ashmrtn): What this test is supposed to do needs investigated. It
// doesn't seem to do what it says.
func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsBackupAndNoRestore() {
ctx, flush := tester.NewContext()
defer flush()
@ -662,61 +658,70 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsBackupAndNoR
startVersion := version.OneDrive1DataAndMetaFiles
table := []onedriveTest{
inputCols := []onedriveColInfo{
{
startVersion: startVersion,
cols: []onedriveColInfo{
pathElements: []string{
"drives",
driveID,
"root:",
},
files: []itemData{
{
pathElements: []string{
"drives",
driveID,
"root:",
},
files: []itemData{
{
name: fileName,
data: fileAData,
perms: permData{
user: suite.secondaryUser,
roles: writePerm,
},
},
name: fileName,
data: fileAData,
perms: permData{
user: suite.secondaryUser,
roles: writePerm,
},
},
},
},
}
for _, test := range table {
expected := testDataForInfo(suite.T(), test.cols, version.Backup)
expectedCols := []onedriveColInfo{
{
pathElements: []string{
"drives",
driveID,
"root:",
},
files: []itemData{
{
// No permissions on the output since they weren't restored.
name: fileName,
data: fileAData,
},
},
},
}
for vn := test.startVersion; vn <= version.Backup; vn++ {
suite.Run(fmt.Sprintf("Version%d", vn), func() {
t := suite.T()
input := testDataForInfo(t, test.cols, vn)
expected := testDataForInfo(suite.T(), expectedCols, version.Backup)
testData := restoreBackupInfoMultiVersion{
service: path.OneDriveService,
resource: Users,
backupVersion: vn,
countMeta: vn == 0,
collectionsPrevious: input,
collectionsLatest: expected,
}
for vn := startVersion; vn <= version.Backup; vn++ {
suite.Run(fmt.Sprintf("Version%d", vn), func() {
t := suite.T()
input := testDataForInfo(t, inputCols, vn)
runRestoreBackupTestVersions(
t,
suite.acct,
testData,
suite.connector.tenant,
[]string{suite.user},
control.Options{
RestorePermissions: true,
ToggleFeatures: control.Toggles{EnablePermissionsBackup: true},
},
)
})
}
testData := restoreBackupInfoMultiVersion{
service: path.OneDriveService,
resource: Users,
backupVersion: vn,
collectionsPrevious: input,
collectionsLatest: expected,
}
runRestoreBackupTestVersions(
t,
suite.acct,
testData,
suite.connector.tenant,
[]string{suite.user},
control.Options{
RestorePermissions: false,
ToggleFeatures: control.Toggles{EnablePermissionsBackup: true},
},
)
})
}
}
@ -741,7 +746,6 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsRestoreAndNo
service: path.OneDriveService,
resource: Users,
backupVersion: version.Backup,
countMeta: false,
collectionsPrevious: []colInfo{
newOneDriveCollection(
suite.T(),