audc-gerry 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +62 -0
- data/Rakefile +7 -0
- data/lib/gerry/api/access.rb +17 -0
- data/lib/gerry/api/accounts.rb +38 -0
- data/lib/gerry/api/branches.rb +45 -0
- data/lib/gerry/api/changes.rb +38 -0
- data/lib/gerry/api/groups.rb +72 -0
- data/lib/gerry/api/projects.rb +73 -0
- data/lib/gerry/api/request.rb +86 -0
- data/lib/gerry/client.rb +58 -0
- data/lib/gerry/version.rb +5 -0
- data/lib/gerry.rb +12 -0
- data/spec/access_spec.rb +15 -0
- data/spec/accounts_spec.rb +36 -0
- data/spec/branches_spec.rb +36 -0
- data/spec/changes_spec.rb +55 -0
- data/spec/fixtures/README.md.json +2 -0
- data/spec/fixtures/access_rights.json +250 -0
- data/spec/fixtures/account_groups.json +33 -0
- data/spec/fixtures/branch_access.json +50 -0
- data/spec/fixtures/capabilities.json +7 -0
- data/spec/fixtures/changes.json +31 -0
- data/spec/fixtures/changes_batch_0.json +18 -0
- data/spec/fixtures/changes_batch_1.json +18 -0
- data/spec/fixtures/changes_batch_2.json +17 -0
- data/spec/fixtures/group_members.json +15 -0
- data/spec/fixtures/groups.json +69 -0
- data/spec/fixtures/open_changes.json +17 -0
- data/spec/fixtures/project_branch.json +6 -0
- data/spec/fixtures/project_branches.json +21 -0
- data/spec/fixtures/project_head.json +2 -0
- data/spec/fixtures/projects.json +9 -0
- data/spec/fixtures/query_capabilities.json +5 -0
- data/spec/groups_spec.rb +92 -0
- data/spec/projects_spec.rb +90 -0
- data/spec/request_spec.rb +46 -0
- data/spec/spec_helper.rb +50 -0
- metadata +234 -0
@@ -0,0 +1,250 @@
|
|
1
|
+
)]}'
|
2
|
+
{
|
3
|
+
"All-Projects": {
|
4
|
+
"revision": "edd453d18e08640e67a8c9a150cec998ed0ac9aa",
|
5
|
+
"local": {
|
6
|
+
"GLOBAL_CAPABILITIES": {
|
7
|
+
"permissions": {
|
8
|
+
"priority": {
|
9
|
+
"rules": {
|
10
|
+
"15bfcd8a6de1a69c50b30cedcdcc951c15703152": {
|
11
|
+
"action": "BATCH"
|
12
|
+
}
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"streamEvents": {
|
16
|
+
"rules": {
|
17
|
+
"15bfcd8a6de1a69c50b30cedcdcc951c15703152": {
|
18
|
+
"action": "ALLOW"
|
19
|
+
}
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"administrateServer": {
|
23
|
+
"rules": {
|
24
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
25
|
+
"action": "ALLOW"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"refs/meta/config": {
|
32
|
+
"permissions": {
|
33
|
+
"submit": {
|
34
|
+
"rules": {
|
35
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
36
|
+
"action": "ALLOW"
|
37
|
+
},
|
38
|
+
"global:Project-Owners": {
|
39
|
+
"action": "ALLOW"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
},
|
43
|
+
"label-Code-Review": {
|
44
|
+
"label": "Code-Review",
|
45
|
+
"rules": {
|
46
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
47
|
+
"action": "ALLOW",
|
48
|
+
"min": -2,
|
49
|
+
"max": 2
|
50
|
+
},
|
51
|
+
"global:Project-Owners": {
|
52
|
+
"action": "ALLOW",
|
53
|
+
"min": -2,
|
54
|
+
"max": 2
|
55
|
+
}
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"read": {
|
59
|
+
"exclusive": true,
|
60
|
+
"rules": {
|
61
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
62
|
+
"action": "ALLOW"
|
63
|
+
},
|
64
|
+
"global:Project-Owners": {
|
65
|
+
"action": "ALLOW"
|
66
|
+
}
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"push": {
|
70
|
+
"rules": {
|
71
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
72
|
+
"action": "ALLOW"
|
73
|
+
},
|
74
|
+
"global:Project-Owners": {
|
75
|
+
"action": "ALLOW"
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
},
|
81
|
+
"refs/for/refs/*": {
|
82
|
+
"permissions": {
|
83
|
+
"pushMerge": {
|
84
|
+
"rules": {
|
85
|
+
"global:Registered-Users": {
|
86
|
+
"action": "ALLOW"
|
87
|
+
}
|
88
|
+
}
|
89
|
+
},
|
90
|
+
"push": {
|
91
|
+
"rules": {
|
92
|
+
"global:Registered-Users": {
|
93
|
+
"action": "ALLOW"
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
},
|
99
|
+
"refs/tags/*": {
|
100
|
+
"permissions": {
|
101
|
+
"pushSignedTag": {
|
102
|
+
"rules": {
|
103
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
104
|
+
"action": "ALLOW"
|
105
|
+
},
|
106
|
+
"global:Project-Owners": {
|
107
|
+
"action": "ALLOW"
|
108
|
+
}
|
109
|
+
}
|
110
|
+
},
|
111
|
+
"pushTag": {
|
112
|
+
"rules": {
|
113
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
114
|
+
"action": "ALLOW"
|
115
|
+
},
|
116
|
+
"global:Project-Owners": {
|
117
|
+
"action": "ALLOW"
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
},
|
123
|
+
"refs/heads/*": {
|
124
|
+
"permissions": {
|
125
|
+
"forgeCommitter": {
|
126
|
+
"rules": {
|
127
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
128
|
+
"action": "ALLOW"
|
129
|
+
},
|
130
|
+
"global:Project-Owners": {
|
131
|
+
"action": "ALLOW"
|
132
|
+
}
|
133
|
+
}
|
134
|
+
},
|
135
|
+
"forgeAuthor": {
|
136
|
+
"rules": {
|
137
|
+
"global:Registered-Users": {
|
138
|
+
"action": "ALLOW"
|
139
|
+
}
|
140
|
+
}
|
141
|
+
},
|
142
|
+
"submit": {
|
143
|
+
"rules": {
|
144
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
145
|
+
"action": "ALLOW"
|
146
|
+
},
|
147
|
+
"global:Project-Owners": {
|
148
|
+
"action": "ALLOW"
|
149
|
+
}
|
150
|
+
}
|
151
|
+
},
|
152
|
+
"editTopicName": {
|
153
|
+
"rules": {
|
154
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
155
|
+
"action": "ALLOW",
|
156
|
+
"force": true
|
157
|
+
},
|
158
|
+
"global:Project-Owners": {
|
159
|
+
"action": "ALLOW",
|
160
|
+
"force": true
|
161
|
+
}
|
162
|
+
}
|
163
|
+
},
|
164
|
+
"label-Code-Review": {
|
165
|
+
"label": "Code-Review",
|
166
|
+
"rules": {
|
167
|
+
"global:Registered-Users": {
|
168
|
+
"action": "ALLOW",
|
169
|
+
"min": -1,
|
170
|
+
"max": 1
|
171
|
+
},
|
172
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
173
|
+
"action": "ALLOW",
|
174
|
+
"min": -2,
|
175
|
+
"max": 2
|
176
|
+
},
|
177
|
+
"global:Project-Owners": {
|
178
|
+
"action": "ALLOW",
|
179
|
+
"min": -2,
|
180
|
+
"max": 2
|
181
|
+
}
|
182
|
+
}
|
183
|
+
},
|
184
|
+
"create": {
|
185
|
+
"rules": {
|
186
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
187
|
+
"action": "ALLOW"
|
188
|
+
},
|
189
|
+
"global:Project-Owners": {
|
190
|
+
"action": "ALLOW"
|
191
|
+
}
|
192
|
+
}
|
193
|
+
},
|
194
|
+
"push": {
|
195
|
+
"rules": {
|
196
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
197
|
+
"action": "ALLOW"
|
198
|
+
},
|
199
|
+
"global:Project-Owners": {
|
200
|
+
"action": "ALLOW"
|
201
|
+
}
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
},
|
206
|
+
"refs/*": {
|
207
|
+
"permissions": {
|
208
|
+
"read": {
|
209
|
+
"rules": {
|
210
|
+
"global:Anonymous-Users": {
|
211
|
+
"action": "ALLOW"
|
212
|
+
},
|
213
|
+
"53a4f647a89ea57992571187d8025f830625192a": {
|
214
|
+
"action": "ALLOW"
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}
|
220
|
+
},
|
221
|
+
"is_owner": true,
|
222
|
+
"owner_of": [
|
223
|
+
"GLOBAL_CAPABILITIES",
|
224
|
+
"refs/meta/config",
|
225
|
+
"refs/for/refs/*",
|
226
|
+
"refs/tags/*",
|
227
|
+
"refs/heads/*",
|
228
|
+
"refs/*"
|
229
|
+
],
|
230
|
+
"can_upload": true,
|
231
|
+
"can_add": true,
|
232
|
+
"config_visible": true
|
233
|
+
},
|
234
|
+
"MyProject": {
|
235
|
+
"revision": "61157ed63e14d261b6dca40650472a9b0bd88474",
|
236
|
+
"inherits_from": {
|
237
|
+
"id": "All-Projects",
|
238
|
+
"name": "All-Projects",
|
239
|
+
"description": "Access inherited by all other projects."
|
240
|
+
},
|
241
|
+
"local": {},
|
242
|
+
"is_owner": true,
|
243
|
+
"owner_of": [
|
244
|
+
"refs/*"
|
245
|
+
],
|
246
|
+
"can_upload": true,
|
247
|
+
"can_add": true,
|
248
|
+
"config_visible": true
|
249
|
+
}
|
250
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
)]}'
|
2
|
+
[
|
3
|
+
{
|
4
|
+
"kind": "gerritcodereview#group",
|
5
|
+
"id": "global%3AAnonymous-Users",
|
6
|
+
"url": "#/admin/groups/uuid-global%3AAnonymous-Users",
|
7
|
+
"options": {
|
8
|
+
},
|
9
|
+
"description": "Any user, signed-in or not",
|
10
|
+
"group_id": 2,
|
11
|
+
"owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"kind": "gerritcodereview#group",
|
15
|
+
"id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
|
16
|
+
"url": "#/admin/groups/uuid-834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
|
17
|
+
"options": {
|
18
|
+
"visible_to_all": true
|
19
|
+
},
|
20
|
+
"group_id": 6,
|
21
|
+
"owner_id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"kind": "gerritcodereview#group",
|
25
|
+
"id": "global%3ARegistered-Users",
|
26
|
+
"url": "#/admin/groups/uuid-global%3ARegistered-Users",
|
27
|
+
"options": {
|
28
|
+
},
|
29
|
+
"description": "Any signed-in user",
|
30
|
+
"group_id": 3,
|
31
|
+
"owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
|
32
|
+
}
|
33
|
+
]
|
@@ -0,0 +1,50 @@
|
|
1
|
+
)]}'
|
2
|
+
{
|
3
|
+
"revision": "61157ed63e14d261b6dca40650472a9b0bd88474",
|
4
|
+
"inherits_from": {
|
5
|
+
"id": "All-Projects",
|
6
|
+
"name": "All-Projects",
|
7
|
+
"description": "Access inherited by all other projects."
|
8
|
+
},
|
9
|
+
"local": {
|
10
|
+
"refs/*": {
|
11
|
+
"permissions": {
|
12
|
+
"read": {
|
13
|
+
"rules": {
|
14
|
+
"c2ce4749a32ceb82cd6adcce65b8216e12afb41c": {
|
15
|
+
"action": "ALLOW",
|
16
|
+
"force": false
|
17
|
+
},
|
18
|
+
"global:Anonymous-Users": {
|
19
|
+
"action": "ALLOW",
|
20
|
+
"force": false
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
},
|
27
|
+
"is_owner": true,
|
28
|
+
"owner_of": [
|
29
|
+
"refs/*"
|
30
|
+
],
|
31
|
+
"can_upload": true,
|
32
|
+
"can_add": true,
|
33
|
+
"config_visible": true,
|
34
|
+
"groups": {
|
35
|
+
"c2ce4749a32ceb82cd6adcce65b8216e12afb41c": {
|
36
|
+
"url": "#/admin/groups/uuid-c2ce4749a32ceb82cd6adcce65b8216e12afb41c",
|
37
|
+
"options": {},
|
38
|
+
"description": "Users who perform batch actions on Gerrit",
|
39
|
+
"group_id": 2,
|
40
|
+
"owner": "Administrators",
|
41
|
+
"owner_id": "d5b7124af4de52924ed397913e2c3b37bf186948",
|
42
|
+
"created_on": "2009-06-08 23:31:00.000000000",
|
43
|
+
"name": "Non-Interactive Users"
|
44
|
+
},
|
45
|
+
"global:Anonymous-Users": {
|
46
|
+
"options": {},
|
47
|
+
"name": "Anonymous Users"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
)]}'
|
2
|
+
[
|
3
|
+
{
|
4
|
+
"project": "awesome",
|
5
|
+
"branch": "master",
|
6
|
+
"id": "Idd8747a5ea93bb9bddf7695bab25670be135f777",
|
7
|
+
"subject": "Add an awesome feature",
|
8
|
+
"status": "NEW",
|
9
|
+
"created": "2012-09-12 15:54:21.531000000",
|
10
|
+
"updated": "2012-10-13 01:34:40.511000000",
|
11
|
+
"_sortkey": "00115dfe00009334",
|
12
|
+
"_number": 3,
|
13
|
+
"owner": {
|
14
|
+
"name": "The Duke"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"project": "clean",
|
19
|
+
"branch": "master",
|
20
|
+
"id": "Idac803deea68faa1294b3fa5bf814277e899f075",
|
21
|
+
"subject": "Refactor code",
|
22
|
+
"status": "NEW",
|
23
|
+
"created": "2012-09-12 15:51:30.605000000",
|
24
|
+
"updated": "2012-10-13 00:45:26.431000000",
|
25
|
+
"_sortkey": "00205dcddd00937d",
|
26
|
+
"_number": 42,
|
27
|
+
"owner": {
|
28
|
+
"name": "Batman"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
]
|
@@ -0,0 +1,18 @@
|
|
1
|
+
)]}'
|
2
|
+
[
|
3
|
+
{
|
4
|
+
"project": "awesome",
|
5
|
+
"branch": "master",
|
6
|
+
"id": "Idd8747a5ea93bb9bddf7695bab25670be135f777",
|
7
|
+
"subject": "Add an awesome feature",
|
8
|
+
"status": "NEW",
|
9
|
+
"created": "2012-09-12 15:54:21.531000000",
|
10
|
+
"updated": "2012-10-13 01:34:40.511000000",
|
11
|
+
"_sortkey": "00115dfe00009334",
|
12
|
+
"_number": 3,
|
13
|
+
"owner": {
|
14
|
+
"name": "The Duke"
|
15
|
+
},
|
16
|
+
"_more_changes": true
|
17
|
+
}
|
18
|
+
]
|
@@ -0,0 +1,18 @@
|
|
1
|
+
)]}'
|
2
|
+
[
|
3
|
+
{
|
4
|
+
"project": "clean",
|
5
|
+
"branch": "master",
|
6
|
+
"id": "Idac803deea68faa1294b3fa5bf814277e899f075",
|
7
|
+
"subject": "Refactor code",
|
8
|
+
"status": "NEW",
|
9
|
+
"created": "2012-09-12 15:51:30.605000000",
|
10
|
+
"updated": "2012-10-13 00:45:26.431000000",
|
11
|
+
"_sortkey": "00205dcddd00937d",
|
12
|
+
"_number": 42,
|
13
|
+
"owner": {
|
14
|
+
"name": "Batman"
|
15
|
+
},
|
16
|
+
"_more_changes": true
|
17
|
+
}
|
18
|
+
]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
)]}'
|
2
|
+
[
|
3
|
+
{
|
4
|
+
"project": "X",
|
5
|
+
"branch": "default",
|
6
|
+
"id": "Ieb185f4da8725ae35e9f940e614c6eaa7b88eff5",
|
7
|
+
"subject": "Remove unused imports",
|
8
|
+
"status": "NEW",
|
9
|
+
"created": "2016-01-11 15:51:30.605000000",
|
10
|
+
"updated": "2016-02-12 00:45:26.431000000",
|
11
|
+
"_sortkey": "002e4203000187d5",
|
12
|
+
"_number": 4711,
|
13
|
+
"owner": {
|
14
|
+
"name": "Bill"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
]
|
@@ -0,0 +1,69 @@
|
|
1
|
+
)]}'
|
2
|
+
{
|
3
|
+
"Administrators": {
|
4
|
+
"kind": "gerritcodereview#group",
|
5
|
+
"id": "6a1e70e1a88782771a91808c8af9bbb7a9871389",
|
6
|
+
"url": "#/admin/groups/uuid-6a1e70e1a88782771a91808c8af9bbb7a9871389",
|
7
|
+
"options": {
|
8
|
+
},
|
9
|
+
"description": "Gerrit Site Administrators",
|
10
|
+
"group_id": 1,
|
11
|
+
"owner": "Administrators",
|
12
|
+
"owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
|
13
|
+
},
|
14
|
+
"Anonymous Users": {
|
15
|
+
"kind": "gerritcodereview#group",
|
16
|
+
"id": "global%3AAnonymous-Users",
|
17
|
+
"url": "#/admin/groups/uuid-global%3AAnonymous-Users",
|
18
|
+
"options": {
|
19
|
+
},
|
20
|
+
"description": "Any user, signed-in or not",
|
21
|
+
"group_id": 2,
|
22
|
+
"owner": "Administrators",
|
23
|
+
"owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
|
24
|
+
},
|
25
|
+
"MyProject_Committers": {
|
26
|
+
"kind": "gerritcodereview#group",
|
27
|
+
"id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
|
28
|
+
"url": "#/admin/groups/uuid-834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7",
|
29
|
+
"options": {
|
30
|
+
"visible_to_all": true
|
31
|
+
},
|
32
|
+
"group_id": 6,
|
33
|
+
"owner": "MyProject_Committers",
|
34
|
+
"owner_id": "834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7"
|
35
|
+
},
|
36
|
+
"Non-Interactive Users": {
|
37
|
+
"kind": "gerritcodereview#group",
|
38
|
+
"id": "5057f3cbd3519d6ab69364429a89ffdffba50f73",
|
39
|
+
"url": "#/admin/groups/uuid-5057f3cbd3519d6ab69364429a89ffdffba50f73",
|
40
|
+
"options": {
|
41
|
+
},
|
42
|
+
"description": "Users who perform batch actions on Gerrit",
|
43
|
+
"group_id": 4,
|
44
|
+
"owner": "Administrators",
|
45
|
+
"owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
|
46
|
+
},
|
47
|
+
"Project Owners": {
|
48
|
+
"kind": "gerritcodereview#group",
|
49
|
+
"id": "global%3AProject-Owners",
|
50
|
+
"url": "#/admin/groups/uuid-global%3AProject-Owners",
|
51
|
+
"options": {
|
52
|
+
},
|
53
|
+
"description": "Any owner of the project",
|
54
|
+
"group_id": 5,
|
55
|
+
"owner": "Administrators",
|
56
|
+
"owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
|
57
|
+
},
|
58
|
+
"Registered Users": {
|
59
|
+
"kind": "gerritcodereview#group",
|
60
|
+
"id": "global%3ARegistered-Users",
|
61
|
+
"url": "#/admin/groups/uuid-global%3ARegistered-Users",
|
62
|
+
"options": {
|
63
|
+
},
|
64
|
+
"description": "Any signed-in user",
|
65
|
+
"group_id": 3,
|
66
|
+
"owner": "Administrators",
|
67
|
+
"owner_id": "6a1e70e1a88782771a91808c8af9bbb7a9871389"
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
)]}'
|
2
|
+
[
|
3
|
+
{
|
4
|
+
"project": "awesome",
|
5
|
+
"branch": "master",
|
6
|
+
"id": "Idd8747a5ea93bb9bddf7695bab25670be135f777",
|
7
|
+
"subject": "Add an awesome feature",
|
8
|
+
"status": "OPEN",
|
9
|
+
"created": "2012-09-12 15:54:21.531000000",
|
10
|
+
"updated": "2012-10-13 01:34:40.511000000",
|
11
|
+
"_sortkey": "00115dfe00009334",
|
12
|
+
"_number": 3,
|
13
|
+
"owner": {
|
14
|
+
"name": "The Duke"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
)]}'
|
2
|
+
[
|
3
|
+
{
|
4
|
+
"ref": "master",
|
5
|
+
"revision": "b3f3113",
|
6
|
+
"can_delete": "yes",
|
7
|
+
"web_lnks": "ab"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"ref": "develop",
|
11
|
+
"revision": "b3f3114",
|
12
|
+
"can_delete": "yes",
|
13
|
+
"web_lnks": "ab"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"ref": "stage",
|
17
|
+
"revision": "b3f3114",
|
18
|
+
"can_delete": "yes",
|
19
|
+
"web_lnks": "ab"
|
20
|
+
}
|
21
|
+
]
|
data/spec/groups_spec.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe '.list_groups' do
|
4
|
+
it 'fetchs all groups' do
|
5
|
+
stub = stub_get('/groups/', 'groups.json')
|
6
|
+
|
7
|
+
client = MockGerry.new
|
8
|
+
groups = client.groups
|
9
|
+
expect(stub).to have_been_requested
|
10
|
+
|
11
|
+
expect(groups.size).to eq(6)
|
12
|
+
expect(groups).to include('Project Owners')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.group_members' do
|
17
|
+
it "fetchs all members of the specified group" do
|
18
|
+
stub = stub_get('/groups/834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7/members/', 'group_members.json')
|
19
|
+
|
20
|
+
client = MockGerry.new
|
21
|
+
group_members = client.group_members('834ec36dd5e0ed21a2ff5d7e2255da082d63bbd7')
|
22
|
+
expect(stub).to have_been_requested
|
23
|
+
|
24
|
+
expect(group_members.size).to eq(2)
|
25
|
+
expect(group_members[1]['email']).to eq('john.doe@example.com')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '.create_group' do
|
30
|
+
let(:name) { "my_new_group_name" }
|
31
|
+
let(:description) { "group description" }
|
32
|
+
let(:visible) { true }
|
33
|
+
let(:owner_id) { nil }
|
34
|
+
|
35
|
+
it "creates a group" do
|
36
|
+
input = {
|
37
|
+
description: description,
|
38
|
+
visible_to_all: visible
|
39
|
+
}
|
40
|
+
|
41
|
+
response = %Q<)]}'
|
42
|
+
{
|
43
|
+
"kind": "gerritcodereview#group",
|
44
|
+
"id": "9999c971bb4ab872aab759d8c49833ee6b9ff320",
|
45
|
+
"name": "#{name}",
|
46
|
+
"url": "#/admin/groups/uuid-9999c971bb4ab872aab759d8c49833ee6b9ff320",
|
47
|
+
"options": {
|
48
|
+
"visible_to_all": true
|
49
|
+
},
|
50
|
+
"description":"#{description}",
|
51
|
+
"group_id": 551,
|
52
|
+
"owner": "#{name}",
|
53
|
+
"owner_id": "9999c971bb4ab872aab759d8c49833ee6b9ff320"
|
54
|
+
}
|
55
|
+
>
|
56
|
+
stub = stub_put('/groups/my_new_group_name', input.to_json, response)
|
57
|
+
|
58
|
+
client = MockGerry.new
|
59
|
+
new_group = client.create_group(name, description, visible, owner_id)
|
60
|
+
expect(stub).to have_been_requested
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe '.add_to_group' do
|
65
|
+
it "adds users to a group" do
|
66
|
+
users = %w(jane.roe@example.com john.doe@example.com)
|
67
|
+
group_id = "9999c971bb4ab872aab759d8c49833ee6b9ff320"
|
68
|
+
input = {
|
69
|
+
members: users
|
70
|
+
}
|
71
|
+
stub = stub_post("/groups/#{group_id}/members", input.to_json, get_fixture('group_members.json'))
|
72
|
+
|
73
|
+
client = MockGerry.new
|
74
|
+
new_group = client.add_to_group(group_id, users)
|
75
|
+
expect(stub).to have_been_requested
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '.remove_from_group' do
|
80
|
+
it "removes users from a group" do
|
81
|
+
users = %w(jane.roe@example.com john.doe@example.com)
|
82
|
+
group_id = "9999c971bb4ab872aab759d8c49833ee6b9ff320"
|
83
|
+
input = {
|
84
|
+
members: users
|
85
|
+
}
|
86
|
+
stub = stub_post("/groups/#{group_id}/members.delete", input.to_json, "")
|
87
|
+
|
88
|
+
client = MockGerry.new
|
89
|
+
new_group = client.remove_from_group(group_id, users)
|
90
|
+
expect(stub).to have_been_requested
|
91
|
+
end
|
92
|
+
end
|