consts for drives, root: (#3385)
#### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
caea3ab6da
commit
6c410c298c
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive/metadata"
|
"github.com/alcionai/corso/src/internal/connector/onedrive/metadata"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/version"
|
"github.com/alcionai/corso/src/internal/version"
|
||||||
@ -109,7 +110,6 @@ var (
|
|||||||
folderAName = "folder-a"
|
folderAName = "folder-a"
|
||||||
folderBName = "b"
|
folderBName = "b"
|
||||||
folderNamedFolder = "folder"
|
folderNamedFolder = "folder"
|
||||||
rootFolder = "root:"
|
|
||||||
|
|
||||||
fileAData = []byte(strings.Repeat("a", 33))
|
fileAData = []byte(strings.Repeat("a", 33))
|
||||||
fileBData = []byte(strings.Repeat("b", 65))
|
fileBData = []byte(strings.Repeat("b", 65))
|
||||||
@ -255,7 +255,7 @@ func (c *onedriveCollection) withPermissions(perm permData) *onedriveCollection
|
|||||||
metaName = ""
|
metaName = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if name == rootFolder {
|
if name == odConsts.RootPathDir {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,35 +631,35 @@ func testRestoreAndBackupMultipleFilesAndFoldersNoPermissions(
|
|||||||
suite.BackupResourceOwner())
|
suite.BackupResourceOwner())
|
||||||
|
|
||||||
rootPath := []string{
|
rootPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
}
|
}
|
||||||
folderAPath := []string{
|
folderAPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
}
|
}
|
||||||
subfolderBPath := []string{
|
subfolderBPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
folderBName,
|
folderBName,
|
||||||
}
|
}
|
||||||
subfolderAPath := []string{
|
subfolderAPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
folderBName,
|
folderBName,
|
||||||
folderAName,
|
folderAName,
|
||||||
}
|
}
|
||||||
folderBPath := []string{
|
folderBPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderBName,
|
folderBName,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,34 +776,34 @@ func testPermissionsRestoreAndBackup(suite oneDriveSuite, startVersion int) {
|
|||||||
folderCName := "folder-c"
|
folderCName := "folder-c"
|
||||||
|
|
||||||
rootPath := []string{
|
rootPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
}
|
}
|
||||||
folderAPath := []string{
|
folderAPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
}
|
}
|
||||||
folderBPath := []string{
|
folderBPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderBName,
|
folderBName,
|
||||||
}
|
}
|
||||||
// For skipped test
|
// For skipped test
|
||||||
// subfolderAPath := []string{
|
// subfolderAPath := []string{
|
||||||
// "drives",
|
// odConsts.DrivesPathDir,
|
||||||
// driveID,
|
// driveID,
|
||||||
// rootFolder,
|
// odConsts.RootPathDir,
|
||||||
// folderBName,
|
// folderBName,
|
||||||
// folderAName,
|
// folderAName,
|
||||||
// }
|
// }
|
||||||
folderCPath := []string{
|
folderCPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderCName,
|
folderCName,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,9 +987,9 @@ func testPermissionsBackupAndNoRestore(suite oneDriveSuite, startVersion int) {
|
|||||||
inputCols := []onedriveColInfo{
|
inputCols := []onedriveColInfo{
|
||||||
{
|
{
|
||||||
pathElements: []string{
|
pathElements: []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
},
|
},
|
||||||
files: []itemData{
|
files: []itemData{
|
||||||
{
|
{
|
||||||
@ -1008,9 +1008,9 @@ func testPermissionsBackupAndNoRestore(suite oneDriveSuite, startVersion int) {
|
|||||||
expectedCols := []onedriveColInfo{
|
expectedCols := []onedriveColInfo{
|
||||||
{
|
{
|
||||||
pathElements: []string{
|
pathElements: []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
},
|
},
|
||||||
files: []itemData{
|
files: []itemData{
|
||||||
{
|
{
|
||||||
@ -1073,34 +1073,34 @@ func testPermissionsInheritanceRestoreAndBackup(suite oneDriveSuite, startVersio
|
|||||||
folderCName := "empty"
|
folderCName := "empty"
|
||||||
|
|
||||||
rootPath := []string{
|
rootPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
}
|
}
|
||||||
folderAPath := []string{
|
folderAPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
}
|
}
|
||||||
subfolderAAPath := []string{
|
subfolderAAPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
folderAName,
|
folderAName,
|
||||||
}
|
}
|
||||||
subfolderABPath := []string{
|
subfolderABPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
folderBName,
|
folderBName,
|
||||||
}
|
}
|
||||||
subfolderACPath := []string{
|
subfolderACPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderAName,
|
folderAName,
|
||||||
folderCName,
|
folderCName,
|
||||||
}
|
}
|
||||||
@ -1246,20 +1246,20 @@ func testRestoreFolderNamedFolderRegression(
|
|||||||
suite.BackupResourceOwner())
|
suite.BackupResourceOwner())
|
||||||
|
|
||||||
rootPath := []string{
|
rootPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
}
|
}
|
||||||
folderFolderPath := []string{
|
folderFolderPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderNamedFolder,
|
folderNamedFolder,
|
||||||
}
|
}
|
||||||
subfolderPath := []string{
|
subfolderPath := []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
driveID,
|
driveID,
|
||||||
rootFolder,
|
odConsts.RootPathDir,
|
||||||
folderNamedFolder,
|
folderNamedFolder,
|
||||||
folderBName,
|
folderBName,
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/internal/connector/onedrive/consts/consts.go
Normal file
10
src/internal/connector/onedrive/consts/consts.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package onedrive
|
||||||
|
|
||||||
|
const (
|
||||||
|
// const used as the root dir for the drive portion of a path prefix.
|
||||||
|
// eg: tid/onedrive/ro/files/drives/driveid/...
|
||||||
|
DrivesPathDir = "drives"
|
||||||
|
// const used as the root-of-drive dir for the drive portion of a path prefix.
|
||||||
|
// eg: tid/onedrive/ro/files/drives/driveid/root:/...
|
||||||
|
RootPathDir = "root:"
|
||||||
|
)
|
||||||
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
gapi "github.com/alcionai/corso/src/internal/connector/graph/api"
|
gapi "github.com/alcionai/corso/src/internal/connector/graph/api"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
"github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
"github.com/alcionai/corso/src/pkg/logger"
|
"github.com/alcionai/corso/src/pkg/logger"
|
||||||
"github.com/alcionai/corso/src/pkg/path"
|
"github.com/alcionai/corso/src/pkg/path"
|
||||||
@ -71,7 +72,7 @@ func pathPrefixerForSource(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return func(driveID string) (path.Path, error) {
|
return func(driveID string) (path.Path, error) {
|
||||||
return path.Build(tenantID, resourceOwner, serv, cat, false, "drives", driveID, "root:")
|
return path.Build(tenantID, resourceOwner, serv, cat, false, odConsts.DrivesPathDir, driveID, odConsts.RootPathDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/connector/mock"
|
"github.com/alcionai/corso/src/internal/connector/mock"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||||
odapi "github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
odapi "github.com/alcionai/corso/src/internal/connector/onedrive/api"
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive/metadata"
|
"github.com/alcionai/corso/src/internal/connector/onedrive/metadata"
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
@ -369,7 +370,7 @@ func generateContainerOfItems(
|
|||||||
|
|
||||||
switch service {
|
switch service {
|
||||||
case path.OneDriveService, path.SharePointService:
|
case path.OneDriveService, path.SharePointService:
|
||||||
pathFolders = []string{"drives", driveID, "root:", destFldr}
|
pathFolders = []string{odConsts.DrivesPathDir, driveID, odConsts.RootPathDir, destFldr}
|
||||||
}
|
}
|
||||||
|
|
||||||
collections := []incrementalCollection{{
|
collections := []incrementalCollection{{
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
"github.com/alcionai/corso/src/internal/common/prefixmatcher"
|
||||||
"github.com/alcionai/corso/src/internal/connector/mock"
|
"github.com/alcionai/corso/src/internal/connector/mock"
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
evmock "github.com/alcionai/corso/src/internal/events/mock"
|
evmock "github.com/alcionai/corso/src/internal/events/mock"
|
||||||
"github.com/alcionai/corso/src/internal/kopia"
|
"github.com/alcionai/corso/src/internal/kopia"
|
||||||
@ -657,15 +658,15 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
path.OneDriveService.String(),
|
path.OneDriveService.String(),
|
||||||
ro,
|
ro,
|
||||||
path.FilesCategory.String(),
|
path.FilesCategory.String(),
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
"drive-id",
|
"drive-id",
|
||||||
"root:",
|
odConsts.RootPathDir,
|
||||||
"work",
|
"work",
|
||||||
"item1",
|
"item1",
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
locationPath1 = path.Builder{}.Append("root:", "work-display-name")
|
locationPath1 = path.Builder{}.Append(odConsts.RootPathDir, "work-display-name")
|
||||||
itemPath2 = makePath(
|
itemPath2 = makePath(
|
||||||
suite.T(),
|
suite.T(),
|
||||||
[]string{
|
[]string{
|
||||||
@ -673,15 +674,15 @@ func (suite *BackupOpUnitSuite) TestBackupOperation_MergeBackupDetails_AddsItems
|
|||||||
path.OneDriveService.String(),
|
path.OneDriveService.String(),
|
||||||
ro,
|
ro,
|
||||||
path.FilesCategory.String(),
|
path.FilesCategory.String(),
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
"drive-id",
|
"drive-id",
|
||||||
"root:",
|
odConsts.RootPathDir,
|
||||||
"personal",
|
"personal",
|
||||||
"item2",
|
"item2",
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
locationPath2 = path.Builder{}.Append("root:", "personal-display-name")
|
locationPath2 = path.Builder{}.Append(odConsts.RootPathDir, "personal-display-name")
|
||||||
itemPath3 = makePath(
|
itemPath3 = makePath(
|
||||||
suite.T(),
|
suite.T(),
|
||||||
[]string{
|
[]string{
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/dttm"
|
"github.com/alcionai/corso/src/internal/common/dttm"
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/internal/connector/onedrive/metadata"
|
"github.com/alcionai/corso/src/internal/connector/onedrive/metadata"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/version"
|
"github.com/alcionai/corso/src/internal/version"
|
||||||
@ -242,9 +243,9 @@ func oneDriveishEntry(t *testing.T, id string, size int, it ItemType) Entry {
|
|||||||
"tenant-id",
|
"tenant-id",
|
||||||
"user-id",
|
"user-id",
|
||||||
[]string{
|
[]string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
"drive-id",
|
"drive-id",
|
||||||
"root:",
|
odConsts.RootPathDir,
|
||||||
"Inbox",
|
"Inbox",
|
||||||
"folder1",
|
"folder1",
|
||||||
id,
|
id,
|
||||||
@ -408,7 +409,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
|
|||||||
{
|
{
|
||||||
ItemInfo: ItemInfo{
|
ItemInfo: ItemInfo{
|
||||||
Folder: &FolderInfo{
|
Folder: &FolderInfo{
|
||||||
DisplayName: "root:",
|
DisplayName: odConsts.RootPathDir,
|
||||||
ItemType: FolderItem,
|
ItemType: FolderItem,
|
||||||
DriveName: "drive-name",
|
DriveName: "drive-name",
|
||||||
DriveID: "drive-id",
|
DriveID: "drive-id",
|
||||||
@ -416,7 +417,7 @@ func (suite *DetailsUnitSuite) TestDetailsAdd_LocationFolders() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
LocationRef: "root:",
|
LocationRef: odConsts.RootPathDir,
|
||||||
ItemInfo: ItemInfo{
|
ItemInfo: ItemInfo{
|
||||||
Folder: &FolderInfo{
|
Folder: &FolderInfo{
|
||||||
DisplayName: "Inbox",
|
DisplayName: "Inbox",
|
||||||
@ -958,7 +959,7 @@ func (suite *DetailsUnitSuite) TestBuilder_Add_shortRefsUniqueFromFolder() {
|
|||||||
"a-user",
|
"a-user",
|
||||||
[]string{
|
[]string{
|
||||||
"drive-id",
|
"drive-id",
|
||||||
"root:",
|
odConsts.RootPathDir,
|
||||||
"folder",
|
"folder",
|
||||||
name + "-id",
|
name + "-id",
|
||||||
})
|
})
|
||||||
@ -971,7 +972,7 @@ func (suite *DetailsUnitSuite) TestBuilder_Add_shortRefsUniqueFromFolder() {
|
|||||||
"a-user",
|
"a-user",
|
||||||
[]string{
|
[]string{
|
||||||
"drive-id",
|
"drive-id",
|
||||||
"root:",
|
odConsts.RootPathDir,
|
||||||
"folder",
|
"folder",
|
||||||
name + "-id",
|
name + "-id",
|
||||||
name,
|
name,
|
||||||
@ -1060,7 +1061,7 @@ func (suite *DetailsUnitSuite) TestUpdateItem() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
newExchangePB := path.Builder{}.Append(folder2)
|
newExchangePB := path.Builder{}.Append(folder2)
|
||||||
newOneDrivePB := path.Builder{}.Append("root:", folder2)
|
newOneDrivePB := path.Builder{}.Append(odConsts.RootPathDir, folder2)
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/path"
|
"github.com/alcionai/corso/src/pkg/path"
|
||||||
)
|
)
|
||||||
@ -22,8 +23,6 @@ func TestOneDrivePathSuite(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *OneDrivePathSuite) Test_ToOneDrivePath() {
|
func (suite *OneDrivePathSuite) Test_ToOneDrivePath() {
|
||||||
const root = "root:"
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
pathElements []string
|
pathElements []string
|
||||||
@ -32,20 +31,28 @@ func (suite *OneDrivePathSuite) Test_ToOneDrivePath() {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Not enough path elements",
|
name: "Not enough path elements",
|
||||||
pathElements: []string{"drives", "driveID"},
|
pathElements: []string{odConsts.DrivesPathDir, "driveID"},
|
||||||
errCheck: assert.Error,
|
errCheck: assert.Error,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Root path",
|
name: "Root path",
|
||||||
pathElements: []string{"drives", "driveID", root},
|
pathElements: []string{odConsts.DrivesPathDir, "driveID", odConsts.RootPathDir},
|
||||||
expected: &path.DrivePath{DriveID: "driveID", Root: root, Folders: []string{}},
|
expected: &path.DrivePath{
|
||||||
errCheck: assert.NoError,
|
DriveID: "driveID",
|
||||||
|
Root: odConsts.RootPathDir,
|
||||||
|
Folders: []string{},
|
||||||
|
},
|
||||||
|
errCheck: assert.NoError,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Deeper path",
|
name: "Deeper path",
|
||||||
pathElements: []string{"drives", "driveID", root, "folder1", "folder2"},
|
pathElements: []string{odConsts.DrivesPathDir, "driveID", odConsts.RootPathDir, "folder1", "folder2"},
|
||||||
expected: &path.DrivePath{DriveID: "driveID", Root: root, Folders: []string{"folder1", "folder2"}},
|
expected: &path.DrivePath{
|
||||||
errCheck: assert.NoError,
|
DriveID: "driveID",
|
||||||
|
Root: odConsts.RootPathDir,
|
||||||
|
Folders: []string{"folder1", "folder2"},
|
||||||
|
},
|
||||||
|
errCheck: assert.NoError,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/dttm"
|
"github.com/alcionai/corso/src/internal/common/dttm"
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
@ -315,7 +316,7 @@ func (suite *OneDriveSelectorSuite) TestOneDriveCategory_PathValues() {
|
|||||||
fileName := "file"
|
fileName := "file"
|
||||||
fileID := fileName + "-id"
|
fileID := fileName + "-id"
|
||||||
shortRef := "short"
|
shortRef := "short"
|
||||||
elems := []string{"drives", "driveID", "root:", "dir1.d", "dir2.d", fileID}
|
elems := []string{odConsts.DrivesPathDir, "driveID", odConsts.RootPathDir, "dir1.d", "dir2.d", fileID}
|
||||||
|
|
||||||
filePath, err := path.Build("tenant", "user", path.OneDriveService, path.FilesCategory, true, elems...)
|
filePath, err := path.Build("tenant", "user", path.OneDriveService, path.FilesCategory, true, elems...)
|
||||||
require.NoError(t, err, clues.ToCore(err))
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import (
|
|||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/dttm"
|
"github.com/alcionai/corso/src/internal/common/dttm"
|
||||||
|
odConsts "github.com/alcionai/corso/src/internal/connector/onedrive/consts"
|
||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
@ -223,9 +224,9 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
prefixElems = []string{
|
prefixElems = []string{
|
||||||
"drives",
|
odConsts.DrivesPathDir,
|
||||||
"drive!id",
|
"drive!id",
|
||||||
"root:",
|
odConsts.RootPathDir,
|
||||||
}
|
}
|
||||||
itemElems1 = []string{"folderA", "folderB"}
|
itemElems1 = []string{"folderA", "folderB"}
|
||||||
itemElems2 = []string{"folderA", "folderC"}
|
itemElems2 = []string{"folderA", "folderC"}
|
||||||
@ -257,7 +258,7 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
|||||||
{
|
{
|
||||||
RepoRef: item,
|
RepoRef: item,
|
||||||
ItemRef: "item",
|
ItemRef: "item",
|
||||||
LocationRef: strings.Join(append([]string{"root:"}, itemElems1...), "/"),
|
LocationRef: strings.Join(append([]string{odConsts.RootPathDir}, itemElems1...), "/"),
|
||||||
ItemInfo: details.ItemInfo{
|
ItemInfo: details.ItemInfo{
|
||||||
SharePoint: &details.SharePointInfo{
|
SharePoint: &details.SharePointInfo{
|
||||||
ItemType: details.SharePointLibrary,
|
ItemType: details.SharePointLibrary,
|
||||||
@ -268,7 +269,7 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
RepoRef: item2,
|
RepoRef: item2,
|
||||||
LocationRef: strings.Join(append([]string{"root:"}, itemElems2...), "/"),
|
LocationRef: strings.Join(append([]string{odConsts.RootPathDir}, itemElems2...), "/"),
|
||||||
// ItemRef intentionally blank to test fallback case
|
// ItemRef intentionally blank to test fallback case
|
||||||
ItemInfo: details.ItemInfo{
|
ItemInfo: details.ItemInfo{
|
||||||
SharePoint: &details.SharePointInfo{
|
SharePoint: &details.SharePointInfo{
|
||||||
@ -281,7 +282,7 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
|||||||
{
|
{
|
||||||
RepoRef: item3,
|
RepoRef: item3,
|
||||||
ItemRef: "item3",
|
ItemRef: "item3",
|
||||||
LocationRef: strings.Join(append([]string{"root:"}, itemElems3...), "/"),
|
LocationRef: strings.Join(append([]string{odConsts.RootPathDir}, itemElems3...), "/"),
|
||||||
ItemInfo: details.ItemInfo{
|
ItemInfo: details.ItemInfo{
|
||||||
SharePoint: &details.SharePointInfo{
|
SharePoint: &details.SharePointInfo{
|
||||||
ItemType: details.SharePointLibrary,
|
ItemType: details.SharePointLibrary,
|
||||||
@ -415,8 +416,15 @@ func (suite *SharePointSelectorSuite) TestSharePointCategory_PathValues() {
|
|||||||
itemName = "item"
|
itemName = "item"
|
||||||
itemID = "item-id"
|
itemID = "item-id"
|
||||||
shortRef = "short"
|
shortRef = "short"
|
||||||
driveElems = []string{"drives", "drive!id", "root:.d", "dir1.d", "dir2.d", itemID}
|
driveElems = []string{
|
||||||
elems = []string{"dir1", "dir2", itemID}
|
odConsts.DrivesPathDir,
|
||||||
|
"drive!id",
|
||||||
|
odConsts.RootPathDir + ".d",
|
||||||
|
"dir1.d",
|
||||||
|
"dir2.d",
|
||||||
|
itemID,
|
||||||
|
}
|
||||||
|
elems = []string{"dir1", "dir2", itemID}
|
||||||
)
|
)
|
||||||
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user