[BUG FIX]: CLI: Details: Sharepoint (#2222)
## Description Enabling backup commands for `SharePoint.Pages` in #2216 introduced failures when `backup details()` called in Corso. Test suite updated ## Does this PR need a docs update or release note? - [x] ⛔ No ## Type of change - [x] 🐛 Bugfix ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * related to #2216<issue> * related to #2173 ## Test Plan <!-- How will this be tested prior to merging.--> - [x] ⚡ Unit test
This commit is contained in:
parent
e828209a30
commit
42133ffc7d
@ -224,7 +224,7 @@ func (s *sharePoint) AllData() []SharePointScope {
|
||||
scopes,
|
||||
makeScope[SharePointScope](SharePointLibrary, Any()),
|
||||
makeScope[SharePointScope](SharePointList, Any()),
|
||||
makeScope[SharePointScope](SharePointPage, Any()),
|
||||
makeScope[SharePointScope](SharePointPageFolder, Any()),
|
||||
)
|
||||
|
||||
return scopes
|
||||
@ -323,7 +323,7 @@ func (s *sharePoint) PageItems(pages, items []string, opts ...option) []SharePoi
|
||||
scopes = append(
|
||||
scopes,
|
||||
makeScope[SharePointScope](SharePointPage, items).
|
||||
set(SharePointPage, pages, opts...),
|
||||
set(SharePointPageFolder, pages, opts...),
|
||||
)
|
||||
|
||||
return scopes
|
||||
|
||||
@ -193,9 +193,13 @@ func (suite *SharePointSelectorSuite) TestToSharePointRestore() {
|
||||
|
||||
func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
||||
var (
|
||||
item = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderA/folderB", "item")
|
||||
item2 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderA/folderC", "item2")
|
||||
item3 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderD/folderE", "item3")
|
||||
pairAC = "folderA/folderC"
|
||||
pairGH = "folderG/folderH"
|
||||
item = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderA/folderB", "item")
|
||||
item2 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", pairAC, "item2")
|
||||
item3 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderD/folderE", "item3")
|
||||
item4 = stubRepoRef(path.SharePointService, path.PagesCategory, "sid", pairGH, "item4")
|
||||
item5 = stubRepoRef(path.SharePointService, path.PagesCategory, "sid", pairGH, "item5")
|
||||
)
|
||||
|
||||
deets := &details.Details{
|
||||
@ -225,6 +229,22 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
RepoRef: item4,
|
||||
ItemInfo: details.ItemInfo{
|
||||
SharePoint: &details.SharePointInfo{
|
||||
ItemType: details.SharePointItem,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
RepoRef: item5,
|
||||
ItemInfo: details.ItemInfo{
|
||||
SharePoint: &details.SharePointInfo{
|
||||
ItemType: details.SharePointItem,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -247,7 +267,7 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
||||
odr.Include(odr.AllData())
|
||||
return odr
|
||||
},
|
||||
expect: arr(item, item2, item3),
|
||||
expect: arr(item, item2, item3, item4, item5),
|
||||
},
|
||||
{
|
||||
name: "only match item",
|
||||
@ -264,11 +284,21 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() {
|
||||
deets: deets,
|
||||
makeSelector: func() *SharePointRestore {
|
||||
odr := NewSharePointRestore([]string{"sid"})
|
||||
odr.Include(odr.Libraries([]string{"folderA/folderB", "folderA/folderC"}))
|
||||
odr.Include(odr.Libraries([]string{"folderA/folderB", pairAC}))
|
||||
return odr
|
||||
},
|
||||
expect: arr(item, item2),
|
||||
},
|
||||
{
|
||||
name: "pages match folder",
|
||||
deets: deets,
|
||||
makeSelector: func() *SharePointRestore {
|
||||
odr := NewSharePointRestore([]string{"sid"})
|
||||
odr.Include(odr.Pages([]string{pairGH, pairAC}))
|
||||
return odr
|
||||
},
|
||||
expect: arr(item4, item5),
|
||||
},
|
||||
}
|
||||
for _, test := range table {
|
||||
suite.T().Run(test.name, func(t *testing.T) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user