OLD | NEW |
1 library googleapis.sourcerepo.v1.test; | 1 library googleapis.sourcerepo.v1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | 4 import "dart:async" as async; |
6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
7 | 6 |
8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
11 | 9 |
12 import 'package:googleapis/sourcerepo/v1.dart' as api; | 10 import 'package:googleapis/sourcerepo/v1.dart' as api; |
13 | 11 |
14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
15 core.Function _callback; | 13 core.Function _callback; |
16 core.bool _expectJson; | 14 core.bool _expectJson; |
17 | 15 |
18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
19 _callback = callback; | 17 _callback = callback; |
20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
21 } | 19 } |
22 | 20 |
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
24 if (_expectJson) { | 22 if (_expectJson) { |
25 return request.finalize() | 23 return request |
| 24 .finalize() |
26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
27 .join('') | 26 .join('') |
28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
30 return _callback(request, null); | 29 return _callback(request, null); |
31 } else { | 30 } else { |
32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
33 } | 32 } |
34 }); | 33 }); |
35 } else { | 34 } else { |
36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
37 if (stream == null) { | 36 if (stream == null) { |
38 return _callback(request, []); | 37 return _callback(request, []); |
39 } else { | 38 } else { |
40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
41 return _callback(request, data); | 40 return _callback(request, data); |
42 }); | 41 }); |
43 } | 42 } |
44 } | 43 } |
45 } | 44 } |
46 } | 45 } |
47 | 46 |
48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 51 } |
53 | 52 |
54 buildUnnamed496() { | 53 buildUnnamed495() { |
55 var o = new core.List<api.AuditLogConfig>(); | 54 var o = new core.List<api.AuditLogConfig>(); |
56 o.add(buildAuditLogConfig()); | 55 o.add(buildAuditLogConfig()); |
57 o.add(buildAuditLogConfig()); | 56 o.add(buildAuditLogConfig()); |
58 return o; | 57 return o; |
59 } | 58 } |
60 | 59 |
61 checkUnnamed496(core.List<api.AuditLogConfig> o) { | 60 checkUnnamed495(core.List<api.AuditLogConfig> o) { |
62 unittest.expect(o, unittest.hasLength(2)); | 61 unittest.expect(o, unittest.hasLength(2)); |
63 checkAuditLogConfig(o[0]); | 62 checkAuditLogConfig(o[0]); |
64 checkAuditLogConfig(o[1]); | 63 checkAuditLogConfig(o[1]); |
65 } | 64 } |
66 | 65 |
67 buildUnnamed497() { | 66 buildUnnamed496() { |
68 var o = new core.List<core.String>(); | 67 var o = new core.List<core.String>(); |
69 o.add("foo"); | 68 o.add("foo"); |
70 o.add("foo"); | 69 o.add("foo"); |
71 return o; | 70 return o; |
72 } | 71 } |
73 | 72 |
74 checkUnnamed497(core.List<core.String> o) { | 73 checkUnnamed496(core.List<core.String> o) { |
75 unittest.expect(o, unittest.hasLength(2)); | 74 unittest.expect(o, unittest.hasLength(2)); |
76 unittest.expect(o[0], unittest.equals('foo')); | 75 unittest.expect(o[0], unittest.equals('foo')); |
77 unittest.expect(o[1], unittest.equals('foo')); | 76 unittest.expect(o[1], unittest.equals('foo')); |
78 } | 77 } |
79 | 78 |
80 core.int buildCounterAuditConfig = 0; | 79 core.int buildCounterAuditConfig = 0; |
81 buildAuditConfig() { | 80 buildAuditConfig() { |
82 var o = new api.AuditConfig(); | 81 var o = new api.AuditConfig(); |
83 buildCounterAuditConfig++; | 82 buildCounterAuditConfig++; |
84 if (buildCounterAuditConfig < 3) { | 83 if (buildCounterAuditConfig < 3) { |
85 o.auditLogConfigs = buildUnnamed496(); | 84 o.auditLogConfigs = buildUnnamed495(); |
86 o.exemptedMembers = buildUnnamed497(); | 85 o.exemptedMembers = buildUnnamed496(); |
87 o.service = "foo"; | 86 o.service = "foo"; |
88 } | 87 } |
89 buildCounterAuditConfig--; | 88 buildCounterAuditConfig--; |
90 return o; | 89 return o; |
91 } | 90 } |
92 | 91 |
93 checkAuditConfig(api.AuditConfig o) { | 92 checkAuditConfig(api.AuditConfig o) { |
94 buildCounterAuditConfig++; | 93 buildCounterAuditConfig++; |
95 if (buildCounterAuditConfig < 3) { | 94 if (buildCounterAuditConfig < 3) { |
96 checkUnnamed496(o.auditLogConfigs); | 95 checkUnnamed495(o.auditLogConfigs); |
97 checkUnnamed497(o.exemptedMembers); | 96 checkUnnamed496(o.exemptedMembers); |
98 unittest.expect(o.service, unittest.equals('foo')); | 97 unittest.expect(o.service, unittest.equals('foo')); |
99 } | 98 } |
100 buildCounterAuditConfig--; | 99 buildCounterAuditConfig--; |
101 } | 100 } |
102 | 101 |
103 buildUnnamed498() { | 102 buildUnnamed497() { |
104 var o = new core.List<core.String>(); | 103 var o = new core.List<core.String>(); |
105 o.add("foo"); | 104 o.add("foo"); |
106 o.add("foo"); | 105 o.add("foo"); |
107 return o; | 106 return o; |
108 } | 107 } |
109 | 108 |
110 checkUnnamed498(core.List<core.String> o) { | 109 checkUnnamed497(core.List<core.String> o) { |
111 unittest.expect(o, unittest.hasLength(2)); | 110 unittest.expect(o, unittest.hasLength(2)); |
112 unittest.expect(o[0], unittest.equals('foo')); | 111 unittest.expect(o[0], unittest.equals('foo')); |
113 unittest.expect(o[1], unittest.equals('foo')); | 112 unittest.expect(o[1], unittest.equals('foo')); |
114 } | 113 } |
115 | 114 |
116 core.int buildCounterAuditLogConfig = 0; | 115 core.int buildCounterAuditLogConfig = 0; |
117 buildAuditLogConfig() { | 116 buildAuditLogConfig() { |
118 var o = new api.AuditLogConfig(); | 117 var o = new api.AuditLogConfig(); |
119 buildCounterAuditLogConfig++; | 118 buildCounterAuditLogConfig++; |
120 if (buildCounterAuditLogConfig < 3) { | 119 if (buildCounterAuditLogConfig < 3) { |
121 o.exemptedMembers = buildUnnamed498(); | 120 o.exemptedMembers = buildUnnamed497(); |
122 o.logType = "foo"; | 121 o.logType = "foo"; |
123 } | 122 } |
124 buildCounterAuditLogConfig--; | 123 buildCounterAuditLogConfig--; |
125 return o; | 124 return o; |
126 } | 125 } |
127 | 126 |
128 checkAuditLogConfig(api.AuditLogConfig o) { | 127 checkAuditLogConfig(api.AuditLogConfig o) { |
129 buildCounterAuditLogConfig++; | 128 buildCounterAuditLogConfig++; |
130 if (buildCounterAuditLogConfig < 3) { | 129 if (buildCounterAuditLogConfig < 3) { |
131 checkUnnamed498(o.exemptedMembers); | 130 checkUnnamed497(o.exemptedMembers); |
132 unittest.expect(o.logType, unittest.equals('foo')); | 131 unittest.expect(o.logType, unittest.equals('foo')); |
133 } | 132 } |
134 buildCounterAuditLogConfig--; | 133 buildCounterAuditLogConfig--; |
135 } | 134 } |
136 | 135 |
137 buildUnnamed499() { | 136 buildUnnamed498() { |
138 var o = new core.List<core.String>(); | 137 var o = new core.List<core.String>(); |
139 o.add("foo"); | 138 o.add("foo"); |
140 o.add("foo"); | 139 o.add("foo"); |
141 return o; | 140 return o; |
142 } | 141 } |
143 | 142 |
144 checkUnnamed499(core.List<core.String> o) { | 143 checkUnnamed498(core.List<core.String> o) { |
145 unittest.expect(o, unittest.hasLength(2)); | 144 unittest.expect(o, unittest.hasLength(2)); |
146 unittest.expect(o[0], unittest.equals('foo')); | 145 unittest.expect(o[0], unittest.equals('foo')); |
147 unittest.expect(o[1], unittest.equals('foo')); | 146 unittest.expect(o[1], unittest.equals('foo')); |
148 } | 147 } |
149 | 148 |
150 core.int buildCounterBinding = 0; | 149 core.int buildCounterBinding = 0; |
151 buildBinding() { | 150 buildBinding() { |
152 var o = new api.Binding(); | 151 var o = new api.Binding(); |
153 buildCounterBinding++; | 152 buildCounterBinding++; |
154 if (buildCounterBinding < 3) { | 153 if (buildCounterBinding < 3) { |
155 o.members = buildUnnamed499(); | 154 o.members = buildUnnamed498(); |
156 o.role = "foo"; | 155 o.role = "foo"; |
157 } | 156 } |
158 buildCounterBinding--; | 157 buildCounterBinding--; |
159 return o; | 158 return o; |
160 } | 159 } |
161 | 160 |
162 checkBinding(api.Binding o) { | 161 checkBinding(api.Binding o) { |
163 buildCounterBinding++; | 162 buildCounterBinding++; |
164 if (buildCounterBinding < 3) { | 163 if (buildCounterBinding < 3) { |
165 checkUnnamed499(o.members); | 164 checkUnnamed498(o.members); |
166 unittest.expect(o.role, unittest.equals('foo')); | 165 unittest.expect(o.role, unittest.equals('foo')); |
167 } | 166 } |
168 buildCounterBinding--; | 167 buildCounterBinding--; |
169 } | 168 } |
170 | 169 |
171 core.int buildCounterCloudAuditOptions = 0; | 170 core.int buildCounterCloudAuditOptions = 0; |
172 buildCloudAuditOptions() { | 171 buildCloudAuditOptions() { |
173 var o = new api.CloudAuditOptions(); | 172 var o = new api.CloudAuditOptions(); |
174 buildCounterCloudAuditOptions++; | 173 buildCounterCloudAuditOptions++; |
175 if (buildCounterCloudAuditOptions < 3) { | 174 if (buildCounterCloudAuditOptions < 3) { |
176 o.logName = "foo"; | 175 o.logName = "foo"; |
177 } | 176 } |
178 buildCounterCloudAuditOptions--; | 177 buildCounterCloudAuditOptions--; |
179 return o; | 178 return o; |
180 } | 179 } |
181 | 180 |
182 checkCloudAuditOptions(api.CloudAuditOptions o) { | 181 checkCloudAuditOptions(api.CloudAuditOptions o) { |
183 buildCounterCloudAuditOptions++; | 182 buildCounterCloudAuditOptions++; |
184 if (buildCounterCloudAuditOptions < 3) { | 183 if (buildCounterCloudAuditOptions < 3) { |
185 unittest.expect(o.logName, unittest.equals('foo')); | 184 unittest.expect(o.logName, unittest.equals('foo')); |
186 } | 185 } |
187 buildCounterCloudAuditOptions--; | 186 buildCounterCloudAuditOptions--; |
188 } | 187 } |
189 | 188 |
190 buildUnnamed500() { | 189 buildUnnamed499() { |
191 var o = new core.List<core.String>(); | 190 var o = new core.List<core.String>(); |
192 o.add("foo"); | 191 o.add("foo"); |
193 o.add("foo"); | 192 o.add("foo"); |
194 return o; | 193 return o; |
195 } | 194 } |
196 | 195 |
197 checkUnnamed500(core.List<core.String> o) { | 196 checkUnnamed499(core.List<core.String> o) { |
198 unittest.expect(o, unittest.hasLength(2)); | 197 unittest.expect(o, unittest.hasLength(2)); |
199 unittest.expect(o[0], unittest.equals('foo')); | 198 unittest.expect(o[0], unittest.equals('foo')); |
200 unittest.expect(o[1], unittest.equals('foo')); | 199 unittest.expect(o[1], unittest.equals('foo')); |
201 } | 200 } |
202 | 201 |
203 core.int buildCounterCondition = 0; | 202 core.int buildCounterCondition = 0; |
204 buildCondition() { | 203 buildCondition() { |
205 var o = new api.Condition(); | 204 var o = new api.Condition(); |
206 buildCounterCondition++; | 205 buildCounterCondition++; |
207 if (buildCounterCondition < 3) { | 206 if (buildCounterCondition < 3) { |
208 o.iam = "foo"; | 207 o.iam = "foo"; |
209 o.op = "foo"; | 208 o.op = "foo"; |
210 o.svc = "foo"; | 209 o.svc = "foo"; |
211 o.sys = "foo"; | 210 o.sys = "foo"; |
212 o.value = "foo"; | 211 o.value = "foo"; |
213 o.values = buildUnnamed500(); | 212 o.values = buildUnnamed499(); |
214 } | 213 } |
215 buildCounterCondition--; | 214 buildCounterCondition--; |
216 return o; | 215 return o; |
217 } | 216 } |
218 | 217 |
219 checkCondition(api.Condition o) { | 218 checkCondition(api.Condition o) { |
220 buildCounterCondition++; | 219 buildCounterCondition++; |
221 if (buildCounterCondition < 3) { | 220 if (buildCounterCondition < 3) { |
222 unittest.expect(o.iam, unittest.equals('foo')); | 221 unittest.expect(o.iam, unittest.equals('foo')); |
223 unittest.expect(o.op, unittest.equals('foo')); | 222 unittest.expect(o.op, unittest.equals('foo')); |
224 unittest.expect(o.svc, unittest.equals('foo')); | 223 unittest.expect(o.svc, unittest.equals('foo')); |
225 unittest.expect(o.sys, unittest.equals('foo')); | 224 unittest.expect(o.sys, unittest.equals('foo')); |
226 unittest.expect(o.value, unittest.equals('foo')); | 225 unittest.expect(o.value, unittest.equals('foo')); |
227 checkUnnamed500(o.values); | 226 checkUnnamed499(o.values); |
228 } | 227 } |
229 buildCounterCondition--; | 228 buildCounterCondition--; |
230 } | 229 } |
231 | 230 |
232 core.int buildCounterCounterOptions = 0; | 231 core.int buildCounterCounterOptions = 0; |
233 buildCounterOptions() { | 232 buildCounterOptions() { |
234 var o = new api.CounterOptions(); | 233 var o = new api.CounterOptions(); |
235 buildCounterCounterOptions++; | 234 buildCounterCounterOptions++; |
236 if (buildCounterCounterOptions < 3) { | 235 if (buildCounterCounterOptions < 3) { |
237 o.field = "foo"; | 236 o.field = "foo"; |
238 o.metric = "foo"; | 237 o.metric = "foo"; |
239 } | 238 } |
240 buildCounterCounterOptions--; | 239 buildCounterCounterOptions--; |
241 return o; | 240 return o; |
242 } | 241 } |
243 | 242 |
244 checkCounterOptions(api.CounterOptions o) { | 243 checkCounterOptions(api.CounterOptions o) { |
245 buildCounterCounterOptions++; | 244 buildCounterCounterOptions++; |
246 if (buildCounterCounterOptions < 3) { | 245 if (buildCounterCounterOptions < 3) { |
247 unittest.expect(o.field, unittest.equals('foo')); | 246 unittest.expect(o.field, unittest.equals('foo')); |
248 unittest.expect(o.metric, unittest.equals('foo')); | 247 unittest.expect(o.metric, unittest.equals('foo')); |
249 } | 248 } |
250 buildCounterCounterOptions--; | 249 buildCounterCounterOptions--; |
251 } | 250 } |
252 | 251 |
253 core.int buildCounterDataAccessOptions = 0; | 252 core.int buildCounterDataAccessOptions = 0; |
254 buildDataAccessOptions() { | 253 buildDataAccessOptions() { |
255 var o = new api.DataAccessOptions(); | 254 var o = new api.DataAccessOptions(); |
256 buildCounterDataAccessOptions++; | 255 buildCounterDataAccessOptions++; |
257 if (buildCounterDataAccessOptions < 3) { | 256 if (buildCounterDataAccessOptions < 3) {} |
258 } | |
259 buildCounterDataAccessOptions--; | 257 buildCounterDataAccessOptions--; |
260 return o; | 258 return o; |
261 } | 259 } |
262 | 260 |
263 checkDataAccessOptions(api.DataAccessOptions o) { | 261 checkDataAccessOptions(api.DataAccessOptions o) { |
264 buildCounterDataAccessOptions++; | 262 buildCounterDataAccessOptions++; |
265 if (buildCounterDataAccessOptions < 3) { | 263 if (buildCounterDataAccessOptions < 3) {} |
266 } | |
267 buildCounterDataAccessOptions--; | 264 buildCounterDataAccessOptions--; |
268 } | 265 } |
269 | 266 |
270 core.int buildCounterEmpty = 0; | 267 core.int buildCounterEmpty = 0; |
271 buildEmpty() { | 268 buildEmpty() { |
272 var o = new api.Empty(); | 269 var o = new api.Empty(); |
273 buildCounterEmpty++; | 270 buildCounterEmpty++; |
274 if (buildCounterEmpty < 3) { | 271 if (buildCounterEmpty < 3) {} |
275 } | |
276 buildCounterEmpty--; | 272 buildCounterEmpty--; |
277 return o; | 273 return o; |
278 } | 274 } |
279 | 275 |
280 checkEmpty(api.Empty o) { | 276 checkEmpty(api.Empty o) { |
281 buildCounterEmpty++; | 277 buildCounterEmpty++; |
282 if (buildCounterEmpty < 3) { | 278 if (buildCounterEmpty < 3) {} |
283 } | |
284 buildCounterEmpty--; | 279 buildCounterEmpty--; |
285 } | 280 } |
286 | 281 |
287 buildUnnamed501() { | 282 buildUnnamed500() { |
288 var o = new core.List<api.Repo>(); | 283 var o = new core.List<api.Repo>(); |
289 o.add(buildRepo()); | 284 o.add(buildRepo()); |
290 o.add(buildRepo()); | 285 o.add(buildRepo()); |
291 return o; | 286 return o; |
292 } | 287 } |
293 | 288 |
294 checkUnnamed501(core.List<api.Repo> o) { | 289 checkUnnamed500(core.List<api.Repo> o) { |
295 unittest.expect(o, unittest.hasLength(2)); | 290 unittest.expect(o, unittest.hasLength(2)); |
296 checkRepo(o[0]); | 291 checkRepo(o[0]); |
297 checkRepo(o[1]); | 292 checkRepo(o[1]); |
298 } | 293 } |
299 | 294 |
300 core.int buildCounterListReposResponse = 0; | 295 core.int buildCounterListReposResponse = 0; |
301 buildListReposResponse() { | 296 buildListReposResponse() { |
302 var o = new api.ListReposResponse(); | 297 var o = new api.ListReposResponse(); |
303 buildCounterListReposResponse++; | 298 buildCounterListReposResponse++; |
304 if (buildCounterListReposResponse < 3) { | 299 if (buildCounterListReposResponse < 3) { |
305 o.nextPageToken = "foo"; | 300 o.nextPageToken = "foo"; |
306 o.repos = buildUnnamed501(); | 301 o.repos = buildUnnamed500(); |
307 } | 302 } |
308 buildCounterListReposResponse--; | 303 buildCounterListReposResponse--; |
309 return o; | 304 return o; |
310 } | 305 } |
311 | 306 |
312 checkListReposResponse(api.ListReposResponse o) { | 307 checkListReposResponse(api.ListReposResponse o) { |
313 buildCounterListReposResponse++; | 308 buildCounterListReposResponse++; |
314 if (buildCounterListReposResponse < 3) { | 309 if (buildCounterListReposResponse < 3) { |
315 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 310 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
316 checkUnnamed501(o.repos); | 311 checkUnnamed500(o.repos); |
317 } | 312 } |
318 buildCounterListReposResponse--; | 313 buildCounterListReposResponse--; |
319 } | 314 } |
320 | 315 |
321 core.int buildCounterLogConfig = 0; | 316 core.int buildCounterLogConfig = 0; |
322 buildLogConfig() { | 317 buildLogConfig() { |
323 var o = new api.LogConfig(); | 318 var o = new api.LogConfig(); |
324 buildCounterLogConfig++; | 319 buildCounterLogConfig++; |
325 if (buildCounterLogConfig < 3) { | 320 if (buildCounterLogConfig < 3) { |
326 o.cloudAudit = buildCloudAuditOptions(); | 321 o.cloudAudit = buildCloudAuditOptions(); |
(...skipping 30 matching lines...) Expand all Loading... |
357 checkMirrorConfig(api.MirrorConfig o) { | 352 checkMirrorConfig(api.MirrorConfig o) { |
358 buildCounterMirrorConfig++; | 353 buildCounterMirrorConfig++; |
359 if (buildCounterMirrorConfig < 3) { | 354 if (buildCounterMirrorConfig < 3) { |
360 unittest.expect(o.deployKeyId, unittest.equals('foo')); | 355 unittest.expect(o.deployKeyId, unittest.equals('foo')); |
361 unittest.expect(o.url, unittest.equals('foo')); | 356 unittest.expect(o.url, unittest.equals('foo')); |
362 unittest.expect(o.webhookId, unittest.equals('foo')); | 357 unittest.expect(o.webhookId, unittest.equals('foo')); |
363 } | 358 } |
364 buildCounterMirrorConfig--; | 359 buildCounterMirrorConfig--; |
365 } | 360 } |
366 | 361 |
367 buildUnnamed502() { | 362 buildUnnamed501() { |
368 var o = new core.List<api.AuditConfig>(); | 363 var o = new core.List<api.AuditConfig>(); |
369 o.add(buildAuditConfig()); | 364 o.add(buildAuditConfig()); |
370 o.add(buildAuditConfig()); | 365 o.add(buildAuditConfig()); |
371 return o; | 366 return o; |
372 } | 367 } |
373 | 368 |
374 checkUnnamed502(core.List<api.AuditConfig> o) { | 369 checkUnnamed501(core.List<api.AuditConfig> o) { |
375 unittest.expect(o, unittest.hasLength(2)); | 370 unittest.expect(o, unittest.hasLength(2)); |
376 checkAuditConfig(o[0]); | 371 checkAuditConfig(o[0]); |
377 checkAuditConfig(o[1]); | 372 checkAuditConfig(o[1]); |
378 } | 373 } |
379 | 374 |
380 buildUnnamed503() { | 375 buildUnnamed502() { |
381 var o = new core.List<api.Binding>(); | 376 var o = new core.List<api.Binding>(); |
382 o.add(buildBinding()); | 377 o.add(buildBinding()); |
383 o.add(buildBinding()); | 378 o.add(buildBinding()); |
384 return o; | 379 return o; |
385 } | 380 } |
386 | 381 |
387 checkUnnamed503(core.List<api.Binding> o) { | 382 checkUnnamed502(core.List<api.Binding> o) { |
388 unittest.expect(o, unittest.hasLength(2)); | 383 unittest.expect(o, unittest.hasLength(2)); |
389 checkBinding(o[0]); | 384 checkBinding(o[0]); |
390 checkBinding(o[1]); | 385 checkBinding(o[1]); |
391 } | 386 } |
392 | 387 |
393 buildUnnamed504() { | 388 buildUnnamed503() { |
394 var o = new core.List<api.Rule>(); | 389 var o = new core.List<api.Rule>(); |
395 o.add(buildRule()); | 390 o.add(buildRule()); |
396 o.add(buildRule()); | 391 o.add(buildRule()); |
397 return o; | 392 return o; |
398 } | 393 } |
399 | 394 |
400 checkUnnamed504(core.List<api.Rule> o) { | 395 checkUnnamed503(core.List<api.Rule> o) { |
401 unittest.expect(o, unittest.hasLength(2)); | 396 unittest.expect(o, unittest.hasLength(2)); |
402 checkRule(o[0]); | 397 checkRule(o[0]); |
403 checkRule(o[1]); | 398 checkRule(o[1]); |
404 } | 399 } |
405 | 400 |
406 core.int buildCounterPolicy = 0; | 401 core.int buildCounterPolicy = 0; |
407 buildPolicy() { | 402 buildPolicy() { |
408 var o = new api.Policy(); | 403 var o = new api.Policy(); |
409 buildCounterPolicy++; | 404 buildCounterPolicy++; |
410 if (buildCounterPolicy < 3) { | 405 if (buildCounterPolicy < 3) { |
411 o.auditConfigs = buildUnnamed502(); | 406 o.auditConfigs = buildUnnamed501(); |
412 o.bindings = buildUnnamed503(); | 407 o.bindings = buildUnnamed502(); |
413 o.etag = "foo"; | 408 o.etag = "foo"; |
414 o.iamOwned = true; | 409 o.iamOwned = true; |
415 o.rules = buildUnnamed504(); | 410 o.rules = buildUnnamed503(); |
416 o.version = 42; | 411 o.version = 42; |
417 } | 412 } |
418 buildCounterPolicy--; | 413 buildCounterPolicy--; |
419 return o; | 414 return o; |
420 } | 415 } |
421 | 416 |
422 checkPolicy(api.Policy o) { | 417 checkPolicy(api.Policy o) { |
423 buildCounterPolicy++; | 418 buildCounterPolicy++; |
424 if (buildCounterPolicy < 3) { | 419 if (buildCounterPolicy < 3) { |
425 checkUnnamed502(o.auditConfigs); | 420 checkUnnamed501(o.auditConfigs); |
426 checkUnnamed503(o.bindings); | 421 checkUnnamed502(o.bindings); |
427 unittest.expect(o.etag, unittest.equals('foo')); | 422 unittest.expect(o.etag, unittest.equals('foo')); |
428 unittest.expect(o.iamOwned, unittest.isTrue); | 423 unittest.expect(o.iamOwned, unittest.isTrue); |
429 checkUnnamed504(o.rules); | 424 checkUnnamed503(o.rules); |
430 unittest.expect(o.version, unittest.equals(42)); | 425 unittest.expect(o.version, unittest.equals(42)); |
431 } | 426 } |
432 buildCounterPolicy--; | 427 buildCounterPolicy--; |
433 } | 428 } |
434 | 429 |
435 core.int buildCounterRepo = 0; | 430 core.int buildCounterRepo = 0; |
436 buildRepo() { | 431 buildRepo() { |
437 var o = new api.Repo(); | 432 var o = new api.Repo(); |
438 buildCounterRepo++; | 433 buildCounterRepo++; |
439 if (buildCounterRepo < 3) { | 434 if (buildCounterRepo < 3) { |
(...skipping 10 matching lines...) Expand all Loading... |
450 buildCounterRepo++; | 445 buildCounterRepo++; |
451 if (buildCounterRepo < 3) { | 446 if (buildCounterRepo < 3) { |
452 checkMirrorConfig(o.mirrorConfig); | 447 checkMirrorConfig(o.mirrorConfig); |
453 unittest.expect(o.name, unittest.equals('foo')); | 448 unittest.expect(o.name, unittest.equals('foo')); |
454 unittest.expect(o.size, unittest.equals('foo')); | 449 unittest.expect(o.size, unittest.equals('foo')); |
455 unittest.expect(o.url, unittest.equals('foo')); | 450 unittest.expect(o.url, unittest.equals('foo')); |
456 } | 451 } |
457 buildCounterRepo--; | 452 buildCounterRepo--; |
458 } | 453 } |
459 | 454 |
460 buildUnnamed505() { | 455 buildUnnamed504() { |
461 var o = new core.List<api.Condition>(); | 456 var o = new core.List<api.Condition>(); |
462 o.add(buildCondition()); | 457 o.add(buildCondition()); |
463 o.add(buildCondition()); | 458 o.add(buildCondition()); |
464 return o; | 459 return o; |
465 } | 460 } |
466 | 461 |
467 checkUnnamed505(core.List<api.Condition> o) { | 462 checkUnnamed504(core.List<api.Condition> o) { |
468 unittest.expect(o, unittest.hasLength(2)); | 463 unittest.expect(o, unittest.hasLength(2)); |
469 checkCondition(o[0]); | 464 checkCondition(o[0]); |
470 checkCondition(o[1]); | 465 checkCondition(o[1]); |
471 } | 466 } |
472 | 467 |
473 buildUnnamed506() { | 468 buildUnnamed505() { |
474 var o = new core.List<core.String>(); | 469 var o = new core.List<core.String>(); |
475 o.add("foo"); | 470 o.add("foo"); |
476 o.add("foo"); | 471 o.add("foo"); |
477 return o; | 472 return o; |
478 } | 473 } |
479 | 474 |
480 checkUnnamed506(core.List<core.String> o) { | 475 checkUnnamed505(core.List<core.String> o) { |
481 unittest.expect(o, unittest.hasLength(2)); | 476 unittest.expect(o, unittest.hasLength(2)); |
482 unittest.expect(o[0], unittest.equals('foo')); | 477 unittest.expect(o[0], unittest.equals('foo')); |
483 unittest.expect(o[1], unittest.equals('foo')); | 478 unittest.expect(o[1], unittest.equals('foo')); |
484 } | 479 } |
485 | 480 |
486 buildUnnamed507() { | 481 buildUnnamed506() { |
487 var o = new core.List<api.LogConfig>(); | 482 var o = new core.List<api.LogConfig>(); |
488 o.add(buildLogConfig()); | 483 o.add(buildLogConfig()); |
489 o.add(buildLogConfig()); | 484 o.add(buildLogConfig()); |
490 return o; | 485 return o; |
491 } | 486 } |
492 | 487 |
493 checkUnnamed507(core.List<api.LogConfig> o) { | 488 checkUnnamed506(core.List<api.LogConfig> o) { |
494 unittest.expect(o, unittest.hasLength(2)); | 489 unittest.expect(o, unittest.hasLength(2)); |
495 checkLogConfig(o[0]); | 490 checkLogConfig(o[0]); |
496 checkLogConfig(o[1]); | 491 checkLogConfig(o[1]); |
497 } | 492 } |
498 | 493 |
| 494 buildUnnamed507() { |
| 495 var o = new core.List<core.String>(); |
| 496 o.add("foo"); |
| 497 o.add("foo"); |
| 498 return o; |
| 499 } |
| 500 |
| 501 checkUnnamed507(core.List<core.String> o) { |
| 502 unittest.expect(o, unittest.hasLength(2)); |
| 503 unittest.expect(o[0], unittest.equals('foo')); |
| 504 unittest.expect(o[1], unittest.equals('foo')); |
| 505 } |
| 506 |
499 buildUnnamed508() { | 507 buildUnnamed508() { |
500 var o = new core.List<core.String>(); | 508 var o = new core.List<core.String>(); |
501 o.add("foo"); | 509 o.add("foo"); |
502 o.add("foo"); | 510 o.add("foo"); |
503 return o; | 511 return o; |
504 } | 512 } |
505 | 513 |
506 checkUnnamed508(core.List<core.String> o) { | 514 checkUnnamed508(core.List<core.String> o) { |
507 unittest.expect(o, unittest.hasLength(2)); | 515 unittest.expect(o, unittest.hasLength(2)); |
508 unittest.expect(o[0], unittest.equals('foo')); | 516 unittest.expect(o[0], unittest.equals('foo')); |
509 unittest.expect(o[1], unittest.equals('foo')); | 517 unittest.expect(o[1], unittest.equals('foo')); |
510 } | |
511 | |
512 buildUnnamed509() { | |
513 var o = new core.List<core.String>(); | |
514 o.add("foo"); | |
515 o.add("foo"); | |
516 return o; | |
517 } | |
518 | |
519 checkUnnamed509(core.List<core.String> o) { | |
520 unittest.expect(o, unittest.hasLength(2)); | |
521 unittest.expect(o[0], unittest.equals('foo')); | |
522 unittest.expect(o[1], unittest.equals('foo')); | |
523 } | 518 } |
524 | 519 |
525 core.int buildCounterRule = 0; | 520 core.int buildCounterRule = 0; |
526 buildRule() { | 521 buildRule() { |
527 var o = new api.Rule(); | 522 var o = new api.Rule(); |
528 buildCounterRule++; | 523 buildCounterRule++; |
529 if (buildCounterRule < 3) { | 524 if (buildCounterRule < 3) { |
530 o.action = "foo"; | 525 o.action = "foo"; |
531 o.conditions = buildUnnamed505(); | 526 o.conditions = buildUnnamed504(); |
532 o.description = "foo"; | 527 o.description = "foo"; |
533 o.in_ = buildUnnamed506(); | 528 o.in_ = buildUnnamed505(); |
534 o.logConfig = buildUnnamed507(); | 529 o.logConfig = buildUnnamed506(); |
535 o.notIn = buildUnnamed508(); | 530 o.notIn = buildUnnamed507(); |
536 o.permissions = buildUnnamed509(); | 531 o.permissions = buildUnnamed508(); |
537 } | 532 } |
538 buildCounterRule--; | 533 buildCounterRule--; |
539 return o; | 534 return o; |
540 } | 535 } |
541 | 536 |
542 checkRule(api.Rule o) { | 537 checkRule(api.Rule o) { |
543 buildCounterRule++; | 538 buildCounterRule++; |
544 if (buildCounterRule < 3) { | 539 if (buildCounterRule < 3) { |
545 unittest.expect(o.action, unittest.equals('foo')); | 540 unittest.expect(o.action, unittest.equals('foo')); |
546 checkUnnamed505(o.conditions); | 541 checkUnnamed504(o.conditions); |
547 unittest.expect(o.description, unittest.equals('foo')); | 542 unittest.expect(o.description, unittest.equals('foo')); |
548 checkUnnamed506(o.in_); | 543 checkUnnamed505(o.in_); |
549 checkUnnamed507(o.logConfig); | 544 checkUnnamed506(o.logConfig); |
550 checkUnnamed508(o.notIn); | 545 checkUnnamed507(o.notIn); |
551 checkUnnamed509(o.permissions); | 546 checkUnnamed508(o.permissions); |
552 } | 547 } |
553 buildCounterRule--; | 548 buildCounterRule--; |
554 } | 549 } |
555 | 550 |
556 core.int buildCounterSetIamPolicyRequest = 0; | 551 core.int buildCounterSetIamPolicyRequest = 0; |
557 buildSetIamPolicyRequest() { | 552 buildSetIamPolicyRequest() { |
558 var o = new api.SetIamPolicyRequest(); | 553 var o = new api.SetIamPolicyRequest(); |
559 buildCounterSetIamPolicyRequest++; | 554 buildCounterSetIamPolicyRequest++; |
560 if (buildCounterSetIamPolicyRequest < 3) { | 555 if (buildCounterSetIamPolicyRequest < 3) { |
561 o.policy = buildPolicy(); | 556 o.policy = buildPolicy(); |
562 o.updateMask = "foo"; | 557 o.updateMask = "foo"; |
563 } | 558 } |
564 buildCounterSetIamPolicyRequest--; | 559 buildCounterSetIamPolicyRequest--; |
565 return o; | 560 return o; |
566 } | 561 } |
567 | 562 |
568 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { | 563 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
569 buildCounterSetIamPolicyRequest++; | 564 buildCounterSetIamPolicyRequest++; |
570 if (buildCounterSetIamPolicyRequest < 3) { | 565 if (buildCounterSetIamPolicyRequest < 3) { |
571 checkPolicy(o.policy); | 566 checkPolicy(o.policy); |
572 unittest.expect(o.updateMask, unittest.equals('foo')); | 567 unittest.expect(o.updateMask, unittest.equals('foo')); |
573 } | 568 } |
574 buildCounterSetIamPolicyRequest--; | 569 buildCounterSetIamPolicyRequest--; |
575 } | 570 } |
576 | 571 |
577 buildUnnamed510() { | 572 buildUnnamed509() { |
578 var o = new core.List<core.String>(); | 573 var o = new core.List<core.String>(); |
579 o.add("foo"); | 574 o.add("foo"); |
580 o.add("foo"); | 575 o.add("foo"); |
581 return o; | 576 return o; |
582 } | 577 } |
583 | 578 |
584 checkUnnamed510(core.List<core.String> o) { | 579 checkUnnamed509(core.List<core.String> o) { |
585 unittest.expect(o, unittest.hasLength(2)); | 580 unittest.expect(o, unittest.hasLength(2)); |
586 unittest.expect(o[0], unittest.equals('foo')); | 581 unittest.expect(o[0], unittest.equals('foo')); |
587 unittest.expect(o[1], unittest.equals('foo')); | 582 unittest.expect(o[1], unittest.equals('foo')); |
588 } | 583 } |
589 | 584 |
590 core.int buildCounterTestIamPermissionsRequest = 0; | 585 core.int buildCounterTestIamPermissionsRequest = 0; |
591 buildTestIamPermissionsRequest() { | 586 buildTestIamPermissionsRequest() { |
592 var o = new api.TestIamPermissionsRequest(); | 587 var o = new api.TestIamPermissionsRequest(); |
593 buildCounterTestIamPermissionsRequest++; | 588 buildCounterTestIamPermissionsRequest++; |
594 if (buildCounterTestIamPermissionsRequest < 3) { | 589 if (buildCounterTestIamPermissionsRequest < 3) { |
595 o.permissions = buildUnnamed510(); | 590 o.permissions = buildUnnamed509(); |
596 } | 591 } |
597 buildCounterTestIamPermissionsRequest--; | 592 buildCounterTestIamPermissionsRequest--; |
598 return o; | 593 return o; |
599 } | 594 } |
600 | 595 |
601 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { | 596 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
602 buildCounterTestIamPermissionsRequest++; | 597 buildCounterTestIamPermissionsRequest++; |
603 if (buildCounterTestIamPermissionsRequest < 3) { | 598 if (buildCounterTestIamPermissionsRequest < 3) { |
604 checkUnnamed510(o.permissions); | 599 checkUnnamed509(o.permissions); |
605 } | 600 } |
606 buildCounterTestIamPermissionsRequest--; | 601 buildCounterTestIamPermissionsRequest--; |
607 } | 602 } |
608 | 603 |
609 buildUnnamed511() { | 604 buildUnnamed510() { |
610 var o = new core.List<core.String>(); | 605 var o = new core.List<core.String>(); |
611 o.add("foo"); | 606 o.add("foo"); |
612 o.add("foo"); | 607 o.add("foo"); |
613 return o; | 608 return o; |
614 } | 609 } |
615 | 610 |
616 checkUnnamed511(core.List<core.String> o) { | 611 checkUnnamed510(core.List<core.String> o) { |
617 unittest.expect(o, unittest.hasLength(2)); | 612 unittest.expect(o, unittest.hasLength(2)); |
618 unittest.expect(o[0], unittest.equals('foo')); | 613 unittest.expect(o[0], unittest.equals('foo')); |
619 unittest.expect(o[1], unittest.equals('foo')); | 614 unittest.expect(o[1], unittest.equals('foo')); |
620 } | 615 } |
621 | 616 |
622 core.int buildCounterTestIamPermissionsResponse = 0; | 617 core.int buildCounterTestIamPermissionsResponse = 0; |
623 buildTestIamPermissionsResponse() { | 618 buildTestIamPermissionsResponse() { |
624 var o = new api.TestIamPermissionsResponse(); | 619 var o = new api.TestIamPermissionsResponse(); |
625 buildCounterTestIamPermissionsResponse++; | 620 buildCounterTestIamPermissionsResponse++; |
626 if (buildCounterTestIamPermissionsResponse < 3) { | 621 if (buildCounterTestIamPermissionsResponse < 3) { |
627 o.permissions = buildUnnamed511(); | 622 o.permissions = buildUnnamed510(); |
628 } | 623 } |
629 buildCounterTestIamPermissionsResponse--; | 624 buildCounterTestIamPermissionsResponse--; |
630 return o; | 625 return o; |
631 } | 626 } |
632 | 627 |
633 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { | 628 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
634 buildCounterTestIamPermissionsResponse++; | 629 buildCounterTestIamPermissionsResponse++; |
635 if (buildCounterTestIamPermissionsResponse < 3) { | 630 if (buildCounterTestIamPermissionsResponse < 3) { |
636 checkUnnamed511(o.permissions); | 631 checkUnnamed510(o.permissions); |
637 } | 632 } |
638 buildCounterTestIamPermissionsResponse--; | 633 buildCounterTestIamPermissionsResponse--; |
639 } | 634 } |
640 | 635 |
641 | |
642 main() { | 636 main() { |
643 unittest.group("obj-schema-AuditConfig", () { | 637 unittest.group("obj-schema-AuditConfig", () { |
644 unittest.test("to-json--from-json", () { | 638 unittest.test("to-json--from-json", () { |
645 var o = buildAuditConfig(); | 639 var o = buildAuditConfig(); |
646 var od = new api.AuditConfig.fromJson(o.toJson()); | 640 var od = new api.AuditConfig.fromJson(o.toJson()); |
647 checkAuditConfig(od); | 641 checkAuditConfig(od); |
648 }); | 642 }); |
649 }); | 643 }); |
650 | 644 |
651 | |
652 unittest.group("obj-schema-AuditLogConfig", () { | 645 unittest.group("obj-schema-AuditLogConfig", () { |
653 unittest.test("to-json--from-json", () { | 646 unittest.test("to-json--from-json", () { |
654 var o = buildAuditLogConfig(); | 647 var o = buildAuditLogConfig(); |
655 var od = new api.AuditLogConfig.fromJson(o.toJson()); | 648 var od = new api.AuditLogConfig.fromJson(o.toJson()); |
656 checkAuditLogConfig(od); | 649 checkAuditLogConfig(od); |
657 }); | 650 }); |
658 }); | 651 }); |
659 | 652 |
660 | |
661 unittest.group("obj-schema-Binding", () { | 653 unittest.group("obj-schema-Binding", () { |
662 unittest.test("to-json--from-json", () { | 654 unittest.test("to-json--from-json", () { |
663 var o = buildBinding(); | 655 var o = buildBinding(); |
664 var od = new api.Binding.fromJson(o.toJson()); | 656 var od = new api.Binding.fromJson(o.toJson()); |
665 checkBinding(od); | 657 checkBinding(od); |
666 }); | 658 }); |
667 }); | 659 }); |
668 | 660 |
669 | |
670 unittest.group("obj-schema-CloudAuditOptions", () { | 661 unittest.group("obj-schema-CloudAuditOptions", () { |
671 unittest.test("to-json--from-json", () { | 662 unittest.test("to-json--from-json", () { |
672 var o = buildCloudAuditOptions(); | 663 var o = buildCloudAuditOptions(); |
673 var od = new api.CloudAuditOptions.fromJson(o.toJson()); | 664 var od = new api.CloudAuditOptions.fromJson(o.toJson()); |
674 checkCloudAuditOptions(od); | 665 checkCloudAuditOptions(od); |
675 }); | 666 }); |
676 }); | 667 }); |
677 | 668 |
678 | |
679 unittest.group("obj-schema-Condition", () { | 669 unittest.group("obj-schema-Condition", () { |
680 unittest.test("to-json--from-json", () { | 670 unittest.test("to-json--from-json", () { |
681 var o = buildCondition(); | 671 var o = buildCondition(); |
682 var od = new api.Condition.fromJson(o.toJson()); | 672 var od = new api.Condition.fromJson(o.toJson()); |
683 checkCondition(od); | 673 checkCondition(od); |
684 }); | 674 }); |
685 }); | 675 }); |
686 | 676 |
687 | |
688 unittest.group("obj-schema-CounterOptions", () { | 677 unittest.group("obj-schema-CounterOptions", () { |
689 unittest.test("to-json--from-json", () { | 678 unittest.test("to-json--from-json", () { |
690 var o = buildCounterOptions(); | 679 var o = buildCounterOptions(); |
691 var od = new api.CounterOptions.fromJson(o.toJson()); | 680 var od = new api.CounterOptions.fromJson(o.toJson()); |
692 checkCounterOptions(od); | 681 checkCounterOptions(od); |
693 }); | 682 }); |
694 }); | 683 }); |
695 | 684 |
696 | |
697 unittest.group("obj-schema-DataAccessOptions", () { | 685 unittest.group("obj-schema-DataAccessOptions", () { |
698 unittest.test("to-json--from-json", () { | 686 unittest.test("to-json--from-json", () { |
699 var o = buildDataAccessOptions(); | 687 var o = buildDataAccessOptions(); |
700 var od = new api.DataAccessOptions.fromJson(o.toJson()); | 688 var od = new api.DataAccessOptions.fromJson(o.toJson()); |
701 checkDataAccessOptions(od); | 689 checkDataAccessOptions(od); |
702 }); | 690 }); |
703 }); | 691 }); |
704 | 692 |
705 | |
706 unittest.group("obj-schema-Empty", () { | 693 unittest.group("obj-schema-Empty", () { |
707 unittest.test("to-json--from-json", () { | 694 unittest.test("to-json--from-json", () { |
708 var o = buildEmpty(); | 695 var o = buildEmpty(); |
709 var od = new api.Empty.fromJson(o.toJson()); | 696 var od = new api.Empty.fromJson(o.toJson()); |
710 checkEmpty(od); | 697 checkEmpty(od); |
711 }); | 698 }); |
712 }); | 699 }); |
713 | 700 |
714 | |
715 unittest.group("obj-schema-ListReposResponse", () { | 701 unittest.group("obj-schema-ListReposResponse", () { |
716 unittest.test("to-json--from-json", () { | 702 unittest.test("to-json--from-json", () { |
717 var o = buildListReposResponse(); | 703 var o = buildListReposResponse(); |
718 var od = new api.ListReposResponse.fromJson(o.toJson()); | 704 var od = new api.ListReposResponse.fromJson(o.toJson()); |
719 checkListReposResponse(od); | 705 checkListReposResponse(od); |
720 }); | 706 }); |
721 }); | 707 }); |
722 | 708 |
723 | |
724 unittest.group("obj-schema-LogConfig", () { | 709 unittest.group("obj-schema-LogConfig", () { |
725 unittest.test("to-json--from-json", () { | 710 unittest.test("to-json--from-json", () { |
726 var o = buildLogConfig(); | 711 var o = buildLogConfig(); |
727 var od = new api.LogConfig.fromJson(o.toJson()); | 712 var od = new api.LogConfig.fromJson(o.toJson()); |
728 checkLogConfig(od); | 713 checkLogConfig(od); |
729 }); | 714 }); |
730 }); | 715 }); |
731 | 716 |
732 | |
733 unittest.group("obj-schema-MirrorConfig", () { | 717 unittest.group("obj-schema-MirrorConfig", () { |
734 unittest.test("to-json--from-json", () { | 718 unittest.test("to-json--from-json", () { |
735 var o = buildMirrorConfig(); | 719 var o = buildMirrorConfig(); |
736 var od = new api.MirrorConfig.fromJson(o.toJson()); | 720 var od = new api.MirrorConfig.fromJson(o.toJson()); |
737 checkMirrorConfig(od); | 721 checkMirrorConfig(od); |
738 }); | 722 }); |
739 }); | 723 }); |
740 | 724 |
741 | |
742 unittest.group("obj-schema-Policy", () { | 725 unittest.group("obj-schema-Policy", () { |
743 unittest.test("to-json--from-json", () { | 726 unittest.test("to-json--from-json", () { |
744 var o = buildPolicy(); | 727 var o = buildPolicy(); |
745 var od = new api.Policy.fromJson(o.toJson()); | 728 var od = new api.Policy.fromJson(o.toJson()); |
746 checkPolicy(od); | 729 checkPolicy(od); |
747 }); | 730 }); |
748 }); | 731 }); |
749 | 732 |
750 | |
751 unittest.group("obj-schema-Repo", () { | 733 unittest.group("obj-schema-Repo", () { |
752 unittest.test("to-json--from-json", () { | 734 unittest.test("to-json--from-json", () { |
753 var o = buildRepo(); | 735 var o = buildRepo(); |
754 var od = new api.Repo.fromJson(o.toJson()); | 736 var od = new api.Repo.fromJson(o.toJson()); |
755 checkRepo(od); | 737 checkRepo(od); |
756 }); | 738 }); |
757 }); | 739 }); |
758 | 740 |
759 | |
760 unittest.group("obj-schema-Rule", () { | 741 unittest.group("obj-schema-Rule", () { |
761 unittest.test("to-json--from-json", () { | 742 unittest.test("to-json--from-json", () { |
762 var o = buildRule(); | 743 var o = buildRule(); |
763 var od = new api.Rule.fromJson(o.toJson()); | 744 var od = new api.Rule.fromJson(o.toJson()); |
764 checkRule(od); | 745 checkRule(od); |
765 }); | 746 }); |
766 }); | 747 }); |
767 | 748 |
768 | |
769 unittest.group("obj-schema-SetIamPolicyRequest", () { | 749 unittest.group("obj-schema-SetIamPolicyRequest", () { |
770 unittest.test("to-json--from-json", () { | 750 unittest.test("to-json--from-json", () { |
771 var o = buildSetIamPolicyRequest(); | 751 var o = buildSetIamPolicyRequest(); |
772 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); | 752 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
773 checkSetIamPolicyRequest(od); | 753 checkSetIamPolicyRequest(od); |
774 }); | 754 }); |
775 }); | 755 }); |
776 | 756 |
777 | |
778 unittest.group("obj-schema-TestIamPermissionsRequest", () { | 757 unittest.group("obj-schema-TestIamPermissionsRequest", () { |
779 unittest.test("to-json--from-json", () { | 758 unittest.test("to-json--from-json", () { |
780 var o = buildTestIamPermissionsRequest(); | 759 var o = buildTestIamPermissionsRequest(); |
781 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); | 760 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
782 checkTestIamPermissionsRequest(od); | 761 checkTestIamPermissionsRequest(od); |
783 }); | 762 }); |
784 }); | 763 }); |
785 | 764 |
786 | |
787 unittest.group("obj-schema-TestIamPermissionsResponse", () { | 765 unittest.group("obj-schema-TestIamPermissionsResponse", () { |
788 unittest.test("to-json--from-json", () { | 766 unittest.test("to-json--from-json", () { |
789 var o = buildTestIamPermissionsResponse(); | 767 var o = buildTestIamPermissionsResponse(); |
790 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); | 768 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
791 checkTestIamPermissionsResponse(od); | 769 checkTestIamPermissionsResponse(od); |
792 }); | 770 }); |
793 }); | 771 }); |
794 | 772 |
795 | |
796 unittest.group("resource-ProjectsReposResourceApi", () { | 773 unittest.group("resource-ProjectsReposResourceApi", () { |
797 unittest.test("method--create", () { | 774 unittest.test("method--create", () { |
798 | |
799 var mock = new HttpServerMock(); | 775 var mock = new HttpServerMock(); |
800 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re
pos; | 776 api.ProjectsReposResourceApi res = |
| 777 new api.SourcerepoApi(mock).projects.repos; |
801 var arg_request = buildRepo(); | 778 var arg_request = buildRepo(); |
802 var arg_parent = "foo"; | 779 var arg_parent = "foo"; |
803 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 780 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
804 var obj = new api.Repo.fromJson(json); | 781 var obj = new api.Repo.fromJson(json); |
805 checkRepo(obj); | 782 checkRepo(obj); |
806 | 783 |
807 var path = (req.url).path; | 784 var path = (req.url).path; |
808 var pathOffset = 0; | 785 var pathOffset = 0; |
809 var index; | 786 var index; |
810 var subPart; | 787 var subPart; |
811 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 788 unittest.expect( |
| 789 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
812 pathOffset += 1; | 790 pathOffset += 1; |
813 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 791 unittest.expect( |
| 792 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
814 pathOffset += 3; | 793 pathOffset += 3; |
815 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 794 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
816 | 795 |
817 var query = (req.url).query; | 796 var query = (req.url).query; |
818 var queryOffset = 0; | 797 var queryOffset = 0; |
819 var queryMap = {}; | 798 var queryMap = {}; |
820 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 799 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
821 parseBool(n) { | 800 parseBool(n) { |
822 if (n == "true") return true; | 801 if (n == "true") return true; |
823 if (n == "false") return false; | 802 if (n == "false") return false; |
824 if (n == null) return null; | 803 if (n == null) return null; |
825 throw new core.ArgumentError("Invalid boolean: $n"); | 804 throw new core.ArgumentError("Invalid boolean: $n"); |
826 } | 805 } |
| 806 |
827 if (query.length > 0) { | 807 if (query.length > 0) { |
828 for (var part in query.split("&")) { | 808 for (var part in query.split("&")) { |
829 var keyvalue = part.split("="); | 809 var keyvalue = part.split("="); |
830 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 810 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 811 core.Uri.decodeQueryComponent(keyvalue[1])); |
831 } | 812 } |
832 } | 813 } |
833 | 814 |
834 | |
835 var h = { | 815 var h = { |
836 "content-type" : "application/json; charset=utf-8", | 816 "content-type": "application/json; charset=utf-8", |
837 }; | 817 }; |
838 var resp = convert.JSON.encode(buildRepo()); | 818 var resp = convert.JSON.encode(buildRepo()); |
839 return new async.Future.value(stringResponse(200, h, resp)); | 819 return new async.Future.value(stringResponse(200, h, resp)); |
840 }), true); | 820 }), true); |
841 res.create(arg_request, arg_parent).then(unittest.expectAsync1(((api.Repo
response) { | 821 res |
| 822 .create(arg_request, arg_parent) |
| 823 .then(unittest.expectAsync1(((api.Repo response) { |
842 checkRepo(response); | 824 checkRepo(response); |
843 }))); | 825 }))); |
844 }); | 826 }); |
845 | 827 |
846 unittest.test("method--delete", () { | 828 unittest.test("method--delete", () { |
847 | |
848 var mock = new HttpServerMock(); | 829 var mock = new HttpServerMock(); |
849 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re
pos; | 830 api.ProjectsReposResourceApi res = |
| 831 new api.SourcerepoApi(mock).projects.repos; |
850 var arg_name = "foo"; | 832 var arg_name = "foo"; |
851 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 833 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
852 var path = (req.url).path; | 834 var path = (req.url).path; |
853 var pathOffset = 0; | 835 var pathOffset = 0; |
854 var index; | 836 var index; |
855 var subPart; | 837 var subPart; |
856 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 838 unittest.expect( |
| 839 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
857 pathOffset += 1; | 840 pathOffset += 1; |
858 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 841 unittest.expect( |
| 842 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
859 pathOffset += 3; | 843 pathOffset += 3; |
860 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 844 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
861 | 845 |
862 var query = (req.url).query; | 846 var query = (req.url).query; |
863 var queryOffset = 0; | 847 var queryOffset = 0; |
864 var queryMap = {}; | 848 var queryMap = {}; |
865 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 849 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
866 parseBool(n) { | 850 parseBool(n) { |
867 if (n == "true") return true; | 851 if (n == "true") return true; |
868 if (n == "false") return false; | 852 if (n == "false") return false; |
869 if (n == null) return null; | 853 if (n == null) return null; |
870 throw new core.ArgumentError("Invalid boolean: $n"); | 854 throw new core.ArgumentError("Invalid boolean: $n"); |
871 } | 855 } |
| 856 |
872 if (query.length > 0) { | 857 if (query.length > 0) { |
873 for (var part in query.split("&")) { | 858 for (var part in query.split("&")) { |
874 var keyvalue = part.split("="); | 859 var keyvalue = part.split("="); |
875 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 860 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 861 core.Uri.decodeQueryComponent(keyvalue[1])); |
876 } | 862 } |
877 } | 863 } |
878 | 864 |
879 | |
880 var h = { | 865 var h = { |
881 "content-type" : "application/json; charset=utf-8", | 866 "content-type": "application/json; charset=utf-8", |
882 }; | 867 }; |
883 var resp = convert.JSON.encode(buildEmpty()); | 868 var resp = convert.JSON.encode(buildEmpty()); |
884 return new async.Future.value(stringResponse(200, h, resp)); | 869 return new async.Future.value(stringResponse(200, h, resp)); |
885 }), true); | 870 }), true); |
886 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { | 871 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { |
887 checkEmpty(response); | 872 checkEmpty(response); |
888 }))); | 873 }))); |
889 }); | 874 }); |
890 | 875 |
891 unittest.test("method--get", () { | 876 unittest.test("method--get", () { |
892 | |
893 var mock = new HttpServerMock(); | 877 var mock = new HttpServerMock(); |
894 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re
pos; | 878 api.ProjectsReposResourceApi res = |
| 879 new api.SourcerepoApi(mock).projects.repos; |
895 var arg_name = "foo"; | 880 var arg_name = "foo"; |
896 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 881 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
897 var path = (req.url).path; | 882 var path = (req.url).path; |
898 var pathOffset = 0; | 883 var pathOffset = 0; |
899 var index; | 884 var index; |
900 var subPart; | 885 var subPart; |
901 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 886 unittest.expect( |
| 887 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
902 pathOffset += 1; | 888 pathOffset += 1; |
903 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 889 unittest.expect( |
| 890 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
904 pathOffset += 3; | 891 pathOffset += 3; |
905 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 892 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
906 | 893 |
907 var query = (req.url).query; | 894 var query = (req.url).query; |
908 var queryOffset = 0; | 895 var queryOffset = 0; |
909 var queryMap = {}; | 896 var queryMap = {}; |
910 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 897 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
911 parseBool(n) { | 898 parseBool(n) { |
912 if (n == "true") return true; | 899 if (n == "true") return true; |
913 if (n == "false") return false; | 900 if (n == "false") return false; |
914 if (n == null) return null; | 901 if (n == null) return null; |
915 throw new core.ArgumentError("Invalid boolean: $n"); | 902 throw new core.ArgumentError("Invalid boolean: $n"); |
916 } | 903 } |
| 904 |
917 if (query.length > 0) { | 905 if (query.length > 0) { |
918 for (var part in query.split("&")) { | 906 for (var part in query.split("&")) { |
919 var keyvalue = part.split("="); | 907 var keyvalue = part.split("="); |
920 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 908 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 909 core.Uri.decodeQueryComponent(keyvalue[1])); |
921 } | 910 } |
922 } | 911 } |
923 | 912 |
924 | |
925 var h = { | 913 var h = { |
926 "content-type" : "application/json; charset=utf-8", | 914 "content-type": "application/json; charset=utf-8", |
927 }; | 915 }; |
928 var resp = convert.JSON.encode(buildRepo()); | 916 var resp = convert.JSON.encode(buildRepo()); |
929 return new async.Future.value(stringResponse(200, h, resp)); | 917 return new async.Future.value(stringResponse(200, h, resp)); |
930 }), true); | 918 }), true); |
931 res.get(arg_name).then(unittest.expectAsync1(((api.Repo response) { | 919 res.get(arg_name).then(unittest.expectAsync1(((api.Repo response) { |
932 checkRepo(response); | 920 checkRepo(response); |
933 }))); | 921 }))); |
934 }); | 922 }); |
935 | 923 |
936 unittest.test("method--getIamPolicy", () { | 924 unittest.test("method--getIamPolicy", () { |
937 | |
938 var mock = new HttpServerMock(); | 925 var mock = new HttpServerMock(); |
939 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re
pos; | 926 api.ProjectsReposResourceApi res = |
| 927 new api.SourcerepoApi(mock).projects.repos; |
940 var arg_resource = "foo"; | 928 var arg_resource = "foo"; |
941 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 929 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
942 var path = (req.url).path; | 930 var path = (req.url).path; |
943 var pathOffset = 0; | 931 var pathOffset = 0; |
944 var index; | 932 var index; |
945 var subPart; | 933 var subPart; |
946 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 934 unittest.expect( |
| 935 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
947 pathOffset += 1; | 936 pathOffset += 1; |
948 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 937 unittest.expect( |
| 938 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
949 pathOffset += 3; | 939 pathOffset += 3; |
950 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 940 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
951 | 941 |
952 var query = (req.url).query; | 942 var query = (req.url).query; |
953 var queryOffset = 0; | 943 var queryOffset = 0; |
954 var queryMap = {}; | 944 var queryMap = {}; |
955 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 945 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
956 parseBool(n) { | 946 parseBool(n) { |
957 if (n == "true") return true; | 947 if (n == "true") return true; |
958 if (n == "false") return false; | 948 if (n == "false") return false; |
959 if (n == null) return null; | 949 if (n == null) return null; |
960 throw new core.ArgumentError("Invalid boolean: $n"); | 950 throw new core.ArgumentError("Invalid boolean: $n"); |
961 } | 951 } |
| 952 |
962 if (query.length > 0) { | 953 if (query.length > 0) { |
963 for (var part in query.split("&")) { | 954 for (var part in query.split("&")) { |
964 var keyvalue = part.split("="); | 955 var keyvalue = part.split("="); |
965 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 956 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 957 core.Uri.decodeQueryComponent(keyvalue[1])); |
966 } | 958 } |
967 } | 959 } |
968 | 960 |
969 | |
970 var h = { | 961 var h = { |
971 "content-type" : "application/json; charset=utf-8", | 962 "content-type": "application/json; charset=utf-8", |
972 }; | 963 }; |
973 var resp = convert.JSON.encode(buildPolicy()); | 964 var resp = convert.JSON.encode(buildPolicy()); |
974 return new async.Future.value(stringResponse(200, h, resp)); | 965 return new async.Future.value(stringResponse(200, h, resp)); |
975 }), true); | 966 }), true); |
976 res.getIamPolicy(arg_resource).then(unittest.expectAsync1(((api.Policy res
ponse) { | 967 res |
| 968 .getIamPolicy(arg_resource) |
| 969 .then(unittest.expectAsync1(((api.Policy response) { |
977 checkPolicy(response); | 970 checkPolicy(response); |
978 }))); | 971 }))); |
979 }); | 972 }); |
980 | 973 |
981 unittest.test("method--list", () { | 974 unittest.test("method--list", () { |
982 | |
983 var mock = new HttpServerMock(); | 975 var mock = new HttpServerMock(); |
984 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re
pos; | 976 api.ProjectsReposResourceApi res = |
| 977 new api.SourcerepoApi(mock).projects.repos; |
985 var arg_name = "foo"; | 978 var arg_name = "foo"; |
986 var arg_pageToken = "foo"; | 979 var arg_pageToken = "foo"; |
987 var arg_pageSize = 42; | 980 var arg_pageSize = 42; |
988 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 981 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
989 var path = (req.url).path; | 982 var path = (req.url).path; |
990 var pathOffset = 0; | 983 var pathOffset = 0; |
991 var index; | 984 var index; |
992 var subPart; | 985 var subPart; |
993 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 986 unittest.expect( |
| 987 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
994 pathOffset += 1; | 988 pathOffset += 1; |
995 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 989 unittest.expect( |
| 990 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
996 pathOffset += 3; | 991 pathOffset += 3; |
997 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 992 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
998 | 993 |
999 var query = (req.url).query; | 994 var query = (req.url).query; |
1000 var queryOffset = 0; | 995 var queryOffset = 0; |
1001 var queryMap = {}; | 996 var queryMap = {}; |
1002 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 997 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1003 parseBool(n) { | 998 parseBool(n) { |
1004 if (n == "true") return true; | 999 if (n == "true") return true; |
1005 if (n == "false") return false; | 1000 if (n == "false") return false; |
1006 if (n == null) return null; | 1001 if (n == null) return null; |
1007 throw new core.ArgumentError("Invalid boolean: $n"); | 1002 throw new core.ArgumentError("Invalid boolean: $n"); |
1008 } | 1003 } |
| 1004 |
1009 if (query.length > 0) { | 1005 if (query.length > 0) { |
1010 for (var part in query.split("&")) { | 1006 for (var part in query.split("&")) { |
1011 var keyvalue = part.split("="); | 1007 var keyvalue = part.split("="); |
1012 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1008 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1009 core.Uri.decodeQueryComponent(keyvalue[1])); |
1013 } | 1010 } |
1014 } | 1011 } |
1015 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1012 unittest.expect( |
1016 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1013 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1017 | 1014 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1015 unittest.equals(arg_pageSize)); |
1018 | 1016 |
1019 var h = { | 1017 var h = { |
1020 "content-type" : "application/json; charset=utf-8", | 1018 "content-type": "application/json; charset=utf-8", |
1021 }; | 1019 }; |
1022 var resp = convert.JSON.encode(buildListReposResponse()); | 1020 var resp = convert.JSON.encode(buildListReposResponse()); |
1023 return new async.Future.value(stringResponse(200, h, resp)); | 1021 return new async.Future.value(stringResponse(200, h, resp)); |
1024 }), true); | 1022 }), true); |
1025 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize).then(
unittest.expectAsync1(((api.ListReposResponse response) { | 1023 res |
| 1024 .list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize) |
| 1025 .then(unittest.expectAsync1(((api.ListReposResponse response) { |
1026 checkListReposResponse(response); | 1026 checkListReposResponse(response); |
1027 }))); | 1027 }))); |
1028 }); | 1028 }); |
1029 | 1029 |
1030 unittest.test("method--setIamPolicy", () { | 1030 unittest.test("method--setIamPolicy", () { |
1031 | |
1032 var mock = new HttpServerMock(); | 1031 var mock = new HttpServerMock(); |
1033 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re
pos; | 1032 api.ProjectsReposResourceApi res = |
| 1033 new api.SourcerepoApi(mock).projects.repos; |
1034 var arg_request = buildSetIamPolicyRequest(); | 1034 var arg_request = buildSetIamPolicyRequest(); |
1035 var arg_resource = "foo"; | 1035 var arg_resource = "foo"; |
1036 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1036 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1037 var obj = new api.SetIamPolicyRequest.fromJson(json); | 1037 var obj = new api.SetIamPolicyRequest.fromJson(json); |
1038 checkSetIamPolicyRequest(obj); | 1038 checkSetIamPolicyRequest(obj); |
1039 | 1039 |
1040 var path = (req.url).path; | 1040 var path = (req.url).path; |
1041 var pathOffset = 0; | 1041 var pathOffset = 0; |
1042 var index; | 1042 var index; |
1043 var subPart; | 1043 var subPart; |
1044 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1044 unittest.expect( |
| 1045 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1045 pathOffset += 1; | 1046 pathOffset += 1; |
1046 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1047 unittest.expect( |
| 1048 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1047 pathOffset += 3; | 1049 pathOffset += 3; |
1048 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1050 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1049 | 1051 |
1050 var query = (req.url).query; | 1052 var query = (req.url).query; |
1051 var queryOffset = 0; | 1053 var queryOffset = 0; |
1052 var queryMap = {}; | 1054 var queryMap = {}; |
1053 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1055 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1054 parseBool(n) { | 1056 parseBool(n) { |
1055 if (n == "true") return true; | 1057 if (n == "true") return true; |
1056 if (n == "false") return false; | 1058 if (n == "false") return false; |
1057 if (n == null) return null; | 1059 if (n == null) return null; |
1058 throw new core.ArgumentError("Invalid boolean: $n"); | 1060 throw new core.ArgumentError("Invalid boolean: $n"); |
1059 } | 1061 } |
| 1062 |
1060 if (query.length > 0) { | 1063 if (query.length > 0) { |
1061 for (var part in query.split("&")) { | 1064 for (var part in query.split("&")) { |
1062 var keyvalue = part.split("="); | 1065 var keyvalue = part.split("="); |
1063 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1066 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1067 core.Uri.decodeQueryComponent(keyvalue[1])); |
1064 } | 1068 } |
1065 } | 1069 } |
1066 | 1070 |
1067 | |
1068 var h = { | 1071 var h = { |
1069 "content-type" : "application/json; charset=utf-8", | 1072 "content-type": "application/json; charset=utf-8", |
1070 }; | 1073 }; |
1071 var resp = convert.JSON.encode(buildPolicy()); | 1074 var resp = convert.JSON.encode(buildPolicy()); |
1072 return new async.Future.value(stringResponse(200, h, resp)); | 1075 return new async.Future.value(stringResponse(200, h, resp)); |
1073 }), true); | 1076 }), true); |
1074 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1077 res |
| 1078 .setIamPolicy(arg_request, arg_resource) |
| 1079 .then(unittest.expectAsync1(((api.Policy response) { |
1075 checkPolicy(response); | 1080 checkPolicy(response); |
1076 }))); | 1081 }))); |
1077 }); | 1082 }); |
1078 | 1083 |
1079 unittest.test("method--testIamPermissions", () { | 1084 unittest.test("method--testIamPermissions", () { |
1080 | |
1081 var mock = new HttpServerMock(); | 1085 var mock = new HttpServerMock(); |
1082 api.ProjectsReposResourceApi res = new api.SourcerepoApi(mock).projects.re
pos; | 1086 api.ProjectsReposResourceApi res = |
| 1087 new api.SourcerepoApi(mock).projects.repos; |
1083 var arg_request = buildTestIamPermissionsRequest(); | 1088 var arg_request = buildTestIamPermissionsRequest(); |
1084 var arg_resource = "foo"; | 1089 var arg_resource = "foo"; |
1085 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1090 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1086 var obj = new api.TestIamPermissionsRequest.fromJson(json); | 1091 var obj = new api.TestIamPermissionsRequest.fromJson(json); |
1087 checkTestIamPermissionsRequest(obj); | 1092 checkTestIamPermissionsRequest(obj); |
1088 | 1093 |
1089 var path = (req.url).path; | 1094 var path = (req.url).path; |
1090 var pathOffset = 0; | 1095 var pathOffset = 0; |
1091 var index; | 1096 var index; |
1092 var subPart; | 1097 var subPart; |
1093 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1098 unittest.expect( |
| 1099 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1094 pathOffset += 1; | 1100 pathOffset += 1; |
1095 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1101 unittest.expect( |
| 1102 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1096 pathOffset += 3; | 1103 pathOffset += 3; |
1097 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1104 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1098 | 1105 |
1099 var query = (req.url).query; | 1106 var query = (req.url).query; |
1100 var queryOffset = 0; | 1107 var queryOffset = 0; |
1101 var queryMap = {}; | 1108 var queryMap = {}; |
1102 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1109 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1103 parseBool(n) { | 1110 parseBool(n) { |
1104 if (n == "true") return true; | 1111 if (n == "true") return true; |
1105 if (n == "false") return false; | 1112 if (n == "false") return false; |
1106 if (n == null) return null; | 1113 if (n == null) return null; |
1107 throw new core.ArgumentError("Invalid boolean: $n"); | 1114 throw new core.ArgumentError("Invalid boolean: $n"); |
1108 } | 1115 } |
| 1116 |
1109 if (query.length > 0) { | 1117 if (query.length > 0) { |
1110 for (var part in query.split("&")) { | 1118 for (var part in query.split("&")) { |
1111 var keyvalue = part.split("="); | 1119 var keyvalue = part.split("="); |
1112 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1120 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1121 core.Uri.decodeQueryComponent(keyvalue[1])); |
1113 } | 1122 } |
1114 } | 1123 } |
1115 | 1124 |
1116 | |
1117 var h = { | 1125 var h = { |
1118 "content-type" : "application/json; charset=utf-8", | 1126 "content-type": "application/json; charset=utf-8", |
1119 }; | 1127 }; |
1120 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | 1128 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
1121 return new async.Future.value(stringResponse(200, h, resp)); | 1129 return new async.Future.value(stringResponse(200, h, resp)); |
1122 }), true); | 1130 }), true); |
1123 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c1(((api.TestIamPermissionsResponse response) { | 1131 res.testIamPermissions(arg_request, arg_resource).then( |
| 1132 unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
1124 checkTestIamPermissionsResponse(response); | 1133 checkTestIamPermissionsResponse(response); |
1125 }))); | 1134 }))); |
1126 }); | 1135 }); |
1127 | |
1128 }); | 1136 }); |
1129 | |
1130 | |
1131 } | 1137 } |
1132 | |
OLD | NEW |