From 2c9dab3e7ca160107ea42080144da7e2f684896e Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Tue, 10 Sep 2024 12:17:25 +0200 Subject: [PATCH] tests: adapt test expectations --- services/graph/pkg/command/unified_roles.go | 25 ++++++++++++++++--- .../apiGraph/roleManagementEndpoint.feature | 2 +- .../apiSharingNg1/listPermissions.feature | 12 ++++----- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/services/graph/pkg/command/unified_roles.go b/services/graph/pkg/command/unified_roles.go index b9e875a68..ee31e5cb7 100644 --- a/services/graph/pkg/command/unified_roles.go +++ b/services/graph/pkg/command/unified_roles.go @@ -14,6 +14,23 @@ import ( "github.com/owncloud/ocis/v2/services/graph/pkg/unifiedrole" ) +var ( + unifiedRolesNames = map[string]string{ + unifiedrole.UnifiedRoleViewerID: "Viewer", + unifiedrole.UnifiedRoleViewerListGrantsID: "ViewerListGrants", + unifiedrole.UnifiedRoleSpaceViewerID: "SpaceViewer", + unifiedrole.UnifiedRoleEditorID: "Editor", + unifiedrole.UnifiedRoleEditorListGrantsID: "EditorListGrants", + unifiedrole.UnifiedRoleSpaceEditorID: "SpaceEditor", + unifiedrole.UnifiedRoleSpaceEditorWithoutVersionsID: "SpaceEditorWithoutVersions", + unifiedrole.UnifiedRoleFileEditorID: "FileEditor", + unifiedrole.UnifiedRoleFileEditorListGrantsID: "FileEditorListGrants", + unifiedrole.UnifiedRoleEditorLiteID: "EditorLite", + unifiedrole.UnifiedRoleManagerID: "SpaceManager", + unifiedrole.UnifiedRoleSecureViewerID: "SecureViewer", + } +) + // UnifiedRoles bundles available commands for unified roles func UnifiedRoles(cfg *config.Config) cli.Commands { cmds := cli.Commands{ @@ -41,7 +58,7 @@ func listUnifiedRoles(cfg *config.Config) *cli.Command { tbl.SetRowLine(true) tbl.SetAutoMergeCellsByColumnIndex([]int{0}) // rowspan should only affect the first column - headers := []string{"UID", "Enabled", "Description", "Condition", "Allowed resource actions"} + headers := []string{"Name", "UID", "Enabled", "Description", "Condition", "Allowed resource actions"} tbl.SetHeader(headers) for _, definition := range unifiedrole.GetRoles(unifiedrole.RoleFilterAll()) { @@ -49,10 +66,10 @@ func listUnifiedRoles(cfg *config.Config) *cli.Command { const disabled = "disabled" rows := [][]string{ - {definition.GetId(), disabled, definition.GetDescription()}, + {unifiedRolesNames[definition.GetId()], definition.GetId(), disabled, definition.GetDescription()}, } if slices.Contains(cfg.UnifiedRoles.AvailableRoles, definition.GetId()) { - rows[0][1] = enabled + rows[0][2] = enabled } for i, rolePermission := range definition.GetRolePermissions() { @@ -62,7 +79,7 @@ func listUnifiedRoles(cfg *config.Config) *cli.Command { case 0: rows[0] = append(rows[0], row...) default: - rows[0][3] = rows[0][3] + "\n" + rolePermission.GetCondition() + rows[0][4] = rows[0][4] + "\n" + rolePermission.GetCondition() } } diff --git a/tests/acceptance/features/apiGraph/roleManagementEndpoint.feature b/tests/acceptance/features/apiGraph/roleManagementEndpoint.feature index 876130687..8926ebbbe 100644 --- a/tests/acceptance/features/apiGraph/roleManagementEndpoint.feature +++ b/tests/acceptance/features/apiGraph/roleManagementEndpoint.feature @@ -296,7 +296,7 @@ Feature: permissions role definitions "const": 0 }, "description": { - "const": "View, download, upload, edit, add and delete." + "const": "View, download, upload, edit, add, delete including the history." }, "displayName": { "const": "Can edit" diff --git a/tests/acceptance/features/apiSharingNg1/listPermissions.feature b/tests/acceptance/features/apiSharingNg1/listPermissions.feature index 8ba952f49..709824f47 100644 --- a/tests/acceptance/features/apiSharingNg1/listPermissions.feature +++ b/tests/acceptance/features/apiSharingNg1/listPermissions.feature @@ -283,7 +283,7 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "View, download, upload, edit, add and delete." + "const": "View, download, upload, edit, add, delete including the history." }, "displayName": { "const": "Can edit" @@ -416,7 +416,7 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "View, download, upload, edit, add and delete." + "const": "View, download, upload, edit, add, delete including the history." }, "displayName": { "const": "Can edit" @@ -1104,7 +1104,7 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "View, download, upload, edit, add and delete." + "const": "View, download, upload, edit, add, delete including the history." }, "displayName": { "const": "Can edit" @@ -1226,7 +1226,7 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "View, download, upload, edit, add and delete." + "const": "View, download, upload, edit, add, delete including the history." }, "displayName": { "const": "Can edit" @@ -1508,7 +1508,7 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "View, download, upload, edit, add and delete." + "const": "View, download, upload, edit, add, delete including the history." }, "displayName": { "const": "Can edit" @@ -1846,7 +1846,7 @@ Feature: List a sharing permissions "const": 2 }, "description": { - "const": "View, download, upload, edit, add and delete." + "const": "View, download, upload, edit, add, delete including the history." }, "displayName": { "const": "Can edit"