ignores accessRequest list templates from backup and restore (#4957)

ignores accessRequest list templates from backup and restore

#### Does this PR need a docs update or release note?
- [x]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
This commit is contained in:
Hitesh Pattanayak 2024-01-03 13:38:26 +05:30 committed by GitHub
parent e675ca13d7
commit 7a8c96964c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 12 deletions

View File

@ -109,7 +109,7 @@ func (suite *SharePointRestoreSuite) TestListCollection_Restore_invalidListTempl
suite.ac, suite.ac,
suite.siteID, suite.siteID,
suite.creds, suite.creds,
api.DocumentLibraryListTemplateName) api.DocumentLibraryListTemplate)
return lrh, destName, mockData return lrh, destName, mockData
}, },
@ -123,7 +123,7 @@ func (suite *SharePointRestoreSuite) TestListCollection_Restore_invalidListTempl
suite.ac, suite.ac,
suite.siteID, suite.siteID,
suite.creds, suite.creds,
api.WebTemplateExtensionsListTemplateName) api.WebTemplateExtensionsListTemplate)
return lrh, destName, mockData return lrh, destName, mockData
}, },

View File

@ -48,11 +48,12 @@ const (
ReadOnlyOrHiddenFieldNamePrefix = "_" ReadOnlyOrHiddenFieldNamePrefix = "_"
DescoratorFieldNamePrefix = "@" DescoratorFieldNamePrefix = "@"
WebTemplateExtensionsListTemplateName = "webTemplateExtensionsList" WebTemplateExtensionsListTemplate = "webTemplateExtensionsList"
// This issue https://github.com/alcionai/corso/issues/4932 // This issue https://github.com/alcionai/corso/issues/4932
// tracks to backup/restore supportability of `documentLibrary` templated lists // tracks to backup/restore supportability of `documentLibrary` templated lists
DocumentLibraryListTemplateName = "documentLibrary" DocumentLibraryListTemplate = "documentLibrary"
SharingLinksListTemplateName = "sharingLinks" SharingLinksListTemplate = "sharingLinks"
AccessRequestsListTemplate = "accessRequest"
) )
var addressFieldNames = []string{ var addressFieldNames = []string{
@ -88,9 +89,10 @@ var readOnlyFieldNames = keys.Set{
} }
var SkipListTemplates = keys.Set{ var SkipListTemplates = keys.Set{
WebTemplateExtensionsListTemplateName: {}, WebTemplateExtensionsListTemplate: {},
DocumentLibraryListTemplateName: {}, DocumentLibraryListTemplate: {},
SharingLinksListTemplateName: {}, SharingLinksListTemplate: {},
AccessRequestsListTemplate: {},
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@ -778,17 +778,22 @@ func (suite *ListsAPIIntgSuite) TestLists_PostList_invalidTemplate() {
}{ }{
{ {
name: "list with template documentLibrary", name: "list with template documentLibrary",
template: DocumentLibraryListTemplateName, template: DocumentLibraryListTemplate,
expect: assert.Error, expect: assert.Error,
}, },
{ {
name: "list with template webTemplateExtensionsList", name: "list with template webTemplateExtensionsList",
template: WebTemplateExtensionsListTemplateName, template: WebTemplateExtensionsListTemplate,
expect: assert.Error, expect: assert.Error,
}, },
{ {
name: "list with template sharingLinks", name: "list with template sharingLinks",
template: SharingLinksListTemplateName, template: SharingLinksListTemplate,
expect: assert.Error,
},
{
name: "list with template accessRequest",
template: AccessRequestsListTemplate,
expect: assert.Error, expect: assert.Error,
}, },
} }
@ -881,7 +886,7 @@ func getStoredListBytes(t *testing.T, template string) []byte {
defer writer.Close() defer writer.Close()
overrideListInfo := models.NewListInfo() overrideListInfo := models.NewListInfo()
overrideListInfo.SetTemplate(ptr.To(WebTemplateExtensionsListTemplateName)) overrideListInfo.SetTemplate(ptr.To(template))
_, list := getFieldsDataAndList() _, list := getFieldsDataAndList()
list.SetList(overrideListInfo) list.SetList(overrideListInfo)