##// END OF EJS Templates
api: fixed tests and update docstrings.
marcink -
r2438:b3aeea31 default
parent child Browse files
Show More
@@ -68,7 +68,6 b' class TestGetRepo(object):'
68 followers.append(user.user.get_api_data(
68 followers.append(user.user.get_api_data(
69 include_secrets=expect_secrets))
69 include_secrets=expect_secrets))
70
70
71 ret['members'] = permissions
72 ret['permissions'] = permissions
71 ret['permissions'] = permissions
73 ret['followers'] = followers
72 ret['followers'] = followers
74
73
@@ -106,7 +105,6 b' class TestGetRepo(object):'
106 for user in repo.followers:
105 for user in repo.followers:
107 followers.append(user.user.get_api_data())
106 followers.append(user.user.get_api_data())
108
107
109 ret['members'] = permissions
110 ret['permissions'] = permissions
108 ret['permissions'] = permissions
111 ret['followers'] = followers
109 ret['followers'] = followers
112
110
@@ -41,7 +41,7 b' class TestApiGetRepoGroup(object):'
41
41
42 permissions = expected_permissions(repo_group)
42 permissions = expected_permissions(repo_group)
43
43
44 ret['members'] = permissions
44 ret['permissions'] = permissions
45 expected = ret
45 expected = ret
46 assert_ok(id_, expected, given=response.body)
46 assert_ok(id_, expected, given=response.body)
47
47
@@ -36,7 +36,9 b' class TestGetUser(object):'
36
36
37 usr = UserModel().get_by_username(TEST_USER_ADMIN_LOGIN)
37 usr = UserModel().get_by_username(TEST_USER_ADMIN_LOGIN)
38 ret = usr.get_api_data(include_secrets=True)
38 ret = usr.get_api_data(include_secrets=True)
39 ret['permissions'] = AuthUser(usr.user_id).permissions
39 permissions = AuthUser(usr.user_id).permissions
40 ret['permissions'] = permissions
41 ret['permissions_summary'] = permissions
40
42
41 expected = ret
43 expected = ret
42 assert_ok(id_, expected, given=response.body)
44 assert_ok(id_, expected, given=response.body)
@@ -54,7 +56,9 b' class TestGetUser(object):'
54
56
55 usr = UserModel().get_by_username(TEST_USER_ADMIN_LOGIN)
57 usr = UserModel().get_by_username(TEST_USER_ADMIN_LOGIN)
56 ret = usr.get_api_data(include_secrets=True)
58 ret = usr.get_api_data(include_secrets=True)
57 ret['permissions'] = AuthUser(usr.user_id).permissions
59 permissions = AuthUser(usr.user_id).permissions
60 ret['permissions'] = permissions
61 ret['permissions_summary'] = permissions
58
62
59 expected = ret
63 expected = ret
60 assert_ok(id_, expected, given=response.body)
64 assert_ok(id_, expected, given=response.body)
@@ -65,7 +69,9 b' class TestGetUser(object):'
65
69
66 usr = UserModel().get_by_username(self.TEST_USER_LOGIN)
70 usr = UserModel().get_by_username(self.TEST_USER_LOGIN)
67 ret = usr.get_api_data(include_secrets=True)
71 ret = usr.get_api_data(include_secrets=True)
68 ret['permissions'] = AuthUser(usr.user_id).permissions
72 permissions = AuthUser(usr.user_id).permissions
73 ret['permissions'] = permissions
74 ret['permissions_summary'] = permissions
69
75
70 expected = ret
76 expected = ret
71 assert_ok(id_, expected, given=response.body)
77 assert_ok(id_, expected, given=response.body)
@@ -38,7 +38,8 b' class TestGetUserGroups(object):'
38
38
39 permissions = expected_permissions(group)
39 permissions = expected_permissions(group)
40
40
41 ret['members'] = permissions
41 ret['permissions'] = permissions
42 ret['permissions_summary'] = response.json['result']['permissions_summary']
42 expected = ret
43 expected = ret
43 assert_ok(id_, expected, given=response.body)
44 assert_ok(id_, expected, given=response.body)
44
45
@@ -54,7 +55,8 b' class TestGetUserGroups(object):'
54
55
55 permissions = expected_permissions(group)
56 permissions = expected_permissions(group)
56
57
57 ret['members'] = permissions
58 ret['permissions'] = permissions
59 ret['permissions_summary'] = response.json['result']['permissions_summary']
58 expected = ret
60 expected = ret
59 assert_ok(id_, expected, given=response.body)
61 assert_ok(id_, expected, given=response.body)
60
62
@@ -127,26 +127,6 b' def get_repo(request, apiuser, repoid, c'
127 "lock_reason": null,
127 "lock_reason": null,
128 "locked_by": null,
128 "locked_by": null,
129 "locked_date": null,
129 "locked_date": null,
130 "members": [
131 {
132 "name": "super-admin-name",
133 "origin": "super-admin",
134 "permission": "repository.admin",
135 "type": "user"
136 },
137 {
138 "name": "owner-name",
139 "origin": "owner",
140 "permission": "repository.admin",
141 "type": "user"
142 },
143 {
144 "name": "user-group-name",
145 "origin": "permission",
146 "permission": "repository.write",
147 "type": "user_group"
148 }
149 ],
150 "owner": "owner-name",
130 "owner": "owner-name",
151 "permissions": [
131 "permissions": [
152 {
132 {
@@ -63,7 +63,7 b' def get_repo_group(request, apiuser, rep'
63 "group_description": "repo group description",
63 "group_description": "repo group description",
64 "group_id": 14,
64 "group_id": 14,
65 "group_name": "group name",
65 "group_name": "group name",
66 "members": [
66 "permissions": [
67 {
67 {
68 "name": "super-admin-username",
68 "name": "super-admin-username",
69 "origin": "super-admin",
69 "origin": "super-admin",
@@ -79,7 +79,8 b' def get_user(request, apiuser, userid=Op'
79 "last_login": "Timestamp",
79 "last_login": "Timestamp",
80 "last_activity": "Timestamp",
80 "last_activity": "Timestamp",
81 "lastname": "surnae",
81 "lastname": "surnae",
82 "permissions": {
82 "permissions": <deprecated>,
83 "permissions_summary": {
83 "global": [
84 "global": [
84 "hg.inherit_default_perms.true",
85 "hg.inherit_default_perms.true",
85 "usergroup.read",
86 "usergroup.read",
@@ -97,7 +98,7 b' def get_user(request, apiuser, userid=Op'
97 "repositories": { "username/example": "repository.write"},
98 "repositories": { "username/example": "repository.write"},
98 "repositories_groups": { "user-group/repo": "group.none" },
99 "repositories_groups": { "user-group/repo": "group.none" },
99 "user_groups": { "user_group_name": "usergroup.read" }
100 "user_groups": { "user_group_name": "usergroup.read" }
100 },
101 }
101 "user_id": 32,
102 "user_id": 32,
102 "username": "username"
103 "username": "username"
103 }
104 }
@@ -61,7 +61,7 b' def get_user_group(request, apiuser, use'
61 "active": true,
61 "active": true,
62 "group_description": "group description",
62 "group_description": "group description",
63 "group_name": "group name",
63 "group_name": "group name",
64 "members": [
64 "permissions": [
65 {
65 {
66 "name": "owner-name",
66 "name": "owner-name",
67 "origin": "owner",
67 "origin": "owner",
@@ -82,6 +82,12 b' def get_user_group(request, apiuser, use'
82 "type": "user_group"
82 "type": "user_group"
83 }
83 }
84 ],
84 ],
85 "permissions_summary": {
86 "repositories": {
87 "aa-root-level-repo-1": "repository.admin"
88 },
89 "repositories_groups": {}
90 },
85 "owner": "owner name",
91 "owner": "owner name",
86 "users": [],
92 "users": [],
87 "users_group_id": 2
93 "users_group_id": 2
@@ -120,7 +126,7 b' def get_user_group(request, apiuser, use'
120
126
121 data = user_group.get_api_data()
127 data = user_group.get_api_data()
122 data["permissions"] = permissions
128 data["permissions"] = permissions
123 data["Permissions_summary"] = UserGroupModel().get_perms_summary(
129 data["permissions_summary"] = UserGroupModel().get_perms_summary(
124 user_group.users_group_id)
130 user_group.users_group_id)
125 return data
131 return data
126
132
General Comments 0
You need to be logged in to leave comments. Login now