Show More
@@ -66,7 +66,7 b' class TestGrantUserGroupPermission(objec' | |||
|
66 | 66 | perm=perm) |
|
67 | 67 | response = api_call(self.app, params) |
|
68 | 68 | |
|
69 | expected = 'permission `%s` does not exist' % (perm,) | |
|
69 | expected = 'permission `%s` does not exist.' % (perm,) | |
|
70 | 70 | assert_error(id_, expected, given=response.body) |
|
71 | 71 | |
|
72 | 72 | @mock.patch.object(RepoModel, 'grant_user_group_permission', crash) |
@@ -132,8 +132,7 b' class TestGrantUserGroupPermissionFromRe' | |||
|
132 | 132 | RepoGroupModel().revoke_user_group_permission( |
|
133 | 133 | repo_group.group_id, user_group.users_group_id) |
|
134 | 134 | else: |
|
135 | expected = 'repository group `%s` does not exist' % ( | |
|
136 | repo_group.name,) | |
|
135 | expected = 'repository group `%s` does not exist' % (repo_group.name,) | |
|
137 | 136 | assert_error(id_, expected, given=response.body) |
|
138 | 137 | |
|
139 | 138 | def test_api_grant_user_group_permission_to_repo_group_wrong_permission( |
@@ -149,7 +148,7 b' class TestGrantUserGroupPermissionFromRe' | |||
|
149 | 148 | perm=perm) |
|
150 | 149 | response = api_call(self.app, params) |
|
151 | 150 | |
|
152 | expected = 'permission `%s` does not exist' % (perm,) | |
|
151 | expected = 'permission `%s` does not exist. Permission should start with prefix: `group.`' % (perm,) | |
|
153 | 152 | assert_error(id_, expected, given=response.body) |
|
154 | 153 | |
|
155 | 154 | @mock.patch.object(RepoGroupModel, 'grant_user_group_permission', crash) |
@@ -65,7 +65,7 b' class TestGrantUserPermission(object):' | |||
|
65 | 65 | perm=perm) |
|
66 | 66 | response = api_call(self.app, params) |
|
67 | 67 | |
|
68 | expected = 'permission `%s` does not exist' % (perm,) | |
|
68 | expected = 'permission `%s` does not exist.' % (perm,) | |
|
69 | 69 | assert_error(id_, expected, given=response.body) |
|
70 | 70 | |
|
71 | 71 | @mock.patch.object(RepoModel, 'grant_user_permission', crash) |
@@ -132,7 +132,7 b' class TestGrantUserPermissionFromRepoGro' | |||
|
132 | 132 | perm=perm) |
|
133 | 133 | response = api_call(self.app, params) |
|
134 | 134 | |
|
135 | expected = 'permission `%s` does not exist' % (perm,) | |
|
135 | expected = 'permission `%s` does not exist. Permission should start with prefix: `group.`' % (perm,) | |
|
136 | 136 | assert_error(id_, expected, given=response.body) |
|
137 | 137 | |
|
138 | 138 | @mock.patch.object(RepoGroupModel, 'grant_user_permission', crash) |
@@ -130,7 +130,7 b' class TestGrantUserPermissionFromUserGro' | |||
|
130 | 130 | perm=perm) |
|
131 | 131 | response = api_call(self.app, params) |
|
132 | 132 | |
|
133 | expected = 'permission `%s` does not exist' % perm | |
|
133 | expected = 'permission `%s` does not exist. Permission should start with prefix: `usergroup.`' % perm | |
|
134 | 134 | assert_error(id_, expected, given=response.body) |
|
135 | 135 | |
|
136 | 136 | def test_api_grant_user_permission_to_user_group_exception_when_adding( |
@@ -308,7 +308,11 b' def get_perm_or_error(permid, prefix=Non' | |||
|
308 | 308 | |
|
309 | 309 | perm = PermissionModel.cls.get_by_key(permid) |
|
310 | 310 | if perm is None: |
|
311 |
|
|
|
311 | msg = 'permission `{}` does not exist.'.format(permid) | |
|
312 | if prefix: | |
|
313 | msg += ' Permission should start with prefix: `{}`'.format(prefix) | |
|
314 | raise JSONRPCError(msg) | |
|
315 | ||
|
312 | 316 | if prefix: |
|
313 | 317 | if not perm.permission_name.startswith(prefix): |
|
314 | 318 | raise JSONRPCError('permission `%s` is invalid, ' |
General Comments 0
You need to be logged in to leave comments.
Login now