OLD | NEW |
1 library googleapis.cloudresourcemanager.v2beta1.test; | 1 library googleapis.cloudresourcemanager.v2beta1.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/cloudresourcemanager/v2beta1.dart' as api; | 10 import 'package:googleapis/cloudresourcemanager/v2beta1.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 buildUnnamed88() { | 53 buildUnnamed83() { |
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 checkUnnamed88(core.List<api.AuditLogConfig> o) { | 60 checkUnnamed83(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 core.int buildCounterAuditConfig = 0; | 66 core.int buildCounterAuditConfig = 0; |
68 buildAuditConfig() { | 67 buildAuditConfig() { |
69 var o = new api.AuditConfig(); | 68 var o = new api.AuditConfig(); |
70 buildCounterAuditConfig++; | 69 buildCounterAuditConfig++; |
71 if (buildCounterAuditConfig < 3) { | 70 if (buildCounterAuditConfig < 3) { |
72 o.auditLogConfigs = buildUnnamed88(); | 71 o.auditLogConfigs = buildUnnamed83(); |
73 o.service = "foo"; | 72 o.service = "foo"; |
74 } | 73 } |
75 buildCounterAuditConfig--; | 74 buildCounterAuditConfig--; |
76 return o; | 75 return o; |
77 } | 76 } |
78 | 77 |
79 checkAuditConfig(api.AuditConfig o) { | 78 checkAuditConfig(api.AuditConfig o) { |
80 buildCounterAuditConfig++; | 79 buildCounterAuditConfig++; |
81 if (buildCounterAuditConfig < 3) { | 80 if (buildCounterAuditConfig < 3) { |
82 checkUnnamed88(o.auditLogConfigs); | 81 checkUnnamed83(o.auditLogConfigs); |
83 unittest.expect(o.service, unittest.equals('foo')); | 82 unittest.expect(o.service, unittest.equals('foo')); |
84 } | 83 } |
85 buildCounterAuditConfig--; | 84 buildCounterAuditConfig--; |
86 } | 85 } |
87 | 86 |
88 buildUnnamed89() { | 87 buildUnnamed84() { |
89 var o = new core.List<core.String>(); | 88 var o = new core.List<core.String>(); |
90 o.add("foo"); | 89 o.add("foo"); |
91 o.add("foo"); | 90 o.add("foo"); |
92 return o; | 91 return o; |
93 } | 92 } |
94 | 93 |
95 checkUnnamed89(core.List<core.String> o) { | 94 checkUnnamed84(core.List<core.String> o) { |
96 unittest.expect(o, unittest.hasLength(2)); | 95 unittest.expect(o, unittest.hasLength(2)); |
97 unittest.expect(o[0], unittest.equals('foo')); | 96 unittest.expect(o[0], unittest.equals('foo')); |
98 unittest.expect(o[1], unittest.equals('foo')); | 97 unittest.expect(o[1], unittest.equals('foo')); |
99 } | 98 } |
100 | 99 |
101 core.int buildCounterAuditLogConfig = 0; | 100 core.int buildCounterAuditLogConfig = 0; |
102 buildAuditLogConfig() { | 101 buildAuditLogConfig() { |
103 var o = new api.AuditLogConfig(); | 102 var o = new api.AuditLogConfig(); |
104 buildCounterAuditLogConfig++; | 103 buildCounterAuditLogConfig++; |
105 if (buildCounterAuditLogConfig < 3) { | 104 if (buildCounterAuditLogConfig < 3) { |
106 o.exemptedMembers = buildUnnamed89(); | 105 o.exemptedMembers = buildUnnamed84(); |
107 o.logType = "foo"; | 106 o.logType = "foo"; |
108 } | 107 } |
109 buildCounterAuditLogConfig--; | 108 buildCounterAuditLogConfig--; |
110 return o; | 109 return o; |
111 } | 110 } |
112 | 111 |
113 checkAuditLogConfig(api.AuditLogConfig o) { | 112 checkAuditLogConfig(api.AuditLogConfig o) { |
114 buildCounterAuditLogConfig++; | 113 buildCounterAuditLogConfig++; |
115 if (buildCounterAuditLogConfig < 3) { | 114 if (buildCounterAuditLogConfig < 3) { |
116 checkUnnamed89(o.exemptedMembers); | 115 checkUnnamed84(o.exemptedMembers); |
117 unittest.expect(o.logType, unittest.equals('foo')); | 116 unittest.expect(o.logType, unittest.equals('foo')); |
118 } | 117 } |
119 buildCounterAuditLogConfig--; | 118 buildCounterAuditLogConfig--; |
120 } | 119 } |
121 | 120 |
122 buildUnnamed90() { | 121 buildUnnamed85() { |
123 var o = new core.List<core.String>(); | 122 var o = new core.List<core.String>(); |
124 o.add("foo"); | 123 o.add("foo"); |
125 o.add("foo"); | 124 o.add("foo"); |
126 return o; | 125 return o; |
127 } | 126 } |
128 | 127 |
129 checkUnnamed90(core.List<core.String> o) { | 128 checkUnnamed85(core.List<core.String> o) { |
130 unittest.expect(o, unittest.hasLength(2)); | 129 unittest.expect(o, unittest.hasLength(2)); |
131 unittest.expect(o[0], unittest.equals('foo')); | 130 unittest.expect(o[0], unittest.equals('foo')); |
132 unittest.expect(o[1], unittest.equals('foo')); | 131 unittest.expect(o[1], unittest.equals('foo')); |
133 } | 132 } |
134 | 133 |
135 core.int buildCounterBinding = 0; | 134 core.int buildCounterBinding = 0; |
136 buildBinding() { | 135 buildBinding() { |
137 var o = new api.Binding(); | 136 var o = new api.Binding(); |
138 buildCounterBinding++; | 137 buildCounterBinding++; |
139 if (buildCounterBinding < 3) { | 138 if (buildCounterBinding < 3) { |
140 o.members = buildUnnamed90(); | 139 o.members = buildUnnamed85(); |
141 o.role = "foo"; | 140 o.role = "foo"; |
142 } | 141 } |
143 buildCounterBinding--; | 142 buildCounterBinding--; |
144 return o; | 143 return o; |
145 } | 144 } |
146 | 145 |
147 checkBinding(api.Binding o) { | 146 checkBinding(api.Binding o) { |
148 buildCounterBinding++; | 147 buildCounterBinding++; |
149 if (buildCounterBinding < 3) { | 148 if (buildCounterBinding < 3) { |
150 checkUnnamed90(o.members); | 149 checkUnnamed85(o.members); |
151 unittest.expect(o.role, unittest.equals('foo')); | 150 unittest.expect(o.role, unittest.equals('foo')); |
152 } | 151 } |
153 buildCounterBinding--; | 152 buildCounterBinding--; |
154 } | 153 } |
155 | 154 |
156 core.int buildCounterFolder = 0; | 155 core.int buildCounterFolder = 0; |
157 buildFolder() { | 156 buildFolder() { |
158 var o = new api.Folder(); | 157 var o = new api.Folder(); |
159 buildCounterFolder++; | 158 buildCounterFolder++; |
160 if (buildCounterFolder < 3) { | 159 if (buildCounterFolder < 3) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 if (buildCounterFolderOperationError < 3) { | 220 if (buildCounterFolderOperationError < 3) { |
222 unittest.expect(o.errorMessageId, unittest.equals('foo')); | 221 unittest.expect(o.errorMessageId, unittest.equals('foo')); |
223 } | 222 } |
224 buildCounterFolderOperationError--; | 223 buildCounterFolderOperationError--; |
225 } | 224 } |
226 | 225 |
227 core.int buildCounterGetIamPolicyRequest = 0; | 226 core.int buildCounterGetIamPolicyRequest = 0; |
228 buildGetIamPolicyRequest() { | 227 buildGetIamPolicyRequest() { |
229 var o = new api.GetIamPolicyRequest(); | 228 var o = new api.GetIamPolicyRequest(); |
230 buildCounterGetIamPolicyRequest++; | 229 buildCounterGetIamPolicyRequest++; |
231 if (buildCounterGetIamPolicyRequest < 3) { | 230 if (buildCounterGetIamPolicyRequest < 3) {} |
232 } | |
233 buildCounterGetIamPolicyRequest--; | 231 buildCounterGetIamPolicyRequest--; |
234 return o; | 232 return o; |
235 } | 233 } |
236 | 234 |
237 checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { | 235 checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
238 buildCounterGetIamPolicyRequest++; | 236 buildCounterGetIamPolicyRequest++; |
239 if (buildCounterGetIamPolicyRequest < 3) { | 237 if (buildCounterGetIamPolicyRequest < 3) {} |
240 } | |
241 buildCounterGetIamPolicyRequest--; | 238 buildCounterGetIamPolicyRequest--; |
242 } | 239 } |
243 | 240 |
244 buildUnnamed91() { | 241 buildUnnamed86() { |
245 var o = new core.List<api.Folder>(); | 242 var o = new core.List<api.Folder>(); |
246 o.add(buildFolder()); | 243 o.add(buildFolder()); |
247 o.add(buildFolder()); | 244 o.add(buildFolder()); |
248 return o; | 245 return o; |
249 } | 246 } |
250 | 247 |
251 checkUnnamed91(core.List<api.Folder> o) { | 248 checkUnnamed86(core.List<api.Folder> o) { |
252 unittest.expect(o, unittest.hasLength(2)); | 249 unittest.expect(o, unittest.hasLength(2)); |
253 checkFolder(o[0]); | 250 checkFolder(o[0]); |
254 checkFolder(o[1]); | 251 checkFolder(o[1]); |
255 } | 252 } |
256 | 253 |
257 core.int buildCounterListFoldersResponse = 0; | 254 core.int buildCounterListFoldersResponse = 0; |
258 buildListFoldersResponse() { | 255 buildListFoldersResponse() { |
259 var o = new api.ListFoldersResponse(); | 256 var o = new api.ListFoldersResponse(); |
260 buildCounterListFoldersResponse++; | 257 buildCounterListFoldersResponse++; |
261 if (buildCounterListFoldersResponse < 3) { | 258 if (buildCounterListFoldersResponse < 3) { |
262 o.folders = buildUnnamed91(); | 259 o.folders = buildUnnamed86(); |
263 o.nextPageToken = "foo"; | 260 o.nextPageToken = "foo"; |
264 } | 261 } |
265 buildCounterListFoldersResponse--; | 262 buildCounterListFoldersResponse--; |
266 return o; | 263 return o; |
267 } | 264 } |
268 | 265 |
269 checkListFoldersResponse(api.ListFoldersResponse o) { | 266 checkListFoldersResponse(api.ListFoldersResponse o) { |
270 buildCounterListFoldersResponse++; | 267 buildCounterListFoldersResponse++; |
271 if (buildCounterListFoldersResponse < 3) { | 268 if (buildCounterListFoldersResponse < 3) { |
272 checkUnnamed91(o.folders); | 269 checkUnnamed86(o.folders); |
273 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 270 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
274 } | 271 } |
275 buildCounterListFoldersResponse--; | 272 buildCounterListFoldersResponse--; |
276 } | 273 } |
277 | 274 |
278 core.int buildCounterMoveFolderRequest = 0; | 275 core.int buildCounterMoveFolderRequest = 0; |
279 buildMoveFolderRequest() { | 276 buildMoveFolderRequest() { |
280 var o = new api.MoveFolderRequest(); | 277 var o = new api.MoveFolderRequest(); |
281 buildCounterMoveFolderRequest++; | 278 buildCounterMoveFolderRequest++; |
282 if (buildCounterMoveFolderRequest < 3) { | 279 if (buildCounterMoveFolderRequest < 3) { |
283 o.destinationParent = "foo"; | 280 o.destinationParent = "foo"; |
284 } | 281 } |
285 buildCounterMoveFolderRequest--; | 282 buildCounterMoveFolderRequest--; |
286 return o; | 283 return o; |
287 } | 284 } |
288 | 285 |
289 checkMoveFolderRequest(api.MoveFolderRequest o) { | 286 checkMoveFolderRequest(api.MoveFolderRequest o) { |
290 buildCounterMoveFolderRequest++; | 287 buildCounterMoveFolderRequest++; |
291 if (buildCounterMoveFolderRequest < 3) { | 288 if (buildCounterMoveFolderRequest < 3) { |
292 unittest.expect(o.destinationParent, unittest.equals('foo')); | 289 unittest.expect(o.destinationParent, unittest.equals('foo')); |
293 } | 290 } |
294 buildCounterMoveFolderRequest--; | 291 buildCounterMoveFolderRequest--; |
295 } | 292 } |
296 | 293 |
297 buildUnnamed92() { | 294 buildUnnamed87() { |
298 var o = new core.Map<core.String, core.Object>(); | 295 var o = new core.Map<core.String, core.Object>(); |
299 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 296 o["x"] = { |
300 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 297 'list': [1, 2, 3], |
| 298 'bool': true, |
| 299 'string': 'foo' |
| 300 }; |
| 301 o["y"] = { |
| 302 'list': [1, 2, 3], |
| 303 'bool': true, |
| 304 'string': 'foo' |
| 305 }; |
301 return o; | 306 return o; |
302 } | 307 } |
303 | 308 |
304 checkUnnamed92(core.Map<core.String, core.Object> o) { | 309 checkUnnamed87(core.Map<core.String, core.Object> o) { |
305 unittest.expect(o, unittest.hasLength(2)); | 310 unittest.expect(o, unittest.hasLength(2)); |
306 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | 311 var casted1 = (o["x"]) as core.Map; |
307 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | 312 unittest.expect(casted1, unittest.hasLength(3)); |
| 313 unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); |
| 314 unittest.expect(casted1["bool"], unittest.equals(true)); |
| 315 unittest.expect(casted1["string"], unittest.equals('foo')); |
| 316 var casted2 = (o["y"]) as core.Map; |
| 317 unittest.expect(casted2, unittest.hasLength(3)); |
| 318 unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); |
| 319 unittest.expect(casted2["bool"], unittest.equals(true)); |
| 320 unittest.expect(casted2["string"], unittest.equals('foo')); |
308 } | 321 } |
309 | 322 |
310 buildUnnamed93() { | 323 buildUnnamed88() { |
311 var o = new core.Map<core.String, core.Object>(); | 324 var o = new core.Map<core.String, core.Object>(); |
312 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 325 o["x"] = { |
313 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 326 'list': [1, 2, 3], |
| 327 'bool': true, |
| 328 'string': 'foo' |
| 329 }; |
| 330 o["y"] = { |
| 331 'list': [1, 2, 3], |
| 332 'bool': true, |
| 333 'string': 'foo' |
| 334 }; |
314 return o; | 335 return o; |
315 } | 336 } |
316 | 337 |
317 checkUnnamed93(core.Map<core.String, core.Object> o) { | 338 checkUnnamed88(core.Map<core.String, core.Object> o) { |
318 unittest.expect(o, unittest.hasLength(2)); | 339 unittest.expect(o, unittest.hasLength(2)); |
319 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); | 340 var casted3 = (o["x"]) as core.Map; |
320 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); | 341 unittest.expect(casted3, unittest.hasLength(3)); |
| 342 unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); |
| 343 unittest.expect(casted3["bool"], unittest.equals(true)); |
| 344 unittest.expect(casted3["string"], unittest.equals('foo')); |
| 345 var casted4 = (o["y"]) as core.Map; |
| 346 unittest.expect(casted4, unittest.hasLength(3)); |
| 347 unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); |
| 348 unittest.expect(casted4["bool"], unittest.equals(true)); |
| 349 unittest.expect(casted4["string"], unittest.equals('foo')); |
321 } | 350 } |
322 | 351 |
323 core.int buildCounterOperation = 0; | 352 core.int buildCounterOperation = 0; |
324 buildOperation() { | 353 buildOperation() { |
325 var o = new api.Operation(); | 354 var o = new api.Operation(); |
326 buildCounterOperation++; | 355 buildCounterOperation++; |
327 if (buildCounterOperation < 3) { | 356 if (buildCounterOperation < 3) { |
328 o.done = true; | 357 o.done = true; |
329 o.error = buildStatus(); | 358 o.error = buildStatus(); |
330 o.metadata = buildUnnamed92(); | 359 o.metadata = buildUnnamed87(); |
331 o.name = "foo"; | 360 o.name = "foo"; |
332 o.response = buildUnnamed93(); | 361 o.response = buildUnnamed88(); |
333 } | 362 } |
334 buildCounterOperation--; | 363 buildCounterOperation--; |
335 return o; | 364 return o; |
336 } | 365 } |
337 | 366 |
338 checkOperation(api.Operation o) { | 367 checkOperation(api.Operation o) { |
339 buildCounterOperation++; | 368 buildCounterOperation++; |
340 if (buildCounterOperation < 3) { | 369 if (buildCounterOperation < 3) { |
341 unittest.expect(o.done, unittest.isTrue); | 370 unittest.expect(o.done, unittest.isTrue); |
342 checkStatus(o.error); | 371 checkStatus(o.error); |
343 checkUnnamed92(o.metadata); | 372 checkUnnamed87(o.metadata); |
344 unittest.expect(o.name, unittest.equals('foo')); | 373 unittest.expect(o.name, unittest.equals('foo')); |
345 checkUnnamed93(o.response); | 374 checkUnnamed88(o.response); |
346 } | 375 } |
347 buildCounterOperation--; | 376 buildCounterOperation--; |
348 } | 377 } |
349 | 378 |
350 buildUnnamed94() { | 379 buildUnnamed89() { |
351 var o = new core.List<api.AuditConfig>(); | 380 var o = new core.List<api.AuditConfig>(); |
352 o.add(buildAuditConfig()); | 381 o.add(buildAuditConfig()); |
353 o.add(buildAuditConfig()); | 382 o.add(buildAuditConfig()); |
354 return o; | 383 return o; |
355 } | 384 } |
356 | 385 |
357 checkUnnamed94(core.List<api.AuditConfig> o) { | 386 checkUnnamed89(core.List<api.AuditConfig> o) { |
358 unittest.expect(o, unittest.hasLength(2)); | 387 unittest.expect(o, unittest.hasLength(2)); |
359 checkAuditConfig(o[0]); | 388 checkAuditConfig(o[0]); |
360 checkAuditConfig(o[1]); | 389 checkAuditConfig(o[1]); |
361 } | 390 } |
362 | 391 |
363 buildUnnamed95() { | 392 buildUnnamed90() { |
364 var o = new core.List<api.Binding>(); | 393 var o = new core.List<api.Binding>(); |
365 o.add(buildBinding()); | 394 o.add(buildBinding()); |
366 o.add(buildBinding()); | 395 o.add(buildBinding()); |
367 return o; | 396 return o; |
368 } | 397 } |
369 | 398 |
370 checkUnnamed95(core.List<api.Binding> o) { | 399 checkUnnamed90(core.List<api.Binding> o) { |
371 unittest.expect(o, unittest.hasLength(2)); | 400 unittest.expect(o, unittest.hasLength(2)); |
372 checkBinding(o[0]); | 401 checkBinding(o[0]); |
373 checkBinding(o[1]); | 402 checkBinding(o[1]); |
374 } | 403 } |
375 | 404 |
376 core.int buildCounterPolicy = 0; | 405 core.int buildCounterPolicy = 0; |
377 buildPolicy() { | 406 buildPolicy() { |
378 var o = new api.Policy(); | 407 var o = new api.Policy(); |
379 buildCounterPolicy++; | 408 buildCounterPolicy++; |
380 if (buildCounterPolicy < 3) { | 409 if (buildCounterPolicy < 3) { |
381 o.auditConfigs = buildUnnamed94(); | 410 o.auditConfigs = buildUnnamed89(); |
382 o.bindings = buildUnnamed95(); | 411 o.bindings = buildUnnamed90(); |
383 o.etag = "foo"; | 412 o.etag = "foo"; |
384 o.version = 42; | 413 o.version = 42; |
385 } | 414 } |
386 buildCounterPolicy--; | 415 buildCounterPolicy--; |
387 return o; | 416 return o; |
388 } | 417 } |
389 | 418 |
390 checkPolicy(api.Policy o) { | 419 checkPolicy(api.Policy o) { |
391 buildCounterPolicy++; | 420 buildCounterPolicy++; |
392 if (buildCounterPolicy < 3) { | 421 if (buildCounterPolicy < 3) { |
393 checkUnnamed94(o.auditConfigs); | 422 checkUnnamed89(o.auditConfigs); |
394 checkUnnamed95(o.bindings); | 423 checkUnnamed90(o.bindings); |
395 unittest.expect(o.etag, unittest.equals('foo')); | 424 unittest.expect(o.etag, unittest.equals('foo')); |
396 unittest.expect(o.version, unittest.equals(42)); | 425 unittest.expect(o.version, unittest.equals(42)); |
397 } | 426 } |
398 buildCounterPolicy--; | 427 buildCounterPolicy--; |
399 } | 428 } |
400 | 429 |
401 core.int buildCounterProjectCreationStatus = 0; | 430 core.int buildCounterProjectCreationStatus = 0; |
402 buildProjectCreationStatus() { | 431 buildProjectCreationStatus() { |
403 var o = new api.ProjectCreationStatus(); | 432 var o = new api.ProjectCreationStatus(); |
404 buildCounterProjectCreationStatus++; | 433 buildCounterProjectCreationStatus++; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 checkSearchFoldersRequest(api.SearchFoldersRequest o) { | 466 checkSearchFoldersRequest(api.SearchFoldersRequest o) { |
438 buildCounterSearchFoldersRequest++; | 467 buildCounterSearchFoldersRequest++; |
439 if (buildCounterSearchFoldersRequest < 3) { | 468 if (buildCounterSearchFoldersRequest < 3) { |
440 unittest.expect(o.pageSize, unittest.equals(42)); | 469 unittest.expect(o.pageSize, unittest.equals(42)); |
441 unittest.expect(o.pageToken, unittest.equals('foo')); | 470 unittest.expect(o.pageToken, unittest.equals('foo')); |
442 unittest.expect(o.query, unittest.equals('foo')); | 471 unittest.expect(o.query, unittest.equals('foo')); |
443 } | 472 } |
444 buildCounterSearchFoldersRequest--; | 473 buildCounterSearchFoldersRequest--; |
445 } | 474 } |
446 | 475 |
447 buildUnnamed96() { | 476 buildUnnamed91() { |
448 var o = new core.List<api.Folder>(); | 477 var o = new core.List<api.Folder>(); |
449 o.add(buildFolder()); | 478 o.add(buildFolder()); |
450 o.add(buildFolder()); | 479 o.add(buildFolder()); |
451 return o; | 480 return o; |
452 } | 481 } |
453 | 482 |
454 checkUnnamed96(core.List<api.Folder> o) { | 483 checkUnnamed91(core.List<api.Folder> o) { |
455 unittest.expect(o, unittest.hasLength(2)); | 484 unittest.expect(o, unittest.hasLength(2)); |
456 checkFolder(o[0]); | 485 checkFolder(o[0]); |
457 checkFolder(o[1]); | 486 checkFolder(o[1]); |
458 } | 487 } |
459 | 488 |
460 core.int buildCounterSearchFoldersResponse = 0; | 489 core.int buildCounterSearchFoldersResponse = 0; |
461 buildSearchFoldersResponse() { | 490 buildSearchFoldersResponse() { |
462 var o = new api.SearchFoldersResponse(); | 491 var o = new api.SearchFoldersResponse(); |
463 buildCounterSearchFoldersResponse++; | 492 buildCounterSearchFoldersResponse++; |
464 if (buildCounterSearchFoldersResponse < 3) { | 493 if (buildCounterSearchFoldersResponse < 3) { |
465 o.folders = buildUnnamed96(); | 494 o.folders = buildUnnamed91(); |
466 o.nextPageToken = "foo"; | 495 o.nextPageToken = "foo"; |
467 } | 496 } |
468 buildCounterSearchFoldersResponse--; | 497 buildCounterSearchFoldersResponse--; |
469 return o; | 498 return o; |
470 } | 499 } |
471 | 500 |
472 checkSearchFoldersResponse(api.SearchFoldersResponse o) { | 501 checkSearchFoldersResponse(api.SearchFoldersResponse o) { |
473 buildCounterSearchFoldersResponse++; | 502 buildCounterSearchFoldersResponse++; |
474 if (buildCounterSearchFoldersResponse < 3) { | 503 if (buildCounterSearchFoldersResponse < 3) { |
475 checkUnnamed96(o.folders); | 504 checkUnnamed91(o.folders); |
476 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 505 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
477 } | 506 } |
478 buildCounterSearchFoldersResponse--; | 507 buildCounterSearchFoldersResponse--; |
479 } | 508 } |
480 | 509 |
481 core.int buildCounterSetIamPolicyRequest = 0; | 510 core.int buildCounterSetIamPolicyRequest = 0; |
482 buildSetIamPolicyRequest() { | 511 buildSetIamPolicyRequest() { |
483 var o = new api.SetIamPolicyRequest(); | 512 var o = new api.SetIamPolicyRequest(); |
484 buildCounterSetIamPolicyRequest++; | 513 buildCounterSetIamPolicyRequest++; |
485 if (buildCounterSetIamPolicyRequest < 3) { | 514 if (buildCounterSetIamPolicyRequest < 3) { |
486 o.policy = buildPolicy(); | 515 o.policy = buildPolicy(); |
487 o.updateMask = "foo"; | 516 o.updateMask = "foo"; |
488 } | 517 } |
489 buildCounterSetIamPolicyRequest--; | 518 buildCounterSetIamPolicyRequest--; |
490 return o; | 519 return o; |
491 } | 520 } |
492 | 521 |
493 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { | 522 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
494 buildCounterSetIamPolicyRequest++; | 523 buildCounterSetIamPolicyRequest++; |
495 if (buildCounterSetIamPolicyRequest < 3) { | 524 if (buildCounterSetIamPolicyRequest < 3) { |
496 checkPolicy(o.policy); | 525 checkPolicy(o.policy); |
497 unittest.expect(o.updateMask, unittest.equals('foo')); | 526 unittest.expect(o.updateMask, unittest.equals('foo')); |
498 } | 527 } |
499 buildCounterSetIamPolicyRequest--; | 528 buildCounterSetIamPolicyRequest--; |
500 } | 529 } |
501 | 530 |
502 buildUnnamed97() { | 531 buildUnnamed92() { |
503 var o = new core.Map<core.String, core.Object>(); | 532 var o = new core.Map<core.String, core.Object>(); |
504 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 533 o["x"] = { |
505 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 534 'list': [1, 2, 3], |
| 535 'bool': true, |
| 536 'string': 'foo' |
| 537 }; |
| 538 o["y"] = { |
| 539 'list': [1, 2, 3], |
| 540 'bool': true, |
| 541 'string': 'foo' |
| 542 }; |
506 return o; | 543 return o; |
507 } | 544 } |
508 | 545 |
509 checkUnnamed97(core.Map<core.String, core.Object> o) { | 546 checkUnnamed92(core.Map<core.String, core.Object> o) { |
510 unittest.expect(o, unittest.hasLength(2)); | 547 unittest.expect(o, unittest.hasLength(2)); |
511 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); | 548 var casted5 = (o["x"]) as core.Map; |
512 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); | 549 unittest.expect(casted5, unittest.hasLength(3)); |
| 550 unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); |
| 551 unittest.expect(casted5["bool"], unittest.equals(true)); |
| 552 unittest.expect(casted5["string"], unittest.equals('foo')); |
| 553 var casted6 = (o["y"]) as core.Map; |
| 554 unittest.expect(casted6, unittest.hasLength(3)); |
| 555 unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); |
| 556 unittest.expect(casted6["bool"], unittest.equals(true)); |
| 557 unittest.expect(casted6["string"], unittest.equals('foo')); |
513 } | 558 } |
514 | 559 |
515 buildUnnamed98() { | 560 buildUnnamed93() { |
516 var o = new core.List<core.Map<core.String, core.Object>>(); | 561 var o = new core.List<core.Map<core.String, core.Object>>(); |
517 o.add(buildUnnamed97()); | 562 o.add(buildUnnamed92()); |
518 o.add(buildUnnamed97()); | 563 o.add(buildUnnamed92()); |
519 return o; | 564 return o; |
520 } | 565 } |
521 | 566 |
522 checkUnnamed98(core.List<core.Map<core.String, core.Object>> o) { | 567 checkUnnamed93(core.List<core.Map<core.String, core.Object>> o) { |
523 unittest.expect(o, unittest.hasLength(2)); | 568 unittest.expect(o, unittest.hasLength(2)); |
524 checkUnnamed97(o[0]); | 569 checkUnnamed92(o[0]); |
525 checkUnnamed97(o[1]); | 570 checkUnnamed92(o[1]); |
526 } | 571 } |
527 | 572 |
528 core.int buildCounterStatus = 0; | 573 core.int buildCounterStatus = 0; |
529 buildStatus() { | 574 buildStatus() { |
530 var o = new api.Status(); | 575 var o = new api.Status(); |
531 buildCounterStatus++; | 576 buildCounterStatus++; |
532 if (buildCounterStatus < 3) { | 577 if (buildCounterStatus < 3) { |
533 o.code = 42; | 578 o.code = 42; |
534 o.details = buildUnnamed98(); | 579 o.details = buildUnnamed93(); |
535 o.message = "foo"; | 580 o.message = "foo"; |
536 } | 581 } |
537 buildCounterStatus--; | 582 buildCounterStatus--; |
538 return o; | 583 return o; |
539 } | 584 } |
540 | 585 |
541 checkStatus(api.Status o) { | 586 checkStatus(api.Status o) { |
542 buildCounterStatus++; | 587 buildCounterStatus++; |
543 if (buildCounterStatus < 3) { | 588 if (buildCounterStatus < 3) { |
544 unittest.expect(o.code, unittest.equals(42)); | 589 unittest.expect(o.code, unittest.equals(42)); |
545 checkUnnamed98(o.details); | 590 checkUnnamed93(o.details); |
546 unittest.expect(o.message, unittest.equals('foo')); | 591 unittest.expect(o.message, unittest.equals('foo')); |
547 } | 592 } |
548 buildCounterStatus--; | 593 buildCounterStatus--; |
549 } | 594 } |
550 | 595 |
551 buildUnnamed99() { | 596 buildUnnamed94() { |
552 var o = new core.List<core.String>(); | 597 var o = new core.List<core.String>(); |
553 o.add("foo"); | 598 o.add("foo"); |
554 o.add("foo"); | 599 o.add("foo"); |
555 return o; | 600 return o; |
556 } | 601 } |
557 | 602 |
558 checkUnnamed99(core.List<core.String> o) { | 603 checkUnnamed94(core.List<core.String> o) { |
559 unittest.expect(o, unittest.hasLength(2)); | 604 unittest.expect(o, unittest.hasLength(2)); |
560 unittest.expect(o[0], unittest.equals('foo')); | 605 unittest.expect(o[0], unittest.equals('foo')); |
561 unittest.expect(o[1], unittest.equals('foo')); | 606 unittest.expect(o[1], unittest.equals('foo')); |
562 } | 607 } |
563 | 608 |
564 core.int buildCounterTestIamPermissionsRequest = 0; | 609 core.int buildCounterTestIamPermissionsRequest = 0; |
565 buildTestIamPermissionsRequest() { | 610 buildTestIamPermissionsRequest() { |
566 var o = new api.TestIamPermissionsRequest(); | 611 var o = new api.TestIamPermissionsRequest(); |
567 buildCounterTestIamPermissionsRequest++; | 612 buildCounterTestIamPermissionsRequest++; |
568 if (buildCounterTestIamPermissionsRequest < 3) { | 613 if (buildCounterTestIamPermissionsRequest < 3) { |
569 o.permissions = buildUnnamed99(); | 614 o.permissions = buildUnnamed94(); |
570 } | 615 } |
571 buildCounterTestIamPermissionsRequest--; | 616 buildCounterTestIamPermissionsRequest--; |
572 return o; | 617 return o; |
573 } | 618 } |
574 | 619 |
575 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { | 620 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
576 buildCounterTestIamPermissionsRequest++; | 621 buildCounterTestIamPermissionsRequest++; |
577 if (buildCounterTestIamPermissionsRequest < 3) { | 622 if (buildCounterTestIamPermissionsRequest < 3) { |
578 checkUnnamed99(o.permissions); | 623 checkUnnamed94(o.permissions); |
579 } | 624 } |
580 buildCounterTestIamPermissionsRequest--; | 625 buildCounterTestIamPermissionsRequest--; |
581 } | 626 } |
582 | 627 |
583 buildUnnamed100() { | 628 buildUnnamed95() { |
584 var o = new core.List<core.String>(); | 629 var o = new core.List<core.String>(); |
585 o.add("foo"); | 630 o.add("foo"); |
586 o.add("foo"); | 631 o.add("foo"); |
587 return o; | 632 return o; |
588 } | 633 } |
589 | 634 |
590 checkUnnamed100(core.List<core.String> o) { | 635 checkUnnamed95(core.List<core.String> o) { |
591 unittest.expect(o, unittest.hasLength(2)); | 636 unittest.expect(o, unittest.hasLength(2)); |
592 unittest.expect(o[0], unittest.equals('foo')); | 637 unittest.expect(o[0], unittest.equals('foo')); |
593 unittest.expect(o[1], unittest.equals('foo')); | 638 unittest.expect(o[1], unittest.equals('foo')); |
594 } | 639 } |
595 | 640 |
596 core.int buildCounterTestIamPermissionsResponse = 0; | 641 core.int buildCounterTestIamPermissionsResponse = 0; |
597 buildTestIamPermissionsResponse() { | 642 buildTestIamPermissionsResponse() { |
598 var o = new api.TestIamPermissionsResponse(); | 643 var o = new api.TestIamPermissionsResponse(); |
599 buildCounterTestIamPermissionsResponse++; | 644 buildCounterTestIamPermissionsResponse++; |
600 if (buildCounterTestIamPermissionsResponse < 3) { | 645 if (buildCounterTestIamPermissionsResponse < 3) { |
601 o.permissions = buildUnnamed100(); | 646 o.permissions = buildUnnamed95(); |
602 } | 647 } |
603 buildCounterTestIamPermissionsResponse--; | 648 buildCounterTestIamPermissionsResponse--; |
604 return o; | 649 return o; |
605 } | 650 } |
606 | 651 |
607 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { | 652 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
608 buildCounterTestIamPermissionsResponse++; | 653 buildCounterTestIamPermissionsResponse++; |
609 if (buildCounterTestIamPermissionsResponse < 3) { | 654 if (buildCounterTestIamPermissionsResponse < 3) { |
610 checkUnnamed100(o.permissions); | 655 checkUnnamed95(o.permissions); |
611 } | 656 } |
612 buildCounterTestIamPermissionsResponse--; | 657 buildCounterTestIamPermissionsResponse--; |
613 } | 658 } |
614 | 659 |
615 core.int buildCounterUndeleteFolderRequest = 0; | 660 core.int buildCounterUndeleteFolderRequest = 0; |
616 buildUndeleteFolderRequest() { | 661 buildUndeleteFolderRequest() { |
617 var o = new api.UndeleteFolderRequest(); | 662 var o = new api.UndeleteFolderRequest(); |
618 buildCounterUndeleteFolderRequest++; | 663 buildCounterUndeleteFolderRequest++; |
619 if (buildCounterUndeleteFolderRequest < 3) { | 664 if (buildCounterUndeleteFolderRequest < 3) {} |
620 } | |
621 buildCounterUndeleteFolderRequest--; | 665 buildCounterUndeleteFolderRequest--; |
622 return o; | 666 return o; |
623 } | 667 } |
624 | 668 |
625 checkUndeleteFolderRequest(api.UndeleteFolderRequest o) { | 669 checkUndeleteFolderRequest(api.UndeleteFolderRequest o) { |
626 buildCounterUndeleteFolderRequest++; | 670 buildCounterUndeleteFolderRequest++; |
627 if (buildCounterUndeleteFolderRequest < 3) { | 671 if (buildCounterUndeleteFolderRequest < 3) {} |
628 } | |
629 buildCounterUndeleteFolderRequest--; | 672 buildCounterUndeleteFolderRequest--; |
630 } | 673 } |
631 | 674 |
632 | |
633 main() { | 675 main() { |
634 unittest.group("obj-schema-AuditConfig", () { | 676 unittest.group("obj-schema-AuditConfig", () { |
635 unittest.test("to-json--from-json", () { | 677 unittest.test("to-json--from-json", () { |
636 var o = buildAuditConfig(); | 678 var o = buildAuditConfig(); |
637 var od = new api.AuditConfig.fromJson(o.toJson()); | 679 var od = new api.AuditConfig.fromJson(o.toJson()); |
638 checkAuditConfig(od); | 680 checkAuditConfig(od); |
639 }); | 681 }); |
640 }); | 682 }); |
641 | 683 |
642 | |
643 unittest.group("obj-schema-AuditLogConfig", () { | 684 unittest.group("obj-schema-AuditLogConfig", () { |
644 unittest.test("to-json--from-json", () { | 685 unittest.test("to-json--from-json", () { |
645 var o = buildAuditLogConfig(); | 686 var o = buildAuditLogConfig(); |
646 var od = new api.AuditLogConfig.fromJson(o.toJson()); | 687 var od = new api.AuditLogConfig.fromJson(o.toJson()); |
647 checkAuditLogConfig(od); | 688 checkAuditLogConfig(od); |
648 }); | 689 }); |
649 }); | 690 }); |
650 | 691 |
651 | |
652 unittest.group("obj-schema-Binding", () { | 692 unittest.group("obj-schema-Binding", () { |
653 unittest.test("to-json--from-json", () { | 693 unittest.test("to-json--from-json", () { |
654 var o = buildBinding(); | 694 var o = buildBinding(); |
655 var od = new api.Binding.fromJson(o.toJson()); | 695 var od = new api.Binding.fromJson(o.toJson()); |
656 checkBinding(od); | 696 checkBinding(od); |
657 }); | 697 }); |
658 }); | 698 }); |
659 | 699 |
660 | |
661 unittest.group("obj-schema-Folder", () { | 700 unittest.group("obj-schema-Folder", () { |
662 unittest.test("to-json--from-json", () { | 701 unittest.test("to-json--from-json", () { |
663 var o = buildFolder(); | 702 var o = buildFolder(); |
664 var od = new api.Folder.fromJson(o.toJson()); | 703 var od = new api.Folder.fromJson(o.toJson()); |
665 checkFolder(od); | 704 checkFolder(od); |
666 }); | 705 }); |
667 }); | 706 }); |
668 | 707 |
669 | |
670 unittest.group("obj-schema-FolderOperation", () { | 708 unittest.group("obj-schema-FolderOperation", () { |
671 unittest.test("to-json--from-json", () { | 709 unittest.test("to-json--from-json", () { |
672 var o = buildFolderOperation(); | 710 var o = buildFolderOperation(); |
673 var od = new api.FolderOperation.fromJson(o.toJson()); | 711 var od = new api.FolderOperation.fromJson(o.toJson()); |
674 checkFolderOperation(od); | 712 checkFolderOperation(od); |
675 }); | 713 }); |
676 }); | 714 }); |
677 | 715 |
678 | |
679 unittest.group("obj-schema-FolderOperationError", () { | 716 unittest.group("obj-schema-FolderOperationError", () { |
680 unittest.test("to-json--from-json", () { | 717 unittest.test("to-json--from-json", () { |
681 var o = buildFolderOperationError(); | 718 var o = buildFolderOperationError(); |
682 var od = new api.FolderOperationError.fromJson(o.toJson()); | 719 var od = new api.FolderOperationError.fromJson(o.toJson()); |
683 checkFolderOperationError(od); | 720 checkFolderOperationError(od); |
684 }); | 721 }); |
685 }); | 722 }); |
686 | 723 |
687 | |
688 unittest.group("obj-schema-GetIamPolicyRequest", () { | 724 unittest.group("obj-schema-GetIamPolicyRequest", () { |
689 unittest.test("to-json--from-json", () { | 725 unittest.test("to-json--from-json", () { |
690 var o = buildGetIamPolicyRequest(); | 726 var o = buildGetIamPolicyRequest(); |
691 var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); | 727 var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); |
692 checkGetIamPolicyRequest(od); | 728 checkGetIamPolicyRequest(od); |
693 }); | 729 }); |
694 }); | 730 }); |
695 | 731 |
696 | |
697 unittest.group("obj-schema-ListFoldersResponse", () { | 732 unittest.group("obj-schema-ListFoldersResponse", () { |
698 unittest.test("to-json--from-json", () { | 733 unittest.test("to-json--from-json", () { |
699 var o = buildListFoldersResponse(); | 734 var o = buildListFoldersResponse(); |
700 var od = new api.ListFoldersResponse.fromJson(o.toJson()); | 735 var od = new api.ListFoldersResponse.fromJson(o.toJson()); |
701 checkListFoldersResponse(od); | 736 checkListFoldersResponse(od); |
702 }); | 737 }); |
703 }); | 738 }); |
704 | 739 |
705 | |
706 unittest.group("obj-schema-MoveFolderRequest", () { | 740 unittest.group("obj-schema-MoveFolderRequest", () { |
707 unittest.test("to-json--from-json", () { | 741 unittest.test("to-json--from-json", () { |
708 var o = buildMoveFolderRequest(); | 742 var o = buildMoveFolderRequest(); |
709 var od = new api.MoveFolderRequest.fromJson(o.toJson()); | 743 var od = new api.MoveFolderRequest.fromJson(o.toJson()); |
710 checkMoveFolderRequest(od); | 744 checkMoveFolderRequest(od); |
711 }); | 745 }); |
712 }); | 746 }); |
713 | 747 |
714 | |
715 unittest.group("obj-schema-Operation", () { | 748 unittest.group("obj-schema-Operation", () { |
716 unittest.test("to-json--from-json", () { | 749 unittest.test("to-json--from-json", () { |
717 var o = buildOperation(); | 750 var o = buildOperation(); |
718 var od = new api.Operation.fromJson(o.toJson()); | 751 var od = new api.Operation.fromJson(o.toJson()); |
719 checkOperation(od); | 752 checkOperation(od); |
720 }); | 753 }); |
721 }); | 754 }); |
722 | 755 |
723 | |
724 unittest.group("obj-schema-Policy", () { | 756 unittest.group("obj-schema-Policy", () { |
725 unittest.test("to-json--from-json", () { | 757 unittest.test("to-json--from-json", () { |
726 var o = buildPolicy(); | 758 var o = buildPolicy(); |
727 var od = new api.Policy.fromJson(o.toJson()); | 759 var od = new api.Policy.fromJson(o.toJson()); |
728 checkPolicy(od); | 760 checkPolicy(od); |
729 }); | 761 }); |
730 }); | 762 }); |
731 | 763 |
732 | |
733 unittest.group("obj-schema-ProjectCreationStatus", () { | 764 unittest.group("obj-schema-ProjectCreationStatus", () { |
734 unittest.test("to-json--from-json", () { | 765 unittest.test("to-json--from-json", () { |
735 var o = buildProjectCreationStatus(); | 766 var o = buildProjectCreationStatus(); |
736 var od = new api.ProjectCreationStatus.fromJson(o.toJson()); | 767 var od = new api.ProjectCreationStatus.fromJson(o.toJson()); |
737 checkProjectCreationStatus(od); | 768 checkProjectCreationStatus(od); |
738 }); | 769 }); |
739 }); | 770 }); |
740 | 771 |
741 | |
742 unittest.group("obj-schema-SearchFoldersRequest", () { | 772 unittest.group("obj-schema-SearchFoldersRequest", () { |
743 unittest.test("to-json--from-json", () { | 773 unittest.test("to-json--from-json", () { |
744 var o = buildSearchFoldersRequest(); | 774 var o = buildSearchFoldersRequest(); |
745 var od = new api.SearchFoldersRequest.fromJson(o.toJson()); | 775 var od = new api.SearchFoldersRequest.fromJson(o.toJson()); |
746 checkSearchFoldersRequest(od); | 776 checkSearchFoldersRequest(od); |
747 }); | 777 }); |
748 }); | 778 }); |
749 | 779 |
750 | |
751 unittest.group("obj-schema-SearchFoldersResponse", () { | 780 unittest.group("obj-schema-SearchFoldersResponse", () { |
752 unittest.test("to-json--from-json", () { | 781 unittest.test("to-json--from-json", () { |
753 var o = buildSearchFoldersResponse(); | 782 var o = buildSearchFoldersResponse(); |
754 var od = new api.SearchFoldersResponse.fromJson(o.toJson()); | 783 var od = new api.SearchFoldersResponse.fromJson(o.toJson()); |
755 checkSearchFoldersResponse(od); | 784 checkSearchFoldersResponse(od); |
756 }); | 785 }); |
757 }); | 786 }); |
758 | 787 |
759 | |
760 unittest.group("obj-schema-SetIamPolicyRequest", () { | 788 unittest.group("obj-schema-SetIamPolicyRequest", () { |
761 unittest.test("to-json--from-json", () { | 789 unittest.test("to-json--from-json", () { |
762 var o = buildSetIamPolicyRequest(); | 790 var o = buildSetIamPolicyRequest(); |
763 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); | 791 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
764 checkSetIamPolicyRequest(od); | 792 checkSetIamPolicyRequest(od); |
765 }); | 793 }); |
766 }); | 794 }); |
767 | 795 |
768 | |
769 unittest.group("obj-schema-Status", () { | 796 unittest.group("obj-schema-Status", () { |
770 unittest.test("to-json--from-json", () { | 797 unittest.test("to-json--from-json", () { |
771 var o = buildStatus(); | 798 var o = buildStatus(); |
772 var od = new api.Status.fromJson(o.toJson()); | 799 var od = new api.Status.fromJson(o.toJson()); |
773 checkStatus(od); | 800 checkStatus(od); |
774 }); | 801 }); |
775 }); | 802 }); |
776 | 803 |
777 | |
778 unittest.group("obj-schema-TestIamPermissionsRequest", () { | 804 unittest.group("obj-schema-TestIamPermissionsRequest", () { |
779 unittest.test("to-json--from-json", () { | 805 unittest.test("to-json--from-json", () { |
780 var o = buildTestIamPermissionsRequest(); | 806 var o = buildTestIamPermissionsRequest(); |
781 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); | 807 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
782 checkTestIamPermissionsRequest(od); | 808 checkTestIamPermissionsRequest(od); |
783 }); | 809 }); |
784 }); | 810 }); |
785 | 811 |
786 | |
787 unittest.group("obj-schema-TestIamPermissionsResponse", () { | 812 unittest.group("obj-schema-TestIamPermissionsResponse", () { |
788 unittest.test("to-json--from-json", () { | 813 unittest.test("to-json--from-json", () { |
789 var o = buildTestIamPermissionsResponse(); | 814 var o = buildTestIamPermissionsResponse(); |
790 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); | 815 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
791 checkTestIamPermissionsResponse(od); | 816 checkTestIamPermissionsResponse(od); |
792 }); | 817 }); |
793 }); | 818 }); |
794 | 819 |
795 | |
796 unittest.group("obj-schema-UndeleteFolderRequest", () { | 820 unittest.group("obj-schema-UndeleteFolderRequest", () { |
797 unittest.test("to-json--from-json", () { | 821 unittest.test("to-json--from-json", () { |
798 var o = buildUndeleteFolderRequest(); | 822 var o = buildUndeleteFolderRequest(); |
799 var od = new api.UndeleteFolderRequest.fromJson(o.toJson()); | 823 var od = new api.UndeleteFolderRequest.fromJson(o.toJson()); |
800 checkUndeleteFolderRequest(od); | 824 checkUndeleteFolderRequest(od); |
801 }); | 825 }); |
802 }); | 826 }); |
803 | 827 |
804 | |
805 unittest.group("resource-FoldersResourceApi", () { | 828 unittest.group("resource-FoldersResourceApi", () { |
806 unittest.test("method--create", () { | 829 unittest.test("method--create", () { |
807 | |
808 var mock = new HttpServerMock(); | 830 var mock = new HttpServerMock(); |
809 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 831 api.FoldersResourceApi res = |
| 832 new api.CloudresourcemanagerApi(mock).folders; |
810 var arg_request = buildFolder(); | 833 var arg_request = buildFolder(); |
811 var arg_parent = "foo"; | 834 var arg_parent = "foo"; |
812 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 835 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
813 var obj = new api.Folder.fromJson(json); | 836 var obj = new api.Folder.fromJson(json); |
814 checkFolder(obj); | 837 checkFolder(obj); |
815 | 838 |
816 var path = (req.url).path; | 839 var path = (req.url).path; |
817 var pathOffset = 0; | 840 var pathOffset = 0; |
818 var index; | 841 var index; |
819 var subPart; | 842 var subPart; |
820 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 843 unittest.expect( |
| 844 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
821 pathOffset += 1; | 845 pathOffset += 1; |
822 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("v2beta1/folders")); | 846 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 847 unittest.equals("v2beta1/folders")); |
823 pathOffset += 15; | 848 pathOffset += 15; |
824 | 849 |
825 var query = (req.url).query; | 850 var query = (req.url).query; |
826 var queryOffset = 0; | 851 var queryOffset = 0; |
827 var queryMap = {}; | 852 var queryMap = {}; |
828 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 853 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
829 parseBool(n) { | 854 parseBool(n) { |
830 if (n == "true") return true; | 855 if (n == "true") return true; |
831 if (n == "false") return false; | 856 if (n == "false") return false; |
832 if (n == null) return null; | 857 if (n == null) return null; |
833 throw new core.ArgumentError("Invalid boolean: $n"); | 858 throw new core.ArgumentError("Invalid boolean: $n"); |
834 } | 859 } |
| 860 |
835 if (query.length > 0) { | 861 if (query.length > 0) { |
836 for (var part in query.split("&")) { | 862 for (var part in query.split("&")) { |
837 var keyvalue = part.split("="); | 863 var keyvalue = part.split("="); |
838 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 864 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 865 core.Uri.decodeQueryComponent(keyvalue[1])); |
839 } | 866 } |
840 } | 867 } |
841 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); | 868 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
842 | 869 |
843 | |
844 var h = { | 870 var h = { |
845 "content-type" : "application/json; charset=utf-8", | 871 "content-type": "application/json; charset=utf-8", |
846 }; | 872 }; |
847 var resp = convert.JSON.encode(buildOperation()); | 873 var resp = convert.JSON.encode(buildOperation()); |
848 return new async.Future.value(stringResponse(200, h, resp)); | 874 return new async.Future.value(stringResponse(200, h, resp)); |
849 }), true); | 875 }), true); |
850 res.create(arg_request, parent: arg_parent).then(unittest.expectAsync1(((a
pi.Operation response) { | 876 res |
| 877 .create(arg_request, parent: arg_parent) |
| 878 .then(unittest.expectAsync1(((api.Operation response) { |
851 checkOperation(response); | 879 checkOperation(response); |
852 }))); | 880 }))); |
853 }); | 881 }); |
854 | 882 |
855 unittest.test("method--delete", () { | 883 unittest.test("method--delete", () { |
856 | |
857 var mock = new HttpServerMock(); | 884 var mock = new HttpServerMock(); |
858 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 885 api.FoldersResourceApi res = |
| 886 new api.CloudresourcemanagerApi(mock).folders; |
859 var arg_name = "foo"; | 887 var arg_name = "foo"; |
860 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 888 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
861 var path = (req.url).path; | 889 var path = (req.url).path; |
862 var pathOffset = 0; | 890 var pathOffset = 0; |
863 var index; | 891 var index; |
864 var subPart; | 892 var subPart; |
865 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 893 unittest.expect( |
| 894 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
866 pathOffset += 1; | 895 pathOffset += 1; |
867 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 896 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 897 unittest.equals("v2beta1/")); |
868 pathOffset += 8; | 898 pathOffset += 8; |
869 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 899 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
870 | 900 |
871 var query = (req.url).query; | 901 var query = (req.url).query; |
872 var queryOffset = 0; | 902 var queryOffset = 0; |
873 var queryMap = {}; | 903 var queryMap = {}; |
874 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 904 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
875 parseBool(n) { | 905 parseBool(n) { |
876 if (n == "true") return true; | 906 if (n == "true") return true; |
877 if (n == "false") return false; | 907 if (n == "false") return false; |
878 if (n == null) return null; | 908 if (n == null) return null; |
879 throw new core.ArgumentError("Invalid boolean: $n"); | 909 throw new core.ArgumentError("Invalid boolean: $n"); |
880 } | 910 } |
| 911 |
881 if (query.length > 0) { | 912 if (query.length > 0) { |
882 for (var part in query.split("&")) { | 913 for (var part in query.split("&")) { |
883 var keyvalue = part.split("="); | 914 var keyvalue = part.split("="); |
884 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 915 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 916 core.Uri.decodeQueryComponent(keyvalue[1])); |
885 } | 917 } |
886 } | 918 } |
887 | 919 |
888 | |
889 var h = { | 920 var h = { |
890 "content-type" : "application/json; charset=utf-8", | 921 "content-type": "application/json; charset=utf-8", |
891 }; | 922 }; |
892 var resp = convert.JSON.encode(buildFolder()); | 923 var resp = convert.JSON.encode(buildFolder()); |
893 return new async.Future.value(stringResponse(200, h, resp)); | 924 return new async.Future.value(stringResponse(200, h, resp)); |
894 }), true); | 925 }), true); |
895 res.delete(arg_name).then(unittest.expectAsync1(((api.Folder response) { | 926 res.delete(arg_name).then(unittest.expectAsync1(((api.Folder response) { |
896 checkFolder(response); | 927 checkFolder(response); |
897 }))); | 928 }))); |
898 }); | 929 }); |
899 | 930 |
900 unittest.test("method--get", () { | 931 unittest.test("method--get", () { |
901 | |
902 var mock = new HttpServerMock(); | 932 var mock = new HttpServerMock(); |
903 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 933 api.FoldersResourceApi res = |
| 934 new api.CloudresourcemanagerApi(mock).folders; |
904 var arg_name = "foo"; | 935 var arg_name = "foo"; |
905 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 936 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
906 var path = (req.url).path; | 937 var path = (req.url).path; |
907 var pathOffset = 0; | 938 var pathOffset = 0; |
908 var index; | 939 var index; |
909 var subPart; | 940 var subPart; |
910 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 941 unittest.expect( |
| 942 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
911 pathOffset += 1; | 943 pathOffset += 1; |
912 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 944 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 945 unittest.equals("v2beta1/")); |
913 pathOffset += 8; | 946 pathOffset += 8; |
914 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 947 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
915 | 948 |
916 var query = (req.url).query; | 949 var query = (req.url).query; |
917 var queryOffset = 0; | 950 var queryOffset = 0; |
918 var queryMap = {}; | 951 var queryMap = {}; |
919 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 952 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
920 parseBool(n) { | 953 parseBool(n) { |
921 if (n == "true") return true; | 954 if (n == "true") return true; |
922 if (n == "false") return false; | 955 if (n == "false") return false; |
923 if (n == null) return null; | 956 if (n == null) return null; |
924 throw new core.ArgumentError("Invalid boolean: $n"); | 957 throw new core.ArgumentError("Invalid boolean: $n"); |
925 } | 958 } |
| 959 |
926 if (query.length > 0) { | 960 if (query.length > 0) { |
927 for (var part in query.split("&")) { | 961 for (var part in query.split("&")) { |
928 var keyvalue = part.split("="); | 962 var keyvalue = part.split("="); |
929 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 963 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 964 core.Uri.decodeQueryComponent(keyvalue[1])); |
930 } | 965 } |
931 } | 966 } |
932 | 967 |
933 | |
934 var h = { | 968 var h = { |
935 "content-type" : "application/json; charset=utf-8", | 969 "content-type": "application/json; charset=utf-8", |
936 }; | 970 }; |
937 var resp = convert.JSON.encode(buildFolder()); | 971 var resp = convert.JSON.encode(buildFolder()); |
938 return new async.Future.value(stringResponse(200, h, resp)); | 972 return new async.Future.value(stringResponse(200, h, resp)); |
939 }), true); | 973 }), true); |
940 res.get(arg_name).then(unittest.expectAsync1(((api.Folder response) { | 974 res.get(arg_name).then(unittest.expectAsync1(((api.Folder response) { |
941 checkFolder(response); | 975 checkFolder(response); |
942 }))); | 976 }))); |
943 }); | 977 }); |
944 | 978 |
945 unittest.test("method--getIamPolicy", () { | 979 unittest.test("method--getIamPolicy", () { |
946 | |
947 var mock = new HttpServerMock(); | 980 var mock = new HttpServerMock(); |
948 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 981 api.FoldersResourceApi res = |
| 982 new api.CloudresourcemanagerApi(mock).folders; |
949 var arg_request = buildGetIamPolicyRequest(); | 983 var arg_request = buildGetIamPolicyRequest(); |
950 var arg_resource = "foo"; | 984 var arg_resource = "foo"; |
951 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 985 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
952 var obj = new api.GetIamPolicyRequest.fromJson(json); | 986 var obj = new api.GetIamPolicyRequest.fromJson(json); |
953 checkGetIamPolicyRequest(obj); | 987 checkGetIamPolicyRequest(obj); |
954 | 988 |
955 var path = (req.url).path; | 989 var path = (req.url).path; |
956 var pathOffset = 0; | 990 var pathOffset = 0; |
957 var index; | 991 var index; |
958 var subPart; | 992 var subPart; |
959 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 993 unittest.expect( |
| 994 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
960 pathOffset += 1; | 995 pathOffset += 1; |
961 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 996 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 997 unittest.equals("v2beta1/")); |
962 pathOffset += 8; | 998 pathOffset += 8; |
963 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 999 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
964 | 1000 |
965 var query = (req.url).query; | 1001 var query = (req.url).query; |
966 var queryOffset = 0; | 1002 var queryOffset = 0; |
967 var queryMap = {}; | 1003 var queryMap = {}; |
968 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1004 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
969 parseBool(n) { | 1005 parseBool(n) { |
970 if (n == "true") return true; | 1006 if (n == "true") return true; |
971 if (n == "false") return false; | 1007 if (n == "false") return false; |
972 if (n == null) return null; | 1008 if (n == null) return null; |
973 throw new core.ArgumentError("Invalid boolean: $n"); | 1009 throw new core.ArgumentError("Invalid boolean: $n"); |
974 } | 1010 } |
| 1011 |
975 if (query.length > 0) { | 1012 if (query.length > 0) { |
976 for (var part in query.split("&")) { | 1013 for (var part in query.split("&")) { |
977 var keyvalue = part.split("="); | 1014 var keyvalue = part.split("="); |
978 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1015 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1016 core.Uri.decodeQueryComponent(keyvalue[1])); |
979 } | 1017 } |
980 } | 1018 } |
981 | 1019 |
982 | |
983 var h = { | 1020 var h = { |
984 "content-type" : "application/json; charset=utf-8", | 1021 "content-type": "application/json; charset=utf-8", |
985 }; | 1022 }; |
986 var resp = convert.JSON.encode(buildPolicy()); | 1023 var resp = convert.JSON.encode(buildPolicy()); |
987 return new async.Future.value(stringResponse(200, h, resp)); | 1024 return new async.Future.value(stringResponse(200, h, resp)); |
988 }), true); | 1025 }), true); |
989 res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1026 res |
| 1027 .getIamPolicy(arg_request, arg_resource) |
| 1028 .then(unittest.expectAsync1(((api.Policy response) { |
990 checkPolicy(response); | 1029 checkPolicy(response); |
991 }))); | 1030 }))); |
992 }); | 1031 }); |
993 | 1032 |
994 unittest.test("method--list", () { | 1033 unittest.test("method--list", () { |
995 | |
996 var mock = new HttpServerMock(); | 1034 var mock = new HttpServerMock(); |
997 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 1035 api.FoldersResourceApi res = |
| 1036 new api.CloudresourcemanagerApi(mock).folders; |
| 1037 var arg_pageSize = 42; |
| 1038 var arg_parent = "foo"; |
998 var arg_showDeleted = true; | 1039 var arg_showDeleted = true; |
999 var arg_pageToken = "foo"; | 1040 var arg_pageToken = "foo"; |
1000 var arg_pageSize = 42; | |
1001 var arg_parent = "foo"; | |
1002 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1041 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1003 var path = (req.url).path; | 1042 var path = (req.url).path; |
1004 var pathOffset = 0; | 1043 var pathOffset = 0; |
1005 var index; | 1044 var index; |
1006 var subPart; | 1045 var subPart; |
1007 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1046 unittest.expect( |
| 1047 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1008 pathOffset += 1; | 1048 pathOffset += 1; |
1009 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("v2beta1/folders")); | 1049 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 1050 unittest.equals("v2beta1/folders")); |
1010 pathOffset += 15; | 1051 pathOffset += 15; |
1011 | 1052 |
1012 var query = (req.url).query; | 1053 var query = (req.url).query; |
1013 var queryOffset = 0; | 1054 var queryOffset = 0; |
1014 var queryMap = {}; | 1055 var queryMap = {}; |
1015 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1056 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1016 parseBool(n) { | 1057 parseBool(n) { |
1017 if (n == "true") return true; | 1058 if (n == "true") return true; |
1018 if (n == "false") return false; | 1059 if (n == "false") return false; |
1019 if (n == null) return null; | 1060 if (n == null) return null; |
1020 throw new core.ArgumentError("Invalid boolean: $n"); | 1061 throw new core.ArgumentError("Invalid boolean: $n"); |
1021 } | 1062 } |
| 1063 |
1022 if (query.length > 0) { | 1064 if (query.length > 0) { |
1023 for (var part in query.split("&")) { | 1065 for (var part in query.split("&")) { |
1024 var keyvalue = part.split("="); | 1066 var keyvalue = part.split("="); |
1025 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1067 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1068 core.Uri.decodeQueryComponent(keyvalue[1])); |
1026 } | 1069 } |
1027 } | 1070 } |
1028 unittest.expect(queryMap["showDeleted"].first, unittest.equals("$arg_sho
wDeleted")); | 1071 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
1029 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1072 unittest.equals(arg_pageSize)); |
1030 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
1031 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); | 1073 unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
1032 | 1074 unittest.expect( |
| 1075 queryMap["showDeleted"].first, unittest.equals("$arg_showDeleted")); |
| 1076 unittest.expect( |
| 1077 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1033 | 1078 |
1034 var h = { | 1079 var h = { |
1035 "content-type" : "application/json; charset=utf-8", | 1080 "content-type": "application/json; charset=utf-8", |
1036 }; | 1081 }; |
1037 var resp = convert.JSON.encode(buildListFoldersResponse()); | 1082 var resp = convert.JSON.encode(buildListFoldersResponse()); |
1038 return new async.Future.value(stringResponse(200, h, resp)); | 1083 return new async.Future.value(stringResponse(200, h, resp)); |
1039 }), true); | 1084 }), true); |
1040 res.list(showDeleted: arg_showDeleted, pageToken: arg_pageToken, pageSize:
arg_pageSize, parent: arg_parent).then(unittest.expectAsync1(((api.ListFoldersR
esponse response) { | 1085 res |
| 1086 .list( |
| 1087 pageSize: arg_pageSize, |
| 1088 parent: arg_parent, |
| 1089 showDeleted: arg_showDeleted, |
| 1090 pageToken: arg_pageToken) |
| 1091 .then(unittest.expectAsync1(((api.ListFoldersResponse response) { |
1041 checkListFoldersResponse(response); | 1092 checkListFoldersResponse(response); |
1042 }))); | 1093 }))); |
1043 }); | 1094 }); |
1044 | 1095 |
1045 unittest.test("method--move", () { | 1096 unittest.test("method--move", () { |
1046 | |
1047 var mock = new HttpServerMock(); | 1097 var mock = new HttpServerMock(); |
1048 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 1098 api.FoldersResourceApi res = |
| 1099 new api.CloudresourcemanagerApi(mock).folders; |
1049 var arg_request = buildMoveFolderRequest(); | 1100 var arg_request = buildMoveFolderRequest(); |
1050 var arg_name = "foo"; | 1101 var arg_name = "foo"; |
1051 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1102 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1052 var obj = new api.MoveFolderRequest.fromJson(json); | 1103 var obj = new api.MoveFolderRequest.fromJson(json); |
1053 checkMoveFolderRequest(obj); | 1104 checkMoveFolderRequest(obj); |
1054 | 1105 |
1055 var path = (req.url).path; | 1106 var path = (req.url).path; |
1056 var pathOffset = 0; | 1107 var pathOffset = 0; |
1057 var index; | 1108 var index; |
1058 var subPart; | 1109 var subPart; |
1059 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1110 unittest.expect( |
| 1111 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1060 pathOffset += 1; | 1112 pathOffset += 1; |
1061 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 1113 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1114 unittest.equals("v2beta1/")); |
1062 pathOffset += 8; | 1115 pathOffset += 8; |
1063 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1116 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1064 | 1117 |
1065 var query = (req.url).query; | 1118 var query = (req.url).query; |
1066 var queryOffset = 0; | 1119 var queryOffset = 0; |
1067 var queryMap = {}; | 1120 var queryMap = {}; |
1068 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1121 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1069 parseBool(n) { | 1122 parseBool(n) { |
1070 if (n == "true") return true; | 1123 if (n == "true") return true; |
1071 if (n == "false") return false; | 1124 if (n == "false") return false; |
1072 if (n == null) return null; | 1125 if (n == null) return null; |
1073 throw new core.ArgumentError("Invalid boolean: $n"); | 1126 throw new core.ArgumentError("Invalid boolean: $n"); |
1074 } | 1127 } |
| 1128 |
1075 if (query.length > 0) { | 1129 if (query.length > 0) { |
1076 for (var part in query.split("&")) { | 1130 for (var part in query.split("&")) { |
1077 var keyvalue = part.split("="); | 1131 var keyvalue = part.split("="); |
1078 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1132 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1133 core.Uri.decodeQueryComponent(keyvalue[1])); |
1079 } | 1134 } |
1080 } | 1135 } |
1081 | 1136 |
1082 | |
1083 var h = { | 1137 var h = { |
1084 "content-type" : "application/json; charset=utf-8", | 1138 "content-type": "application/json; charset=utf-8", |
1085 }; | 1139 }; |
1086 var resp = convert.JSON.encode(buildOperation()); | 1140 var resp = convert.JSON.encode(buildOperation()); |
1087 return new async.Future.value(stringResponse(200, h, resp)); | 1141 return new async.Future.value(stringResponse(200, h, resp)); |
1088 }), true); | 1142 }), true); |
1089 res.move(arg_request, arg_name).then(unittest.expectAsync1(((api.Operation
response) { | 1143 res |
| 1144 .move(arg_request, arg_name) |
| 1145 .then(unittest.expectAsync1(((api.Operation response) { |
1090 checkOperation(response); | 1146 checkOperation(response); |
1091 }))); | 1147 }))); |
1092 }); | 1148 }); |
1093 | 1149 |
1094 unittest.test("method--patch", () { | 1150 unittest.test("method--patch", () { |
1095 | |
1096 var mock = new HttpServerMock(); | 1151 var mock = new HttpServerMock(); |
1097 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 1152 api.FoldersResourceApi res = |
| 1153 new api.CloudresourcemanagerApi(mock).folders; |
1098 var arg_request = buildFolder(); | 1154 var arg_request = buildFolder(); |
1099 var arg_name = "foo"; | 1155 var arg_name = "foo"; |
1100 var arg_updateMask = "foo"; | 1156 var arg_updateMask = "foo"; |
1101 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1157 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1102 var obj = new api.Folder.fromJson(json); | 1158 var obj = new api.Folder.fromJson(json); |
1103 checkFolder(obj); | 1159 checkFolder(obj); |
1104 | 1160 |
1105 var path = (req.url).path; | 1161 var path = (req.url).path; |
1106 var pathOffset = 0; | 1162 var pathOffset = 0; |
1107 var index; | 1163 var index; |
1108 var subPart; | 1164 var subPart; |
1109 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1165 unittest.expect( |
| 1166 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1110 pathOffset += 1; | 1167 pathOffset += 1; |
1111 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 1168 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1169 unittest.equals("v2beta1/")); |
1112 pathOffset += 8; | 1170 pathOffset += 8; |
1113 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1171 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1114 | 1172 |
1115 var query = (req.url).query; | 1173 var query = (req.url).query; |
1116 var queryOffset = 0; | 1174 var queryOffset = 0; |
1117 var queryMap = {}; | 1175 var queryMap = {}; |
1118 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1176 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1119 parseBool(n) { | 1177 parseBool(n) { |
1120 if (n == "true") return true; | 1178 if (n == "true") return true; |
1121 if (n == "false") return false; | 1179 if (n == "false") return false; |
1122 if (n == null) return null; | 1180 if (n == null) return null; |
1123 throw new core.ArgumentError("Invalid boolean: $n"); | 1181 throw new core.ArgumentError("Invalid boolean: $n"); |
1124 } | 1182 } |
| 1183 |
1125 if (query.length > 0) { | 1184 if (query.length > 0) { |
1126 for (var part in query.split("&")) { | 1185 for (var part in query.split("&")) { |
1127 var keyvalue = part.split("="); | 1186 var keyvalue = part.split("="); |
1128 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1187 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1188 core.Uri.decodeQueryComponent(keyvalue[1])); |
1129 } | 1189 } |
1130 } | 1190 } |
1131 unittest.expect(queryMap["updateMask"].first, unittest.equals(arg_update
Mask)); | 1191 unittest.expect( |
1132 | 1192 queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
1133 | 1193 |
1134 var h = { | 1194 var h = { |
1135 "content-type" : "application/json; charset=utf-8", | 1195 "content-type": "application/json; charset=utf-8", |
1136 }; | 1196 }; |
1137 var resp = convert.JSON.encode(buildFolder()); | 1197 var resp = convert.JSON.encode(buildFolder()); |
1138 return new async.Future.value(stringResponse(200, h, resp)); | 1198 return new async.Future.value(stringResponse(200, h, resp)); |
1139 }), true); | 1199 }), true); |
1140 res.patch(arg_request, arg_name, updateMask: arg_updateMask).then(unittest
.expectAsync1(((api.Folder response) { | 1200 res |
| 1201 .patch(arg_request, arg_name, updateMask: arg_updateMask) |
| 1202 .then(unittest.expectAsync1(((api.Folder response) { |
1141 checkFolder(response); | 1203 checkFolder(response); |
1142 }))); | 1204 }))); |
1143 }); | 1205 }); |
1144 | 1206 |
1145 unittest.test("method--search", () { | 1207 unittest.test("method--search", () { |
1146 | |
1147 var mock = new HttpServerMock(); | 1208 var mock = new HttpServerMock(); |
1148 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 1209 api.FoldersResourceApi res = |
| 1210 new api.CloudresourcemanagerApi(mock).folders; |
1149 var arg_request = buildSearchFoldersRequest(); | 1211 var arg_request = buildSearchFoldersRequest(); |
1150 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1212 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1151 var obj = new api.SearchFoldersRequest.fromJson(json); | 1213 var obj = new api.SearchFoldersRequest.fromJson(json); |
1152 checkSearchFoldersRequest(obj); | 1214 checkSearchFoldersRequest(obj); |
1153 | 1215 |
1154 var path = (req.url).path; | 1216 var path = (req.url).path; |
1155 var pathOffset = 0; | 1217 var pathOffset = 0; |
1156 var index; | 1218 var index; |
1157 var subPart; | 1219 var subPart; |
1158 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1220 unittest.expect( |
| 1221 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1159 pathOffset += 1; | 1222 pathOffset += 1; |
1160 unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.eq
uals("v2beta1/folders:search")); | 1223 unittest.expect(path.substring(pathOffset, pathOffset + 22), |
| 1224 unittest.equals("v2beta1/folders:search")); |
1161 pathOffset += 22; | 1225 pathOffset += 22; |
1162 | 1226 |
1163 var query = (req.url).query; | 1227 var query = (req.url).query; |
1164 var queryOffset = 0; | 1228 var queryOffset = 0; |
1165 var queryMap = {}; | 1229 var queryMap = {}; |
1166 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1230 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1167 parseBool(n) { | 1231 parseBool(n) { |
1168 if (n == "true") return true; | 1232 if (n == "true") return true; |
1169 if (n == "false") return false; | 1233 if (n == "false") return false; |
1170 if (n == null) return null; | 1234 if (n == null) return null; |
1171 throw new core.ArgumentError("Invalid boolean: $n"); | 1235 throw new core.ArgumentError("Invalid boolean: $n"); |
1172 } | 1236 } |
| 1237 |
1173 if (query.length > 0) { | 1238 if (query.length > 0) { |
1174 for (var part in query.split("&")) { | 1239 for (var part in query.split("&")) { |
1175 var keyvalue = part.split("="); | 1240 var keyvalue = part.split("="); |
1176 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1241 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1242 core.Uri.decodeQueryComponent(keyvalue[1])); |
1177 } | 1243 } |
1178 } | 1244 } |
1179 | 1245 |
1180 | |
1181 var h = { | 1246 var h = { |
1182 "content-type" : "application/json; charset=utf-8", | 1247 "content-type": "application/json; charset=utf-8", |
1183 }; | 1248 }; |
1184 var resp = convert.JSON.encode(buildSearchFoldersResponse()); | 1249 var resp = convert.JSON.encode(buildSearchFoldersResponse()); |
1185 return new async.Future.value(stringResponse(200, h, resp)); | 1250 return new async.Future.value(stringResponse(200, h, resp)); |
1186 }), true); | 1251 }), true); |
1187 res.search(arg_request).then(unittest.expectAsync1(((api.SearchFoldersResp
onse response) { | 1252 res |
| 1253 .search(arg_request) |
| 1254 .then(unittest.expectAsync1(((api.SearchFoldersResponse response) { |
1188 checkSearchFoldersResponse(response); | 1255 checkSearchFoldersResponse(response); |
1189 }))); | 1256 }))); |
1190 }); | 1257 }); |
1191 | 1258 |
1192 unittest.test("method--setIamPolicy", () { | 1259 unittest.test("method--setIamPolicy", () { |
1193 | |
1194 var mock = new HttpServerMock(); | 1260 var mock = new HttpServerMock(); |
1195 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 1261 api.FoldersResourceApi res = |
| 1262 new api.CloudresourcemanagerApi(mock).folders; |
1196 var arg_request = buildSetIamPolicyRequest(); | 1263 var arg_request = buildSetIamPolicyRequest(); |
1197 var arg_resource = "foo"; | 1264 var arg_resource = "foo"; |
1198 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1265 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1199 var obj = new api.SetIamPolicyRequest.fromJson(json); | 1266 var obj = new api.SetIamPolicyRequest.fromJson(json); |
1200 checkSetIamPolicyRequest(obj); | 1267 checkSetIamPolicyRequest(obj); |
1201 | 1268 |
1202 var path = (req.url).path; | 1269 var path = (req.url).path; |
1203 var pathOffset = 0; | 1270 var pathOffset = 0; |
1204 var index; | 1271 var index; |
1205 var subPart; | 1272 var subPart; |
1206 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1273 unittest.expect( |
| 1274 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1207 pathOffset += 1; | 1275 pathOffset += 1; |
1208 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 1276 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1277 unittest.equals("v2beta1/")); |
1209 pathOffset += 8; | 1278 pathOffset += 8; |
1210 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1279 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1211 | 1280 |
1212 var query = (req.url).query; | 1281 var query = (req.url).query; |
1213 var queryOffset = 0; | 1282 var queryOffset = 0; |
1214 var queryMap = {}; | 1283 var queryMap = {}; |
1215 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1284 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1216 parseBool(n) { | 1285 parseBool(n) { |
1217 if (n == "true") return true; | 1286 if (n == "true") return true; |
1218 if (n == "false") return false; | 1287 if (n == "false") return false; |
1219 if (n == null) return null; | 1288 if (n == null) return null; |
1220 throw new core.ArgumentError("Invalid boolean: $n"); | 1289 throw new core.ArgumentError("Invalid boolean: $n"); |
1221 } | 1290 } |
| 1291 |
1222 if (query.length > 0) { | 1292 if (query.length > 0) { |
1223 for (var part in query.split("&")) { | 1293 for (var part in query.split("&")) { |
1224 var keyvalue = part.split("="); | 1294 var keyvalue = part.split("="); |
1225 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1295 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1296 core.Uri.decodeQueryComponent(keyvalue[1])); |
1226 } | 1297 } |
1227 } | 1298 } |
1228 | 1299 |
1229 | |
1230 var h = { | 1300 var h = { |
1231 "content-type" : "application/json; charset=utf-8", | 1301 "content-type": "application/json; charset=utf-8", |
1232 }; | 1302 }; |
1233 var resp = convert.JSON.encode(buildPolicy()); | 1303 var resp = convert.JSON.encode(buildPolicy()); |
1234 return new async.Future.value(stringResponse(200, h, resp)); | 1304 return new async.Future.value(stringResponse(200, h, resp)); |
1235 }), true); | 1305 }), true); |
1236 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1306 res |
| 1307 .setIamPolicy(arg_request, arg_resource) |
| 1308 .then(unittest.expectAsync1(((api.Policy response) { |
1237 checkPolicy(response); | 1309 checkPolicy(response); |
1238 }))); | 1310 }))); |
1239 }); | 1311 }); |
1240 | 1312 |
1241 unittest.test("method--testIamPermissions", () { | 1313 unittest.test("method--testIamPermissions", () { |
1242 | |
1243 var mock = new HttpServerMock(); | 1314 var mock = new HttpServerMock(); |
1244 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 1315 api.FoldersResourceApi res = |
| 1316 new api.CloudresourcemanagerApi(mock).folders; |
1245 var arg_request = buildTestIamPermissionsRequest(); | 1317 var arg_request = buildTestIamPermissionsRequest(); |
1246 var arg_resource = "foo"; | 1318 var arg_resource = "foo"; |
1247 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1319 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1248 var obj = new api.TestIamPermissionsRequest.fromJson(json); | 1320 var obj = new api.TestIamPermissionsRequest.fromJson(json); |
1249 checkTestIamPermissionsRequest(obj); | 1321 checkTestIamPermissionsRequest(obj); |
1250 | 1322 |
1251 var path = (req.url).path; | 1323 var path = (req.url).path; |
1252 var pathOffset = 0; | 1324 var pathOffset = 0; |
1253 var index; | 1325 var index; |
1254 var subPart; | 1326 var subPart; |
1255 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1327 unittest.expect( |
| 1328 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1256 pathOffset += 1; | 1329 pathOffset += 1; |
1257 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 1330 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1331 unittest.equals("v2beta1/")); |
1258 pathOffset += 8; | 1332 pathOffset += 8; |
1259 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1333 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1260 | 1334 |
1261 var query = (req.url).query; | 1335 var query = (req.url).query; |
1262 var queryOffset = 0; | 1336 var queryOffset = 0; |
1263 var queryMap = {}; | 1337 var queryMap = {}; |
1264 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1338 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1265 parseBool(n) { | 1339 parseBool(n) { |
1266 if (n == "true") return true; | 1340 if (n == "true") return true; |
1267 if (n == "false") return false; | 1341 if (n == "false") return false; |
1268 if (n == null) return null; | 1342 if (n == null) return null; |
1269 throw new core.ArgumentError("Invalid boolean: $n"); | 1343 throw new core.ArgumentError("Invalid boolean: $n"); |
1270 } | 1344 } |
| 1345 |
1271 if (query.length > 0) { | 1346 if (query.length > 0) { |
1272 for (var part in query.split("&")) { | 1347 for (var part in query.split("&")) { |
1273 var keyvalue = part.split("="); | 1348 var keyvalue = part.split("="); |
1274 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1349 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1350 core.Uri.decodeQueryComponent(keyvalue[1])); |
1275 } | 1351 } |
1276 } | 1352 } |
1277 | 1353 |
1278 | |
1279 var h = { | 1354 var h = { |
1280 "content-type" : "application/json; charset=utf-8", | 1355 "content-type": "application/json; charset=utf-8", |
1281 }; | 1356 }; |
1282 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | 1357 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
1283 return new async.Future.value(stringResponse(200, h, resp)); | 1358 return new async.Future.value(stringResponse(200, h, resp)); |
1284 }), true); | 1359 }), true); |
1285 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c1(((api.TestIamPermissionsResponse response) { | 1360 res.testIamPermissions(arg_request, arg_resource).then( |
| 1361 unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
1286 checkTestIamPermissionsResponse(response); | 1362 checkTestIamPermissionsResponse(response); |
1287 }))); | 1363 }))); |
1288 }); | 1364 }); |
1289 | 1365 |
1290 unittest.test("method--undelete", () { | 1366 unittest.test("method--undelete", () { |
1291 | |
1292 var mock = new HttpServerMock(); | 1367 var mock = new HttpServerMock(); |
1293 api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders
; | 1368 api.FoldersResourceApi res = |
| 1369 new api.CloudresourcemanagerApi(mock).folders; |
1294 var arg_request = buildUndeleteFolderRequest(); | 1370 var arg_request = buildUndeleteFolderRequest(); |
1295 var arg_name = "foo"; | 1371 var arg_name = "foo"; |
1296 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1372 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1297 var obj = new api.UndeleteFolderRequest.fromJson(json); | 1373 var obj = new api.UndeleteFolderRequest.fromJson(json); |
1298 checkUndeleteFolderRequest(obj); | 1374 checkUndeleteFolderRequest(obj); |
1299 | 1375 |
1300 var path = (req.url).path; | 1376 var path = (req.url).path; |
1301 var pathOffset = 0; | 1377 var pathOffset = 0; |
1302 var index; | 1378 var index; |
1303 var subPart; | 1379 var subPart; |
1304 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1380 unittest.expect( |
| 1381 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1305 pathOffset += 1; | 1382 pathOffset += 1; |
1306 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v2beta1/")); | 1383 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1384 unittest.equals("v2beta1/")); |
1307 pathOffset += 8; | 1385 pathOffset += 8; |
1308 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1386 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1309 | 1387 |
1310 var query = (req.url).query; | 1388 var query = (req.url).query; |
1311 var queryOffset = 0; | 1389 var queryOffset = 0; |
1312 var queryMap = {}; | 1390 var queryMap = {}; |
1313 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1391 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1314 parseBool(n) { | 1392 parseBool(n) { |
1315 if (n == "true") return true; | 1393 if (n == "true") return true; |
1316 if (n == "false") return false; | 1394 if (n == "false") return false; |
1317 if (n == null) return null; | 1395 if (n == null) return null; |
1318 throw new core.ArgumentError("Invalid boolean: $n"); | 1396 throw new core.ArgumentError("Invalid boolean: $n"); |
1319 } | 1397 } |
| 1398 |
1320 if (query.length > 0) { | 1399 if (query.length > 0) { |
1321 for (var part in query.split("&")) { | 1400 for (var part in query.split("&")) { |
1322 var keyvalue = part.split("="); | 1401 var keyvalue = part.split("="); |
1323 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1402 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1403 core.Uri.decodeQueryComponent(keyvalue[1])); |
1324 } | 1404 } |
1325 } | 1405 } |
1326 | 1406 |
1327 | |
1328 var h = { | 1407 var h = { |
1329 "content-type" : "application/json; charset=utf-8", | 1408 "content-type": "application/json; charset=utf-8", |
1330 }; | 1409 }; |
1331 var resp = convert.JSON.encode(buildFolder()); | 1410 var resp = convert.JSON.encode(buildFolder()); |
1332 return new async.Future.value(stringResponse(200, h, resp)); | 1411 return new async.Future.value(stringResponse(200, h, resp)); |
1333 }), true); | 1412 }), true); |
1334 res.undelete(arg_request, arg_name).then(unittest.expectAsync1(((api.Folde
r response) { | 1413 res |
| 1414 .undelete(arg_request, arg_name) |
| 1415 .then(unittest.expectAsync1(((api.Folder response) { |
1335 checkFolder(response); | 1416 checkFolder(response); |
1336 }))); | 1417 }))); |
1337 }); | 1418 }); |
1338 | |
1339 }); | 1419 }); |
1340 | |
1341 | |
1342 } | 1420 } |
1343 | |
OLD | NEW |