Compare commits

...

2 Commits

Author SHA1 Message Date
hiteshrepo
fcdcafbb2e fix TestLists_PostList test 2024-01-11 00:00:07 +05:30
hiteshrepo
e3925732a7 adds error for list name exists 2024-01-10 19:59:19 +05:30
2 changed files with 8 additions and 0 deletions

View File

@ -131,6 +131,8 @@ var (
ErrResourceLocked = clues.New("resource has been locked and must be unlocked by an administrator")
ErrTokenExpired = clues.New("jwt token expired")
ErrNameAlreadyExistsConflict = clues.New("Name already exists")
)
func IsErrApplicationThrottled(err error) bool {
@ -241,6 +243,11 @@ func IsErrItemAlreadyExistsConflict(err error) bool {
parseODataErr(err).hasErrorCode(err, nameAlreadyExists)
}
func IsErrNameAlreadyExistsConflict(err error) bool {
return errors.Is(err, ErrNameAlreadyExistsConflict) ||
parseODataErr(err).hasErrorCode(err, nameAlreadyExists)
}
// LabelStatus transforms the provided statusCode into
// a standard label that can be attached to a clues error
// and later reviewed when checking error statuses.

View File

@ -758,6 +758,7 @@ func (suite *ListsAPIIntgSuite) TestLists_PostList() {
_, err = acl.PostList(ctx, siteID, listName, oldListByteArray, fault.New(true))
require.Error(t, err)
assert.True(t, graph.IsErrNameAlreadyExistsConflict(err))
newListItems := newList.GetItems()
require.Less(t, 0, len(newListItems))