Update RestoreAndBackup OneDrive tests

This commit is contained in:
Ashlie Martinez 2023-02-21 15:39:20 -08:00
parent d7ec24d6cd
commit 3f8308cfc1

View File

@ -178,6 +178,8 @@ func (c *onedriveCollection) withFile(
case 1: case 1:
fallthrough fallthrough
case 2: case 2:
fallthrough
case 3:
c.items = append(c.items, onedriveItemWithData( c.items = append(c.items, onedriveItemWithData(
c.t, c.t,
name+onedrive.DataFileSuffix, name+onedrive.DataFileSuffix,
@ -207,6 +209,8 @@ func (c *onedriveCollection) withFolder(
) *onedriveCollection { ) *onedriveCollection {
switch c.backupVersion { switch c.backupVersion {
case 0: case 0:
fallthrough
case 3:
return c return c
case 1: case 1:
@ -247,15 +251,15 @@ func (c *onedriveCollection) withPermissions(
return c return c
} }
c.items = append( metadata := onedriveMetadata(
c.items, c.t,
onedriveMetadata( name,
c.t, name+onedrive.DirMetaFileSuffix,
name, user,
name+onedrive.DirMetaFileSuffix, roles)
user,
roles), c.items = append(c.items, metadata)
) c.aux = append(c.aux, metadata)
return c return c
} }
@ -382,6 +386,10 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestRestoreAndBackup_Multip
}, },
{ {
pathElements: folderBPath, pathElements: folderBPath,
perms: permData{
user: suite.secondaryUser,
roles: readPerm,
},
files: []itemData{ files: []itemData{
{ {
name: fileName, name: fileName,
@ -895,6 +903,12 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) TestPermissionsRestoreAndNo
"", "",
nil, nil,
). ).
// Call this to generate a meta file with the folder name that we can
// check.
withPermissions(
"",
nil,
).
collection(), collection(),
}, },
} }