OLD | NEW |
1 library googleapis.storagetransfer.v1.test; | 1 library googleapis.storagetransfer.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/storagetransfer/v1.dart' as api; | 10 import 'package:googleapis/storagetransfer/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 core.int buildCounterAwsAccessKey = 0; | 53 core.int buildCounterAwsAccessKey = 0; |
55 buildAwsAccessKey() { | 54 buildAwsAccessKey() { |
56 var o = new api.AwsAccessKey(); | 55 var o = new api.AwsAccessKey(); |
57 buildCounterAwsAccessKey++; | 56 buildCounterAwsAccessKey++; |
58 if (buildCounterAwsAccessKey < 3) { | 57 if (buildCounterAwsAccessKey < 3) { |
59 o.accessKeyId = "foo"; | 58 o.accessKeyId = "foo"; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 unittest.expect(o.month, unittest.equals(42)); | 112 unittest.expect(o.month, unittest.equals(42)); |
114 unittest.expect(o.year, unittest.equals(42)); | 113 unittest.expect(o.year, unittest.equals(42)); |
115 } | 114 } |
116 buildCounterDate--; | 115 buildCounterDate--; |
117 } | 116 } |
118 | 117 |
119 core.int buildCounterEmpty = 0; | 118 core.int buildCounterEmpty = 0; |
120 buildEmpty() { | 119 buildEmpty() { |
121 var o = new api.Empty(); | 120 var o = new api.Empty(); |
122 buildCounterEmpty++; | 121 buildCounterEmpty++; |
123 if (buildCounterEmpty < 3) { | 122 if (buildCounterEmpty < 3) {} |
124 } | |
125 buildCounterEmpty--; | 123 buildCounterEmpty--; |
126 return o; | 124 return o; |
127 } | 125 } |
128 | 126 |
129 checkEmpty(api.Empty o) { | 127 checkEmpty(api.Empty o) { |
130 buildCounterEmpty++; | 128 buildCounterEmpty++; |
131 if (buildCounterEmpty < 3) { | 129 if (buildCounterEmpty < 3) {} |
132 } | |
133 buildCounterEmpty--; | 130 buildCounterEmpty--; |
134 } | 131 } |
135 | 132 |
136 buildUnnamed1408() { | 133 buildUnnamed1398() { |
137 var o = new core.List<core.String>(); | 134 var o = new core.List<core.String>(); |
138 o.add("foo"); | 135 o.add("foo"); |
139 o.add("foo"); | 136 o.add("foo"); |
140 return o; | 137 return o; |
141 } | 138 } |
142 | 139 |
143 checkUnnamed1408(core.List<core.String> o) { | 140 checkUnnamed1398(core.List<core.String> o) { |
144 unittest.expect(o, unittest.hasLength(2)); | 141 unittest.expect(o, unittest.hasLength(2)); |
145 unittest.expect(o[0], unittest.equals('foo')); | 142 unittest.expect(o[0], unittest.equals('foo')); |
146 unittest.expect(o[1], unittest.equals('foo')); | 143 unittest.expect(o[1], unittest.equals('foo')); |
147 } | 144 } |
148 | 145 |
149 core.int buildCounterErrorLogEntry = 0; | 146 core.int buildCounterErrorLogEntry = 0; |
150 buildErrorLogEntry() { | 147 buildErrorLogEntry() { |
151 var o = new api.ErrorLogEntry(); | 148 var o = new api.ErrorLogEntry(); |
152 buildCounterErrorLogEntry++; | 149 buildCounterErrorLogEntry++; |
153 if (buildCounterErrorLogEntry < 3) { | 150 if (buildCounterErrorLogEntry < 3) { |
154 o.errorDetails = buildUnnamed1408(); | 151 o.errorDetails = buildUnnamed1398(); |
155 o.url = "foo"; | 152 o.url = "foo"; |
156 } | 153 } |
157 buildCounterErrorLogEntry--; | 154 buildCounterErrorLogEntry--; |
158 return o; | 155 return o; |
159 } | 156 } |
160 | 157 |
161 checkErrorLogEntry(api.ErrorLogEntry o) { | 158 checkErrorLogEntry(api.ErrorLogEntry o) { |
162 buildCounterErrorLogEntry++; | 159 buildCounterErrorLogEntry++; |
163 if (buildCounterErrorLogEntry < 3) { | 160 if (buildCounterErrorLogEntry < 3) { |
164 checkUnnamed1408(o.errorDetails); | 161 checkUnnamed1398(o.errorDetails); |
165 unittest.expect(o.url, unittest.equals('foo')); | 162 unittest.expect(o.url, unittest.equals('foo')); |
166 } | 163 } |
167 buildCounterErrorLogEntry--; | 164 buildCounterErrorLogEntry--; |
168 } | 165 } |
169 | 166 |
170 buildUnnamed1409() { | 167 buildUnnamed1399() { |
171 var o = new core.List<api.ErrorLogEntry>(); | 168 var o = new core.List<api.ErrorLogEntry>(); |
172 o.add(buildErrorLogEntry()); | 169 o.add(buildErrorLogEntry()); |
173 o.add(buildErrorLogEntry()); | 170 o.add(buildErrorLogEntry()); |
174 return o; | 171 return o; |
175 } | 172 } |
176 | 173 |
177 checkUnnamed1409(core.List<api.ErrorLogEntry> o) { | 174 checkUnnamed1399(core.List<api.ErrorLogEntry> o) { |
178 unittest.expect(o, unittest.hasLength(2)); | 175 unittest.expect(o, unittest.hasLength(2)); |
179 checkErrorLogEntry(o[0]); | 176 checkErrorLogEntry(o[0]); |
180 checkErrorLogEntry(o[1]); | 177 checkErrorLogEntry(o[1]); |
181 } | 178 } |
182 | 179 |
183 core.int buildCounterErrorSummary = 0; | 180 core.int buildCounterErrorSummary = 0; |
184 buildErrorSummary() { | 181 buildErrorSummary() { |
185 var o = new api.ErrorSummary(); | 182 var o = new api.ErrorSummary(); |
186 buildCounterErrorSummary++; | 183 buildCounterErrorSummary++; |
187 if (buildCounterErrorSummary < 3) { | 184 if (buildCounterErrorSummary < 3) { |
188 o.errorCode = "foo"; | 185 o.errorCode = "foo"; |
189 o.errorCount = "foo"; | 186 o.errorCount = "foo"; |
190 o.errorLogEntries = buildUnnamed1409(); | 187 o.errorLogEntries = buildUnnamed1399(); |
191 } | 188 } |
192 buildCounterErrorSummary--; | 189 buildCounterErrorSummary--; |
193 return o; | 190 return o; |
194 } | 191 } |
195 | 192 |
196 checkErrorSummary(api.ErrorSummary o) { | 193 checkErrorSummary(api.ErrorSummary o) { |
197 buildCounterErrorSummary++; | 194 buildCounterErrorSummary++; |
198 if (buildCounterErrorSummary < 3) { | 195 if (buildCounterErrorSummary < 3) { |
199 unittest.expect(o.errorCode, unittest.equals('foo')); | 196 unittest.expect(o.errorCode, unittest.equals('foo')); |
200 unittest.expect(o.errorCount, unittest.equals('foo')); | 197 unittest.expect(o.errorCount, unittest.equals('foo')); |
201 checkUnnamed1409(o.errorLogEntries); | 198 checkUnnamed1399(o.errorLogEntries); |
202 } | 199 } |
203 buildCounterErrorSummary--; | 200 buildCounterErrorSummary--; |
204 } | 201 } |
205 | 202 |
206 core.int buildCounterGcsData = 0; | 203 core.int buildCounterGcsData = 0; |
207 buildGcsData() { | 204 buildGcsData() { |
208 var o = new api.GcsData(); | 205 var o = new api.GcsData(); |
209 buildCounterGcsData++; | 206 buildCounterGcsData++; |
210 if (buildCounterGcsData < 3) { | 207 if (buildCounterGcsData < 3) { |
211 o.bucketName = "foo"; | 208 o.bucketName = "foo"; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 250 } |
254 | 251 |
255 checkHttpData(api.HttpData o) { | 252 checkHttpData(api.HttpData o) { |
256 buildCounterHttpData++; | 253 buildCounterHttpData++; |
257 if (buildCounterHttpData < 3) { | 254 if (buildCounterHttpData < 3) { |
258 unittest.expect(o.listUrl, unittest.equals('foo')); | 255 unittest.expect(o.listUrl, unittest.equals('foo')); |
259 } | 256 } |
260 buildCounterHttpData--; | 257 buildCounterHttpData--; |
261 } | 258 } |
262 | 259 |
263 buildUnnamed1410() { | 260 buildUnnamed1400() { |
264 var o = new core.List<api.Operation>(); | 261 var o = new core.List<api.Operation>(); |
265 o.add(buildOperation()); | 262 o.add(buildOperation()); |
266 o.add(buildOperation()); | 263 o.add(buildOperation()); |
267 return o; | 264 return o; |
268 } | 265 } |
269 | 266 |
270 checkUnnamed1410(core.List<api.Operation> o) { | 267 checkUnnamed1400(core.List<api.Operation> o) { |
271 unittest.expect(o, unittest.hasLength(2)); | 268 unittest.expect(o, unittest.hasLength(2)); |
272 checkOperation(o[0]); | 269 checkOperation(o[0]); |
273 checkOperation(o[1]); | 270 checkOperation(o[1]); |
274 } | 271 } |
275 | 272 |
276 core.int buildCounterListOperationsResponse = 0; | 273 core.int buildCounterListOperationsResponse = 0; |
277 buildListOperationsResponse() { | 274 buildListOperationsResponse() { |
278 var o = new api.ListOperationsResponse(); | 275 var o = new api.ListOperationsResponse(); |
279 buildCounterListOperationsResponse++; | 276 buildCounterListOperationsResponse++; |
280 if (buildCounterListOperationsResponse < 3) { | 277 if (buildCounterListOperationsResponse < 3) { |
281 o.nextPageToken = "foo"; | 278 o.nextPageToken = "foo"; |
282 o.operations = buildUnnamed1410(); | 279 o.operations = buildUnnamed1400(); |
283 } | 280 } |
284 buildCounterListOperationsResponse--; | 281 buildCounterListOperationsResponse--; |
285 return o; | 282 return o; |
286 } | 283 } |
287 | 284 |
288 checkListOperationsResponse(api.ListOperationsResponse o) { | 285 checkListOperationsResponse(api.ListOperationsResponse o) { |
289 buildCounterListOperationsResponse++; | 286 buildCounterListOperationsResponse++; |
290 if (buildCounterListOperationsResponse < 3) { | 287 if (buildCounterListOperationsResponse < 3) { |
291 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 288 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
292 checkUnnamed1410(o.operations); | 289 checkUnnamed1400(o.operations); |
293 } | 290 } |
294 buildCounterListOperationsResponse--; | 291 buildCounterListOperationsResponse--; |
295 } | 292 } |
296 | 293 |
297 buildUnnamed1411() { | 294 buildUnnamed1401() { |
298 var o = new core.List<api.TransferJob>(); | 295 var o = new core.List<api.TransferJob>(); |
299 o.add(buildTransferJob()); | 296 o.add(buildTransferJob()); |
300 o.add(buildTransferJob()); | 297 o.add(buildTransferJob()); |
301 return o; | 298 return o; |
302 } | 299 } |
303 | 300 |
304 checkUnnamed1411(core.List<api.TransferJob> o) { | 301 checkUnnamed1401(core.List<api.TransferJob> o) { |
305 unittest.expect(o, unittest.hasLength(2)); | 302 unittest.expect(o, unittest.hasLength(2)); |
306 checkTransferJob(o[0]); | 303 checkTransferJob(o[0]); |
307 checkTransferJob(o[1]); | 304 checkTransferJob(o[1]); |
308 } | 305 } |
309 | 306 |
310 core.int buildCounterListTransferJobsResponse = 0; | 307 core.int buildCounterListTransferJobsResponse = 0; |
311 buildListTransferJobsResponse() { | 308 buildListTransferJobsResponse() { |
312 var o = new api.ListTransferJobsResponse(); | 309 var o = new api.ListTransferJobsResponse(); |
313 buildCounterListTransferJobsResponse++; | 310 buildCounterListTransferJobsResponse++; |
314 if (buildCounterListTransferJobsResponse < 3) { | 311 if (buildCounterListTransferJobsResponse < 3) { |
315 o.nextPageToken = "foo"; | 312 o.nextPageToken = "foo"; |
316 o.transferJobs = buildUnnamed1411(); | 313 o.transferJobs = buildUnnamed1401(); |
317 } | 314 } |
318 buildCounterListTransferJobsResponse--; | 315 buildCounterListTransferJobsResponse--; |
319 return o; | 316 return o; |
320 } | 317 } |
321 | 318 |
322 checkListTransferJobsResponse(api.ListTransferJobsResponse o) { | 319 checkListTransferJobsResponse(api.ListTransferJobsResponse o) { |
323 buildCounterListTransferJobsResponse++; | 320 buildCounterListTransferJobsResponse++; |
324 if (buildCounterListTransferJobsResponse < 3) { | 321 if (buildCounterListTransferJobsResponse < 3) { |
325 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 322 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
326 checkUnnamed1411(o.transferJobs); | 323 checkUnnamed1401(o.transferJobs); |
327 } | 324 } |
328 buildCounterListTransferJobsResponse--; | 325 buildCounterListTransferJobsResponse--; |
329 } | 326 } |
330 | 327 |
331 buildUnnamed1412() { | 328 buildUnnamed1402() { |
332 var o = new core.List<core.String>(); | 329 var o = new core.List<core.String>(); |
333 o.add("foo"); | 330 o.add("foo"); |
334 o.add("foo"); | 331 o.add("foo"); |
335 return o; | 332 return o; |
336 } | 333 } |
337 | 334 |
338 checkUnnamed1412(core.List<core.String> o) { | 335 checkUnnamed1402(core.List<core.String> o) { |
339 unittest.expect(o, unittest.hasLength(2)); | 336 unittest.expect(o, unittest.hasLength(2)); |
340 unittest.expect(o[0], unittest.equals('foo')); | 337 unittest.expect(o[0], unittest.equals('foo')); |
341 unittest.expect(o[1], unittest.equals('foo')); | 338 unittest.expect(o[1], unittest.equals('foo')); |
342 } | 339 } |
343 | 340 |
344 buildUnnamed1413() { | 341 buildUnnamed1403() { |
345 var o = new core.List<core.String>(); | 342 var o = new core.List<core.String>(); |
346 o.add("foo"); | 343 o.add("foo"); |
347 o.add("foo"); | 344 o.add("foo"); |
348 return o; | 345 return o; |
349 } | 346 } |
350 | 347 |
351 checkUnnamed1413(core.List<core.String> o) { | 348 checkUnnamed1403(core.List<core.String> o) { |
352 unittest.expect(o, unittest.hasLength(2)); | 349 unittest.expect(o, unittest.hasLength(2)); |
353 unittest.expect(o[0], unittest.equals('foo')); | 350 unittest.expect(o[0], unittest.equals('foo')); |
354 unittest.expect(o[1], unittest.equals('foo')); | 351 unittest.expect(o[1], unittest.equals('foo')); |
355 } | 352 } |
356 | 353 |
357 core.int buildCounterObjectConditions = 0; | 354 core.int buildCounterObjectConditions = 0; |
358 buildObjectConditions() { | 355 buildObjectConditions() { |
359 var o = new api.ObjectConditions(); | 356 var o = new api.ObjectConditions(); |
360 buildCounterObjectConditions++; | 357 buildCounterObjectConditions++; |
361 if (buildCounterObjectConditions < 3) { | 358 if (buildCounterObjectConditions < 3) { |
362 o.excludePrefixes = buildUnnamed1412(); | 359 o.excludePrefixes = buildUnnamed1402(); |
363 o.includePrefixes = buildUnnamed1413(); | 360 o.includePrefixes = buildUnnamed1403(); |
364 o.maxTimeElapsedSinceLastModification = "foo"; | 361 o.maxTimeElapsedSinceLastModification = "foo"; |
365 o.minTimeElapsedSinceLastModification = "foo"; | 362 o.minTimeElapsedSinceLastModification = "foo"; |
366 } | 363 } |
367 buildCounterObjectConditions--; | 364 buildCounterObjectConditions--; |
368 return o; | 365 return o; |
369 } | 366 } |
370 | 367 |
371 checkObjectConditions(api.ObjectConditions o) { | 368 checkObjectConditions(api.ObjectConditions o) { |
372 buildCounterObjectConditions++; | 369 buildCounterObjectConditions++; |
373 if (buildCounterObjectConditions < 3) { | 370 if (buildCounterObjectConditions < 3) { |
374 checkUnnamed1412(o.excludePrefixes); | 371 checkUnnamed1402(o.excludePrefixes); |
375 checkUnnamed1413(o.includePrefixes); | 372 checkUnnamed1403(o.includePrefixes); |
376 unittest.expect(o.maxTimeElapsedSinceLastModification, unittest.equals('foo'
)); | 373 unittest.expect( |
377 unittest.expect(o.minTimeElapsedSinceLastModification, unittest.equals('foo'
)); | 374 o.maxTimeElapsedSinceLastModification, unittest.equals('foo')); |
| 375 unittest.expect( |
| 376 o.minTimeElapsedSinceLastModification, unittest.equals('foo')); |
378 } | 377 } |
379 buildCounterObjectConditions--; | 378 buildCounterObjectConditions--; |
380 } | 379 } |
381 | 380 |
382 buildUnnamed1414() { | 381 buildUnnamed1404() { |
383 var o = new core.Map<core.String, core.Object>(); | 382 var o = new core.Map<core.String, core.Object>(); |
384 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 383 o["x"] = { |
385 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 384 'list': [1, 2, 3], |
| 385 'bool': true, |
| 386 'string': 'foo' |
| 387 }; |
| 388 o["y"] = { |
| 389 'list': [1, 2, 3], |
| 390 'bool': true, |
| 391 'string': 'foo' |
| 392 }; |
386 return o; | 393 return o; |
387 } | 394 } |
388 | 395 |
389 checkUnnamed1414(core.Map<core.String, core.Object> o) { | 396 checkUnnamed1404(core.Map<core.String, core.Object> o) { |
390 unittest.expect(o, unittest.hasLength(2)); | 397 unittest.expect(o, unittest.hasLength(2)); |
391 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')); | 398 var casted1 = (o["x"]) as core.Map; |
392 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')); | 399 unittest.expect(casted1, unittest.hasLength(3)); |
| 400 unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); |
| 401 unittest.expect(casted1["bool"], unittest.equals(true)); |
| 402 unittest.expect(casted1["string"], unittest.equals('foo')); |
| 403 var casted2 = (o["y"]) as core.Map; |
| 404 unittest.expect(casted2, unittest.hasLength(3)); |
| 405 unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); |
| 406 unittest.expect(casted2["bool"], unittest.equals(true)); |
| 407 unittest.expect(casted2["string"], unittest.equals('foo')); |
393 } | 408 } |
394 | 409 |
395 buildUnnamed1415() { | 410 buildUnnamed1405() { |
396 var o = new core.Map<core.String, core.Object>(); | 411 var o = new core.Map<core.String, core.Object>(); |
397 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 412 o["x"] = { |
398 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 413 'list': [1, 2, 3], |
| 414 'bool': true, |
| 415 'string': 'foo' |
| 416 }; |
| 417 o["y"] = { |
| 418 'list': [1, 2, 3], |
| 419 'bool': true, |
| 420 'string': 'foo' |
| 421 }; |
399 return o; | 422 return o; |
400 } | 423 } |
401 | 424 |
402 checkUnnamed1415(core.Map<core.String, core.Object> o) { | 425 checkUnnamed1405(core.Map<core.String, core.Object> o) { |
403 unittest.expect(o, unittest.hasLength(2)); | 426 unittest.expect(o, unittest.hasLength(2)); |
404 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')); | 427 var casted3 = (o["x"]) as core.Map; |
405 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')); | 428 unittest.expect(casted3, unittest.hasLength(3)); |
| 429 unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); |
| 430 unittest.expect(casted3["bool"], unittest.equals(true)); |
| 431 unittest.expect(casted3["string"], unittest.equals('foo')); |
| 432 var casted4 = (o["y"]) as core.Map; |
| 433 unittest.expect(casted4, unittest.hasLength(3)); |
| 434 unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); |
| 435 unittest.expect(casted4["bool"], unittest.equals(true)); |
| 436 unittest.expect(casted4["string"], unittest.equals('foo')); |
406 } | 437 } |
407 | 438 |
408 core.int buildCounterOperation = 0; | 439 core.int buildCounterOperation = 0; |
409 buildOperation() { | 440 buildOperation() { |
410 var o = new api.Operation(); | 441 var o = new api.Operation(); |
411 buildCounterOperation++; | 442 buildCounterOperation++; |
412 if (buildCounterOperation < 3) { | 443 if (buildCounterOperation < 3) { |
413 o.done = true; | 444 o.done = true; |
414 o.error = buildStatus(); | 445 o.error = buildStatus(); |
415 o.metadata = buildUnnamed1414(); | 446 o.metadata = buildUnnamed1404(); |
416 o.name = "foo"; | 447 o.name = "foo"; |
417 o.response = buildUnnamed1415(); | 448 o.response = buildUnnamed1405(); |
418 } | 449 } |
419 buildCounterOperation--; | 450 buildCounterOperation--; |
420 return o; | 451 return o; |
421 } | 452 } |
422 | 453 |
423 checkOperation(api.Operation o) { | 454 checkOperation(api.Operation o) { |
424 buildCounterOperation++; | 455 buildCounterOperation++; |
425 if (buildCounterOperation < 3) { | 456 if (buildCounterOperation < 3) { |
426 unittest.expect(o.done, unittest.isTrue); | 457 unittest.expect(o.done, unittest.isTrue); |
427 checkStatus(o.error); | 458 checkStatus(o.error); |
428 checkUnnamed1414(o.metadata); | 459 checkUnnamed1404(o.metadata); |
429 unittest.expect(o.name, unittest.equals('foo')); | 460 unittest.expect(o.name, unittest.equals('foo')); |
430 checkUnnamed1415(o.response); | 461 checkUnnamed1405(o.response); |
431 } | 462 } |
432 buildCounterOperation--; | 463 buildCounterOperation--; |
433 } | 464 } |
434 | 465 |
435 core.int buildCounterPauseTransferOperationRequest = 0; | 466 core.int buildCounterPauseTransferOperationRequest = 0; |
436 buildPauseTransferOperationRequest() { | 467 buildPauseTransferOperationRequest() { |
437 var o = new api.PauseTransferOperationRequest(); | 468 var o = new api.PauseTransferOperationRequest(); |
438 buildCounterPauseTransferOperationRequest++; | 469 buildCounterPauseTransferOperationRequest++; |
439 if (buildCounterPauseTransferOperationRequest < 3) { | 470 if (buildCounterPauseTransferOperationRequest < 3) {} |
440 } | |
441 buildCounterPauseTransferOperationRequest--; | 471 buildCounterPauseTransferOperationRequest--; |
442 return o; | 472 return o; |
443 } | 473 } |
444 | 474 |
445 checkPauseTransferOperationRequest(api.PauseTransferOperationRequest o) { | 475 checkPauseTransferOperationRequest(api.PauseTransferOperationRequest o) { |
446 buildCounterPauseTransferOperationRequest++; | 476 buildCounterPauseTransferOperationRequest++; |
447 if (buildCounterPauseTransferOperationRequest < 3) { | 477 if (buildCounterPauseTransferOperationRequest < 3) {} |
448 } | |
449 buildCounterPauseTransferOperationRequest--; | 478 buildCounterPauseTransferOperationRequest--; |
450 } | 479 } |
451 | 480 |
452 core.int buildCounterResumeTransferOperationRequest = 0; | 481 core.int buildCounterResumeTransferOperationRequest = 0; |
453 buildResumeTransferOperationRequest() { | 482 buildResumeTransferOperationRequest() { |
454 var o = new api.ResumeTransferOperationRequest(); | 483 var o = new api.ResumeTransferOperationRequest(); |
455 buildCounterResumeTransferOperationRequest++; | 484 buildCounterResumeTransferOperationRequest++; |
456 if (buildCounterResumeTransferOperationRequest < 3) { | 485 if (buildCounterResumeTransferOperationRequest < 3) {} |
457 } | |
458 buildCounterResumeTransferOperationRequest--; | 486 buildCounterResumeTransferOperationRequest--; |
459 return o; | 487 return o; |
460 } | 488 } |
461 | 489 |
462 checkResumeTransferOperationRequest(api.ResumeTransferOperationRequest o) { | 490 checkResumeTransferOperationRequest(api.ResumeTransferOperationRequest o) { |
463 buildCounterResumeTransferOperationRequest++; | 491 buildCounterResumeTransferOperationRequest++; |
464 if (buildCounterResumeTransferOperationRequest < 3) { | 492 if (buildCounterResumeTransferOperationRequest < 3) {} |
465 } | |
466 buildCounterResumeTransferOperationRequest--; | 493 buildCounterResumeTransferOperationRequest--; |
467 } | 494 } |
468 | 495 |
469 core.int buildCounterSchedule = 0; | 496 core.int buildCounterSchedule = 0; |
470 buildSchedule() { | 497 buildSchedule() { |
471 var o = new api.Schedule(); | 498 var o = new api.Schedule(); |
472 buildCounterSchedule++; | 499 buildCounterSchedule++; |
473 if (buildCounterSchedule < 3) { | 500 if (buildCounterSchedule < 3) { |
474 o.scheduleEndDate = buildDate(); | 501 o.scheduleEndDate = buildDate(); |
475 o.scheduleStartDate = buildDate(); | 502 o.scheduleStartDate = buildDate(); |
476 o.startTimeOfDay = buildTimeOfDay(); | 503 o.startTimeOfDay = buildTimeOfDay(); |
477 } | 504 } |
478 buildCounterSchedule--; | 505 buildCounterSchedule--; |
479 return o; | 506 return o; |
480 } | 507 } |
481 | 508 |
482 checkSchedule(api.Schedule o) { | 509 checkSchedule(api.Schedule o) { |
483 buildCounterSchedule++; | 510 buildCounterSchedule++; |
484 if (buildCounterSchedule < 3) { | 511 if (buildCounterSchedule < 3) { |
485 checkDate(o.scheduleEndDate); | 512 checkDate(o.scheduleEndDate); |
486 checkDate(o.scheduleStartDate); | 513 checkDate(o.scheduleStartDate); |
487 checkTimeOfDay(o.startTimeOfDay); | 514 checkTimeOfDay(o.startTimeOfDay); |
488 } | 515 } |
489 buildCounterSchedule--; | 516 buildCounterSchedule--; |
490 } | 517 } |
491 | 518 |
492 buildUnnamed1416() { | 519 buildUnnamed1406() { |
493 var o = new core.Map<core.String, core.Object>(); | 520 var o = new core.Map<core.String, core.Object>(); |
494 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 521 o["x"] = { |
495 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 522 'list': [1, 2, 3], |
| 523 'bool': true, |
| 524 'string': 'foo' |
| 525 }; |
| 526 o["y"] = { |
| 527 'list': [1, 2, 3], |
| 528 'bool': true, |
| 529 'string': 'foo' |
| 530 }; |
496 return o; | 531 return o; |
497 } | 532 } |
498 | 533 |
499 checkUnnamed1416(core.Map<core.String, core.Object> o) { | 534 checkUnnamed1406(core.Map<core.String, core.Object> o) { |
500 unittest.expect(o, unittest.hasLength(2)); | 535 unittest.expect(o, unittest.hasLength(2)); |
501 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')); | 536 var casted5 = (o["x"]) as core.Map; |
502 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')); | 537 unittest.expect(casted5, unittest.hasLength(3)); |
| 538 unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); |
| 539 unittest.expect(casted5["bool"], unittest.equals(true)); |
| 540 unittest.expect(casted5["string"], unittest.equals('foo')); |
| 541 var casted6 = (o["y"]) as core.Map; |
| 542 unittest.expect(casted6, unittest.hasLength(3)); |
| 543 unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); |
| 544 unittest.expect(casted6["bool"], unittest.equals(true)); |
| 545 unittest.expect(casted6["string"], unittest.equals('foo')); |
503 } | 546 } |
504 | 547 |
505 buildUnnamed1417() { | 548 buildUnnamed1407() { |
506 var o = new core.List<core.Map<core.String, core.Object>>(); | 549 var o = new core.List<core.Map<core.String, core.Object>>(); |
507 o.add(buildUnnamed1416()); | 550 o.add(buildUnnamed1406()); |
508 o.add(buildUnnamed1416()); | 551 o.add(buildUnnamed1406()); |
509 return o; | 552 return o; |
510 } | 553 } |
511 | 554 |
512 checkUnnamed1417(core.List<core.Map<core.String, core.Object>> o) { | 555 checkUnnamed1407(core.List<core.Map<core.String, core.Object>> o) { |
513 unittest.expect(o, unittest.hasLength(2)); | 556 unittest.expect(o, unittest.hasLength(2)); |
514 checkUnnamed1416(o[0]); | 557 checkUnnamed1406(o[0]); |
515 checkUnnamed1416(o[1]); | 558 checkUnnamed1406(o[1]); |
516 } | 559 } |
517 | 560 |
518 core.int buildCounterStatus = 0; | 561 core.int buildCounterStatus = 0; |
519 buildStatus() { | 562 buildStatus() { |
520 var o = new api.Status(); | 563 var o = new api.Status(); |
521 buildCounterStatus++; | 564 buildCounterStatus++; |
522 if (buildCounterStatus < 3) { | 565 if (buildCounterStatus < 3) { |
523 o.code = 42; | 566 o.code = 42; |
524 o.details = buildUnnamed1417(); | 567 o.details = buildUnnamed1407(); |
525 o.message = "foo"; | 568 o.message = "foo"; |
526 } | 569 } |
527 buildCounterStatus--; | 570 buildCounterStatus--; |
528 return o; | 571 return o; |
529 } | 572 } |
530 | 573 |
531 checkStatus(api.Status o) { | 574 checkStatus(api.Status o) { |
532 buildCounterStatus++; | 575 buildCounterStatus++; |
533 if (buildCounterStatus < 3) { | 576 if (buildCounterStatus < 3) { |
534 unittest.expect(o.code, unittest.equals(42)); | 577 unittest.expect(o.code, unittest.equals(42)); |
535 checkUnnamed1417(o.details); | 578 checkUnnamed1407(o.details); |
536 unittest.expect(o.message, unittest.equals('foo')); | 579 unittest.expect(o.message, unittest.equals('foo')); |
537 } | 580 } |
538 buildCounterStatus--; | 581 buildCounterStatus--; |
539 } | 582 } |
540 | 583 |
541 core.int buildCounterTimeOfDay = 0; | 584 core.int buildCounterTimeOfDay = 0; |
542 buildTimeOfDay() { | 585 buildTimeOfDay() { |
543 var o = new api.TimeOfDay(); | 586 var o = new api.TimeOfDay(); |
544 buildCounterTimeOfDay++; | 587 buildCounterTimeOfDay++; |
545 if (buildCounterTimeOfDay < 3) { | 588 if (buildCounterTimeOfDay < 3) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 unittest.expect(o.lastModificationTime, unittest.equals('foo')); | 683 unittest.expect(o.lastModificationTime, unittest.equals('foo')); |
641 unittest.expect(o.name, unittest.equals('foo')); | 684 unittest.expect(o.name, unittest.equals('foo')); |
642 unittest.expect(o.projectId, unittest.equals('foo')); | 685 unittest.expect(o.projectId, unittest.equals('foo')); |
643 checkSchedule(o.schedule); | 686 checkSchedule(o.schedule); |
644 unittest.expect(o.status, unittest.equals('foo')); | 687 unittest.expect(o.status, unittest.equals('foo')); |
645 checkTransferSpec(o.transferSpec); | 688 checkTransferSpec(o.transferSpec); |
646 } | 689 } |
647 buildCounterTransferJob--; | 690 buildCounterTransferJob--; |
648 } | 691 } |
649 | 692 |
650 buildUnnamed1418() { | 693 buildUnnamed1408() { |
651 var o = new core.List<api.ErrorSummary>(); | 694 var o = new core.List<api.ErrorSummary>(); |
652 o.add(buildErrorSummary()); | 695 o.add(buildErrorSummary()); |
653 o.add(buildErrorSummary()); | 696 o.add(buildErrorSummary()); |
654 return o; | 697 return o; |
655 } | 698 } |
656 | 699 |
657 checkUnnamed1418(core.List<api.ErrorSummary> o) { | 700 checkUnnamed1408(core.List<api.ErrorSummary> o) { |
658 unittest.expect(o, unittest.hasLength(2)); | 701 unittest.expect(o, unittest.hasLength(2)); |
659 checkErrorSummary(o[0]); | 702 checkErrorSummary(o[0]); |
660 checkErrorSummary(o[1]); | 703 checkErrorSummary(o[1]); |
661 } | 704 } |
662 | 705 |
663 core.int buildCounterTransferOperation = 0; | 706 core.int buildCounterTransferOperation = 0; |
664 buildTransferOperation() { | 707 buildTransferOperation() { |
665 var o = new api.TransferOperation(); | 708 var o = new api.TransferOperation(); |
666 buildCounterTransferOperation++; | 709 buildCounterTransferOperation++; |
667 if (buildCounterTransferOperation < 3) { | 710 if (buildCounterTransferOperation < 3) { |
668 o.counters = buildTransferCounters(); | 711 o.counters = buildTransferCounters(); |
669 o.endTime = "foo"; | 712 o.endTime = "foo"; |
670 o.errorBreakdowns = buildUnnamed1418(); | 713 o.errorBreakdowns = buildUnnamed1408(); |
671 o.name = "foo"; | 714 o.name = "foo"; |
672 o.projectId = "foo"; | 715 o.projectId = "foo"; |
673 o.startTime = "foo"; | 716 o.startTime = "foo"; |
674 o.status = "foo"; | 717 o.status = "foo"; |
675 o.transferJobName = "foo"; | 718 o.transferJobName = "foo"; |
676 o.transferSpec = buildTransferSpec(); | 719 o.transferSpec = buildTransferSpec(); |
677 } | 720 } |
678 buildCounterTransferOperation--; | 721 buildCounterTransferOperation--; |
679 return o; | 722 return o; |
680 } | 723 } |
681 | 724 |
682 checkTransferOperation(api.TransferOperation o) { | 725 checkTransferOperation(api.TransferOperation o) { |
683 buildCounterTransferOperation++; | 726 buildCounterTransferOperation++; |
684 if (buildCounterTransferOperation < 3) { | 727 if (buildCounterTransferOperation < 3) { |
685 checkTransferCounters(o.counters); | 728 checkTransferCounters(o.counters); |
686 unittest.expect(o.endTime, unittest.equals('foo')); | 729 unittest.expect(o.endTime, unittest.equals('foo')); |
687 checkUnnamed1418(o.errorBreakdowns); | 730 checkUnnamed1408(o.errorBreakdowns); |
688 unittest.expect(o.name, unittest.equals('foo')); | 731 unittest.expect(o.name, unittest.equals('foo')); |
689 unittest.expect(o.projectId, unittest.equals('foo')); | 732 unittest.expect(o.projectId, unittest.equals('foo')); |
690 unittest.expect(o.startTime, unittest.equals('foo')); | 733 unittest.expect(o.startTime, unittest.equals('foo')); |
691 unittest.expect(o.status, unittest.equals('foo')); | 734 unittest.expect(o.status, unittest.equals('foo')); |
692 unittest.expect(o.transferJobName, unittest.equals('foo')); | 735 unittest.expect(o.transferJobName, unittest.equals('foo')); |
693 checkTransferSpec(o.transferSpec); | 736 checkTransferSpec(o.transferSpec); |
694 } | 737 } |
695 buildCounterTransferOperation--; | 738 buildCounterTransferOperation--; |
696 } | 739 } |
697 | 740 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 checkUpdateTransferJobRequest(api.UpdateTransferJobRequest o) { | 806 checkUpdateTransferJobRequest(api.UpdateTransferJobRequest o) { |
764 buildCounterUpdateTransferJobRequest++; | 807 buildCounterUpdateTransferJobRequest++; |
765 if (buildCounterUpdateTransferJobRequest < 3) { | 808 if (buildCounterUpdateTransferJobRequest < 3) { |
766 unittest.expect(o.projectId, unittest.equals('foo')); | 809 unittest.expect(o.projectId, unittest.equals('foo')); |
767 checkTransferJob(o.transferJob); | 810 checkTransferJob(o.transferJob); |
768 unittest.expect(o.updateTransferJobFieldMask, unittest.equals('foo')); | 811 unittest.expect(o.updateTransferJobFieldMask, unittest.equals('foo')); |
769 } | 812 } |
770 buildCounterUpdateTransferJobRequest--; | 813 buildCounterUpdateTransferJobRequest--; |
771 } | 814 } |
772 | 815 |
773 | |
774 main() { | 816 main() { |
775 unittest.group("obj-schema-AwsAccessKey", () { | 817 unittest.group("obj-schema-AwsAccessKey", () { |
776 unittest.test("to-json--from-json", () { | 818 unittest.test("to-json--from-json", () { |
777 var o = buildAwsAccessKey(); | 819 var o = buildAwsAccessKey(); |
778 var od = new api.AwsAccessKey.fromJson(o.toJson()); | 820 var od = new api.AwsAccessKey.fromJson(o.toJson()); |
779 checkAwsAccessKey(od); | 821 checkAwsAccessKey(od); |
780 }); | 822 }); |
781 }); | 823 }); |
782 | 824 |
783 | |
784 unittest.group("obj-schema-AwsS3Data", () { | 825 unittest.group("obj-schema-AwsS3Data", () { |
785 unittest.test("to-json--from-json", () { | 826 unittest.test("to-json--from-json", () { |
786 var o = buildAwsS3Data(); | 827 var o = buildAwsS3Data(); |
787 var od = new api.AwsS3Data.fromJson(o.toJson()); | 828 var od = new api.AwsS3Data.fromJson(o.toJson()); |
788 checkAwsS3Data(od); | 829 checkAwsS3Data(od); |
789 }); | 830 }); |
790 }); | 831 }); |
791 | 832 |
792 | |
793 unittest.group("obj-schema-Date", () { | 833 unittest.group("obj-schema-Date", () { |
794 unittest.test("to-json--from-json", () { | 834 unittest.test("to-json--from-json", () { |
795 var o = buildDate(); | 835 var o = buildDate(); |
796 var od = new api.Date.fromJson(o.toJson()); | 836 var od = new api.Date.fromJson(o.toJson()); |
797 checkDate(od); | 837 checkDate(od); |
798 }); | 838 }); |
799 }); | 839 }); |
800 | 840 |
801 | |
802 unittest.group("obj-schema-Empty", () { | 841 unittest.group("obj-schema-Empty", () { |
803 unittest.test("to-json--from-json", () { | 842 unittest.test("to-json--from-json", () { |
804 var o = buildEmpty(); | 843 var o = buildEmpty(); |
805 var od = new api.Empty.fromJson(o.toJson()); | 844 var od = new api.Empty.fromJson(o.toJson()); |
806 checkEmpty(od); | 845 checkEmpty(od); |
807 }); | 846 }); |
808 }); | 847 }); |
809 | 848 |
810 | |
811 unittest.group("obj-schema-ErrorLogEntry", () { | 849 unittest.group("obj-schema-ErrorLogEntry", () { |
812 unittest.test("to-json--from-json", () { | 850 unittest.test("to-json--from-json", () { |
813 var o = buildErrorLogEntry(); | 851 var o = buildErrorLogEntry(); |
814 var od = new api.ErrorLogEntry.fromJson(o.toJson()); | 852 var od = new api.ErrorLogEntry.fromJson(o.toJson()); |
815 checkErrorLogEntry(od); | 853 checkErrorLogEntry(od); |
816 }); | 854 }); |
817 }); | 855 }); |
818 | 856 |
819 | |
820 unittest.group("obj-schema-ErrorSummary", () { | 857 unittest.group("obj-schema-ErrorSummary", () { |
821 unittest.test("to-json--from-json", () { | 858 unittest.test("to-json--from-json", () { |
822 var o = buildErrorSummary(); | 859 var o = buildErrorSummary(); |
823 var od = new api.ErrorSummary.fromJson(o.toJson()); | 860 var od = new api.ErrorSummary.fromJson(o.toJson()); |
824 checkErrorSummary(od); | 861 checkErrorSummary(od); |
825 }); | 862 }); |
826 }); | 863 }); |
827 | 864 |
828 | |
829 unittest.group("obj-schema-GcsData", () { | 865 unittest.group("obj-schema-GcsData", () { |
830 unittest.test("to-json--from-json", () { | 866 unittest.test("to-json--from-json", () { |
831 var o = buildGcsData(); | 867 var o = buildGcsData(); |
832 var od = new api.GcsData.fromJson(o.toJson()); | 868 var od = new api.GcsData.fromJson(o.toJson()); |
833 checkGcsData(od); | 869 checkGcsData(od); |
834 }); | 870 }); |
835 }); | 871 }); |
836 | 872 |
837 | |
838 unittest.group("obj-schema-GoogleServiceAccount", () { | 873 unittest.group("obj-schema-GoogleServiceAccount", () { |
839 unittest.test("to-json--from-json", () { | 874 unittest.test("to-json--from-json", () { |
840 var o = buildGoogleServiceAccount(); | 875 var o = buildGoogleServiceAccount(); |
841 var od = new api.GoogleServiceAccount.fromJson(o.toJson()); | 876 var od = new api.GoogleServiceAccount.fromJson(o.toJson()); |
842 checkGoogleServiceAccount(od); | 877 checkGoogleServiceAccount(od); |
843 }); | 878 }); |
844 }); | 879 }); |
845 | 880 |
846 | |
847 unittest.group("obj-schema-HttpData", () { | 881 unittest.group("obj-schema-HttpData", () { |
848 unittest.test("to-json--from-json", () { | 882 unittest.test("to-json--from-json", () { |
849 var o = buildHttpData(); | 883 var o = buildHttpData(); |
850 var od = new api.HttpData.fromJson(o.toJson()); | 884 var od = new api.HttpData.fromJson(o.toJson()); |
851 checkHttpData(od); | 885 checkHttpData(od); |
852 }); | 886 }); |
853 }); | 887 }); |
854 | 888 |
855 | |
856 unittest.group("obj-schema-ListOperationsResponse", () { | 889 unittest.group("obj-schema-ListOperationsResponse", () { |
857 unittest.test("to-json--from-json", () { | 890 unittest.test("to-json--from-json", () { |
858 var o = buildListOperationsResponse(); | 891 var o = buildListOperationsResponse(); |
859 var od = new api.ListOperationsResponse.fromJson(o.toJson()); | 892 var od = new api.ListOperationsResponse.fromJson(o.toJson()); |
860 checkListOperationsResponse(od); | 893 checkListOperationsResponse(od); |
861 }); | 894 }); |
862 }); | 895 }); |
863 | 896 |
864 | |
865 unittest.group("obj-schema-ListTransferJobsResponse", () { | 897 unittest.group("obj-schema-ListTransferJobsResponse", () { |
866 unittest.test("to-json--from-json", () { | 898 unittest.test("to-json--from-json", () { |
867 var o = buildListTransferJobsResponse(); | 899 var o = buildListTransferJobsResponse(); |
868 var od = new api.ListTransferJobsResponse.fromJson(o.toJson()); | 900 var od = new api.ListTransferJobsResponse.fromJson(o.toJson()); |
869 checkListTransferJobsResponse(od); | 901 checkListTransferJobsResponse(od); |
870 }); | 902 }); |
871 }); | 903 }); |
872 | 904 |
873 | |
874 unittest.group("obj-schema-ObjectConditions", () { | 905 unittest.group("obj-schema-ObjectConditions", () { |
875 unittest.test("to-json--from-json", () { | 906 unittest.test("to-json--from-json", () { |
876 var o = buildObjectConditions(); | 907 var o = buildObjectConditions(); |
877 var od = new api.ObjectConditions.fromJson(o.toJson()); | 908 var od = new api.ObjectConditions.fromJson(o.toJson()); |
878 checkObjectConditions(od); | 909 checkObjectConditions(od); |
879 }); | 910 }); |
880 }); | 911 }); |
881 | 912 |
882 | |
883 unittest.group("obj-schema-Operation", () { | 913 unittest.group("obj-schema-Operation", () { |
884 unittest.test("to-json--from-json", () { | 914 unittest.test("to-json--from-json", () { |
885 var o = buildOperation(); | 915 var o = buildOperation(); |
886 var od = new api.Operation.fromJson(o.toJson()); | 916 var od = new api.Operation.fromJson(o.toJson()); |
887 checkOperation(od); | 917 checkOperation(od); |
888 }); | 918 }); |
889 }); | 919 }); |
890 | 920 |
891 | |
892 unittest.group("obj-schema-PauseTransferOperationRequest", () { | 921 unittest.group("obj-schema-PauseTransferOperationRequest", () { |
893 unittest.test("to-json--from-json", () { | 922 unittest.test("to-json--from-json", () { |
894 var o = buildPauseTransferOperationRequest(); | 923 var o = buildPauseTransferOperationRequest(); |
895 var od = new api.PauseTransferOperationRequest.fromJson(o.toJson()); | 924 var od = new api.PauseTransferOperationRequest.fromJson(o.toJson()); |
896 checkPauseTransferOperationRequest(od); | 925 checkPauseTransferOperationRequest(od); |
897 }); | 926 }); |
898 }); | 927 }); |
899 | 928 |
900 | |
901 unittest.group("obj-schema-ResumeTransferOperationRequest", () { | 929 unittest.group("obj-schema-ResumeTransferOperationRequest", () { |
902 unittest.test("to-json--from-json", () { | 930 unittest.test("to-json--from-json", () { |
903 var o = buildResumeTransferOperationRequest(); | 931 var o = buildResumeTransferOperationRequest(); |
904 var od = new api.ResumeTransferOperationRequest.fromJson(o.toJson()); | 932 var od = new api.ResumeTransferOperationRequest.fromJson(o.toJson()); |
905 checkResumeTransferOperationRequest(od); | 933 checkResumeTransferOperationRequest(od); |
906 }); | 934 }); |
907 }); | 935 }); |
908 | 936 |
909 | |
910 unittest.group("obj-schema-Schedule", () { | 937 unittest.group("obj-schema-Schedule", () { |
911 unittest.test("to-json--from-json", () { | 938 unittest.test("to-json--from-json", () { |
912 var o = buildSchedule(); | 939 var o = buildSchedule(); |
913 var od = new api.Schedule.fromJson(o.toJson()); | 940 var od = new api.Schedule.fromJson(o.toJson()); |
914 checkSchedule(od); | 941 checkSchedule(od); |
915 }); | 942 }); |
916 }); | 943 }); |
917 | 944 |
918 | |
919 unittest.group("obj-schema-Status", () { | 945 unittest.group("obj-schema-Status", () { |
920 unittest.test("to-json--from-json", () { | 946 unittest.test("to-json--from-json", () { |
921 var o = buildStatus(); | 947 var o = buildStatus(); |
922 var od = new api.Status.fromJson(o.toJson()); | 948 var od = new api.Status.fromJson(o.toJson()); |
923 checkStatus(od); | 949 checkStatus(od); |
924 }); | 950 }); |
925 }); | 951 }); |
926 | 952 |
927 | |
928 unittest.group("obj-schema-TimeOfDay", () { | 953 unittest.group("obj-schema-TimeOfDay", () { |
929 unittest.test("to-json--from-json", () { | 954 unittest.test("to-json--from-json", () { |
930 var o = buildTimeOfDay(); | 955 var o = buildTimeOfDay(); |
931 var od = new api.TimeOfDay.fromJson(o.toJson()); | 956 var od = new api.TimeOfDay.fromJson(o.toJson()); |
932 checkTimeOfDay(od); | 957 checkTimeOfDay(od); |
933 }); | 958 }); |
934 }); | 959 }); |
935 | 960 |
936 | |
937 unittest.group("obj-schema-TransferCounters", () { | 961 unittest.group("obj-schema-TransferCounters", () { |
938 unittest.test("to-json--from-json", () { | 962 unittest.test("to-json--from-json", () { |
939 var o = buildTransferCounters(); | 963 var o = buildTransferCounters(); |
940 var od = new api.TransferCounters.fromJson(o.toJson()); | 964 var od = new api.TransferCounters.fromJson(o.toJson()); |
941 checkTransferCounters(od); | 965 checkTransferCounters(od); |
942 }); | 966 }); |
943 }); | 967 }); |
944 | 968 |
945 | |
946 unittest.group("obj-schema-TransferJob", () { | 969 unittest.group("obj-schema-TransferJob", () { |
947 unittest.test("to-json--from-json", () { | 970 unittest.test("to-json--from-json", () { |
948 var o = buildTransferJob(); | 971 var o = buildTransferJob(); |
949 var od = new api.TransferJob.fromJson(o.toJson()); | 972 var od = new api.TransferJob.fromJson(o.toJson()); |
950 checkTransferJob(od); | 973 checkTransferJob(od); |
951 }); | 974 }); |
952 }); | 975 }); |
953 | 976 |
954 | |
955 unittest.group("obj-schema-TransferOperation", () { | 977 unittest.group("obj-schema-TransferOperation", () { |
956 unittest.test("to-json--from-json", () { | 978 unittest.test("to-json--from-json", () { |
957 var o = buildTransferOperation(); | 979 var o = buildTransferOperation(); |
958 var od = new api.TransferOperation.fromJson(o.toJson()); | 980 var od = new api.TransferOperation.fromJson(o.toJson()); |
959 checkTransferOperation(od); | 981 checkTransferOperation(od); |
960 }); | 982 }); |
961 }); | 983 }); |
962 | 984 |
963 | |
964 unittest.group("obj-schema-TransferOptions", () { | 985 unittest.group("obj-schema-TransferOptions", () { |
965 unittest.test("to-json--from-json", () { | 986 unittest.test("to-json--from-json", () { |
966 var o = buildTransferOptions(); | 987 var o = buildTransferOptions(); |
967 var od = new api.TransferOptions.fromJson(o.toJson()); | 988 var od = new api.TransferOptions.fromJson(o.toJson()); |
968 checkTransferOptions(od); | 989 checkTransferOptions(od); |
969 }); | 990 }); |
970 }); | 991 }); |
971 | 992 |
972 | |
973 unittest.group("obj-schema-TransferSpec", () { | 993 unittest.group("obj-schema-TransferSpec", () { |
974 unittest.test("to-json--from-json", () { | 994 unittest.test("to-json--from-json", () { |
975 var o = buildTransferSpec(); | 995 var o = buildTransferSpec(); |
976 var od = new api.TransferSpec.fromJson(o.toJson()); | 996 var od = new api.TransferSpec.fromJson(o.toJson()); |
977 checkTransferSpec(od); | 997 checkTransferSpec(od); |
978 }); | 998 }); |
979 }); | 999 }); |
980 | 1000 |
981 | |
982 unittest.group("obj-schema-UpdateTransferJobRequest", () { | 1001 unittest.group("obj-schema-UpdateTransferJobRequest", () { |
983 unittest.test("to-json--from-json", () { | 1002 unittest.test("to-json--from-json", () { |
984 var o = buildUpdateTransferJobRequest(); | 1003 var o = buildUpdateTransferJobRequest(); |
985 var od = new api.UpdateTransferJobRequest.fromJson(o.toJson()); | 1004 var od = new api.UpdateTransferJobRequest.fromJson(o.toJson()); |
986 checkUpdateTransferJobRequest(od); | 1005 checkUpdateTransferJobRequest(od); |
987 }); | 1006 }); |
988 }); | 1007 }); |
989 | 1008 |
990 | |
991 unittest.group("resource-GoogleServiceAccountsResourceApi", () { | 1009 unittest.group("resource-GoogleServiceAccountsResourceApi", () { |
992 unittest.test("method--get", () { | 1010 unittest.test("method--get", () { |
993 | |
994 var mock = new HttpServerMock(); | 1011 var mock = new HttpServerMock(); |
995 api.GoogleServiceAccountsResourceApi res = new api.StoragetransferApi(mock
).googleServiceAccounts; | 1012 api.GoogleServiceAccountsResourceApi res = |
| 1013 new api.StoragetransferApi(mock).googleServiceAccounts; |
996 var arg_projectId = "foo"; | 1014 var arg_projectId = "foo"; |
997 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1015 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
998 var path = (req.url).path; | 1016 var path = (req.url).path; |
999 var pathOffset = 0; | 1017 var pathOffset = 0; |
1000 var index; | 1018 var index; |
1001 var subPart; | 1019 var subPart; |
1002 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1020 unittest.expect( |
| 1021 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1003 pathOffset += 1; | 1022 pathOffset += 1; |
1004 unittest.expect(path.substring(pathOffset, pathOffset + 25), unittest.eq
uals("v1/googleServiceAccounts/")); | 1023 unittest.expect(path.substring(pathOffset, pathOffset + 25), |
| 1024 unittest.equals("v1/googleServiceAccounts/")); |
1005 pathOffset += 25; | 1025 pathOffset += 25; |
1006 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1026 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
1007 pathOffset = path.length; | 1027 pathOffset = path.length; |
1008 unittest.expect(subPart, unittest.equals("$arg_projectId")); | 1028 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
1009 | 1029 |
1010 var query = (req.url).query; | 1030 var query = (req.url).query; |
1011 var queryOffset = 0; | 1031 var queryOffset = 0; |
1012 var queryMap = {}; | 1032 var queryMap = {}; |
1013 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1033 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1014 parseBool(n) { | 1034 parseBool(n) { |
1015 if (n == "true") return true; | 1035 if (n == "true") return true; |
1016 if (n == "false") return false; | 1036 if (n == "false") return false; |
1017 if (n == null) return null; | 1037 if (n == null) return null; |
1018 throw new core.ArgumentError("Invalid boolean: $n"); | 1038 throw new core.ArgumentError("Invalid boolean: $n"); |
1019 } | 1039 } |
| 1040 |
1020 if (query.length > 0) { | 1041 if (query.length > 0) { |
1021 for (var part in query.split("&")) { | 1042 for (var part in query.split("&")) { |
1022 var keyvalue = part.split("="); | 1043 var keyvalue = part.split("="); |
1023 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1044 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1045 core.Uri.decodeQueryComponent(keyvalue[1])); |
1024 } | 1046 } |
1025 } | 1047 } |
1026 | 1048 |
1027 | |
1028 var h = { | 1049 var h = { |
1029 "content-type" : "application/json; charset=utf-8", | 1050 "content-type": "application/json; charset=utf-8", |
1030 }; | 1051 }; |
1031 var resp = convert.JSON.encode(buildGoogleServiceAccount()); | 1052 var resp = convert.JSON.encode(buildGoogleServiceAccount()); |
1032 return new async.Future.value(stringResponse(200, h, resp)); | 1053 return new async.Future.value(stringResponse(200, h, resp)); |
1033 }), true); | 1054 }), true); |
1034 res.get(arg_projectId).then(unittest.expectAsync1(((api.GoogleServiceAccou
nt response) { | 1055 res |
| 1056 .get(arg_projectId) |
| 1057 .then(unittest.expectAsync1(((api.GoogleServiceAccount response) { |
1035 checkGoogleServiceAccount(response); | 1058 checkGoogleServiceAccount(response); |
1036 }))); | 1059 }))); |
1037 }); | 1060 }); |
1038 | |
1039 }); | 1061 }); |
1040 | 1062 |
1041 | |
1042 unittest.group("resource-TransferJobsResourceApi", () { | 1063 unittest.group("resource-TransferJobsResourceApi", () { |
1043 unittest.test("method--create", () { | 1064 unittest.test("method--create", () { |
1044 | |
1045 var mock = new HttpServerMock(); | 1065 var mock = new HttpServerMock(); |
1046 api.TransferJobsResourceApi res = new api.StoragetransferApi(mock).transfe
rJobs; | 1066 api.TransferJobsResourceApi res = |
| 1067 new api.StoragetransferApi(mock).transferJobs; |
1047 var arg_request = buildTransferJob(); | 1068 var arg_request = buildTransferJob(); |
1048 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1069 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1049 var obj = new api.TransferJob.fromJson(json); | 1070 var obj = new api.TransferJob.fromJson(json); |
1050 checkTransferJob(obj); | 1071 checkTransferJob(obj); |
1051 | 1072 |
1052 var path = (req.url).path; | 1073 var path = (req.url).path; |
1053 var pathOffset = 0; | 1074 var pathOffset = 0; |
1054 var index; | 1075 var index; |
1055 var subPart; | 1076 var subPart; |
1056 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1077 unittest.expect( |
| 1078 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1057 pathOffset += 1; | 1079 pathOffset += 1; |
1058 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("v1/transferJobs")); | 1080 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 1081 unittest.equals("v1/transferJobs")); |
1059 pathOffset += 15; | 1082 pathOffset += 15; |
1060 | 1083 |
1061 var query = (req.url).query; | 1084 var query = (req.url).query; |
1062 var queryOffset = 0; | 1085 var queryOffset = 0; |
1063 var queryMap = {}; | 1086 var queryMap = {}; |
1064 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1087 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1065 parseBool(n) { | 1088 parseBool(n) { |
1066 if (n == "true") return true; | 1089 if (n == "true") return true; |
1067 if (n == "false") return false; | 1090 if (n == "false") return false; |
1068 if (n == null) return null; | 1091 if (n == null) return null; |
1069 throw new core.ArgumentError("Invalid boolean: $n"); | 1092 throw new core.ArgumentError("Invalid boolean: $n"); |
1070 } | 1093 } |
| 1094 |
1071 if (query.length > 0) { | 1095 if (query.length > 0) { |
1072 for (var part in query.split("&")) { | 1096 for (var part in query.split("&")) { |
1073 var keyvalue = part.split("="); | 1097 var keyvalue = part.split("="); |
1074 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1098 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1099 core.Uri.decodeQueryComponent(keyvalue[1])); |
1075 } | 1100 } |
1076 } | 1101 } |
1077 | 1102 |
1078 | |
1079 var h = { | 1103 var h = { |
1080 "content-type" : "application/json; charset=utf-8", | 1104 "content-type": "application/json; charset=utf-8", |
1081 }; | 1105 }; |
1082 var resp = convert.JSON.encode(buildTransferJob()); | 1106 var resp = convert.JSON.encode(buildTransferJob()); |
1083 return new async.Future.value(stringResponse(200, h, resp)); | 1107 return new async.Future.value(stringResponse(200, h, resp)); |
1084 }), true); | 1108 }), true); |
1085 res.create(arg_request).then(unittest.expectAsync1(((api.TransferJob respo
nse) { | 1109 res |
| 1110 .create(arg_request) |
| 1111 .then(unittest.expectAsync1(((api.TransferJob response) { |
1086 checkTransferJob(response); | 1112 checkTransferJob(response); |
1087 }))); | 1113 }))); |
1088 }); | 1114 }); |
1089 | 1115 |
1090 unittest.test("method--get", () { | 1116 unittest.test("method--get", () { |
1091 | |
1092 var mock = new HttpServerMock(); | 1117 var mock = new HttpServerMock(); |
1093 api.TransferJobsResourceApi res = new api.StoragetransferApi(mock).transfe
rJobs; | 1118 api.TransferJobsResourceApi res = |
| 1119 new api.StoragetransferApi(mock).transferJobs; |
1094 var arg_jobName = "foo"; | 1120 var arg_jobName = "foo"; |
1095 var arg_projectId = "foo"; | 1121 var arg_projectId = "foo"; |
1096 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1122 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1097 var path = (req.url).path; | 1123 var path = (req.url).path; |
1098 var pathOffset = 0; | 1124 var pathOffset = 0; |
1099 var index; | 1125 var index; |
1100 var subPart; | 1126 var subPart; |
1101 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1127 unittest.expect( |
| 1128 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1102 pathOffset += 1; | 1129 pathOffset += 1; |
1103 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1130 unittest.expect( |
| 1131 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1104 pathOffset += 3; | 1132 pathOffset += 3; |
1105 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1133 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1106 | 1134 |
1107 var query = (req.url).query; | 1135 var query = (req.url).query; |
1108 var queryOffset = 0; | 1136 var queryOffset = 0; |
1109 var queryMap = {}; | 1137 var queryMap = {}; |
1110 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1138 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1111 parseBool(n) { | 1139 parseBool(n) { |
1112 if (n == "true") return true; | 1140 if (n == "true") return true; |
1113 if (n == "false") return false; | 1141 if (n == "false") return false; |
1114 if (n == null) return null; | 1142 if (n == null) return null; |
1115 throw new core.ArgumentError("Invalid boolean: $n"); | 1143 throw new core.ArgumentError("Invalid boolean: $n"); |
1116 } | 1144 } |
| 1145 |
1117 if (query.length > 0) { | 1146 if (query.length > 0) { |
1118 for (var part in query.split("&")) { | 1147 for (var part in query.split("&")) { |
1119 var keyvalue = part.split("="); | 1148 var keyvalue = part.split("="); |
1120 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1149 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1150 core.Uri.decodeQueryComponent(keyvalue[1])); |
1121 } | 1151 } |
1122 } | 1152 } |
1123 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1153 unittest.expect( |
1124 | 1154 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1125 | 1155 |
1126 var h = { | 1156 var h = { |
1127 "content-type" : "application/json; charset=utf-8", | 1157 "content-type": "application/json; charset=utf-8", |
1128 }; | 1158 }; |
1129 var resp = convert.JSON.encode(buildTransferJob()); | 1159 var resp = convert.JSON.encode(buildTransferJob()); |
1130 return new async.Future.value(stringResponse(200, h, resp)); | 1160 return new async.Future.value(stringResponse(200, h, resp)); |
1131 }), true); | 1161 }), true); |
1132 res.get(arg_jobName, projectId: arg_projectId).then(unittest.expectAsync1(
((api.TransferJob response) { | 1162 res |
| 1163 .get(arg_jobName, projectId: arg_projectId) |
| 1164 .then(unittest.expectAsync1(((api.TransferJob response) { |
1133 checkTransferJob(response); | 1165 checkTransferJob(response); |
1134 }))); | 1166 }))); |
1135 }); | 1167 }); |
1136 | 1168 |
1137 unittest.test("method--list", () { | 1169 unittest.test("method--list", () { |
1138 | |
1139 var mock = new HttpServerMock(); | 1170 var mock = new HttpServerMock(); |
1140 api.TransferJobsResourceApi res = new api.StoragetransferApi(mock).transfe
rJobs; | 1171 api.TransferJobsResourceApi res = |
| 1172 new api.StoragetransferApi(mock).transferJobs; |
| 1173 var arg_pageSize = 42; |
1141 var arg_filter = "foo"; | 1174 var arg_filter = "foo"; |
1142 var arg_pageToken = "foo"; | 1175 var arg_pageToken = "foo"; |
1143 var arg_pageSize = 42; | |
1144 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1176 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1145 var path = (req.url).path; | 1177 var path = (req.url).path; |
1146 var pathOffset = 0; | 1178 var pathOffset = 0; |
1147 var index; | 1179 var index; |
1148 var subPart; | 1180 var subPart; |
1149 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1181 unittest.expect( |
| 1182 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1150 pathOffset += 1; | 1183 pathOffset += 1; |
1151 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("v1/transferJobs")); | 1184 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 1185 unittest.equals("v1/transferJobs")); |
1152 pathOffset += 15; | 1186 pathOffset += 15; |
1153 | 1187 |
1154 var query = (req.url).query; | 1188 var query = (req.url).query; |
1155 var queryOffset = 0; | 1189 var queryOffset = 0; |
1156 var queryMap = {}; | 1190 var queryMap = {}; |
1157 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1191 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1158 parseBool(n) { | 1192 parseBool(n) { |
1159 if (n == "true") return true; | 1193 if (n == "true") return true; |
1160 if (n == "false") return false; | 1194 if (n == "false") return false; |
1161 if (n == null) return null; | 1195 if (n == null) return null; |
1162 throw new core.ArgumentError("Invalid boolean: $n"); | 1196 throw new core.ArgumentError("Invalid boolean: $n"); |
1163 } | 1197 } |
| 1198 |
1164 if (query.length > 0) { | 1199 if (query.length > 0) { |
1165 for (var part in query.split("&")) { | 1200 for (var part in query.split("&")) { |
1166 var keyvalue = part.split("="); | 1201 var keyvalue = part.split("="); |
1167 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1202 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1203 core.Uri.decodeQueryComponent(keyvalue[1])); |
1168 } | 1204 } |
1169 } | 1205 } |
| 1206 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1207 unittest.equals(arg_pageSize)); |
1170 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 1208 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
1171 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1209 unittest.expect( |
1172 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1210 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1173 | |
1174 | 1211 |
1175 var h = { | 1212 var h = { |
1176 "content-type" : "application/json; charset=utf-8", | 1213 "content-type": "application/json; charset=utf-8", |
1177 }; | 1214 }; |
1178 var resp = convert.JSON.encode(buildListTransferJobsResponse()); | 1215 var resp = convert.JSON.encode(buildListTransferJobsResponse()); |
1179 return new async.Future.value(stringResponse(200, h, resp)); | 1216 return new async.Future.value(stringResponse(200, h, resp)); |
1180 }), true); | 1217 }), true); |
1181 res.list(filter: arg_filter, pageToken: arg_pageToken, pageSize: arg_pageS
ize).then(unittest.expectAsync1(((api.ListTransferJobsResponse response) { | 1218 res |
| 1219 .list( |
| 1220 pageSize: arg_pageSize, |
| 1221 filter: arg_filter, |
| 1222 pageToken: arg_pageToken) |
| 1223 .then(unittest.expectAsync1(((api.ListTransferJobsResponse response) { |
1182 checkListTransferJobsResponse(response); | 1224 checkListTransferJobsResponse(response); |
1183 }))); | 1225 }))); |
1184 }); | 1226 }); |
1185 | 1227 |
1186 unittest.test("method--patch", () { | 1228 unittest.test("method--patch", () { |
1187 | |
1188 var mock = new HttpServerMock(); | 1229 var mock = new HttpServerMock(); |
1189 api.TransferJobsResourceApi res = new api.StoragetransferApi(mock).transfe
rJobs; | 1230 api.TransferJobsResourceApi res = |
| 1231 new api.StoragetransferApi(mock).transferJobs; |
1190 var arg_request = buildUpdateTransferJobRequest(); | 1232 var arg_request = buildUpdateTransferJobRequest(); |
1191 var arg_jobName = "foo"; | 1233 var arg_jobName = "foo"; |
1192 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1234 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1193 var obj = new api.UpdateTransferJobRequest.fromJson(json); | 1235 var obj = new api.UpdateTransferJobRequest.fromJson(json); |
1194 checkUpdateTransferJobRequest(obj); | 1236 checkUpdateTransferJobRequest(obj); |
1195 | 1237 |
1196 var path = (req.url).path; | 1238 var path = (req.url).path; |
1197 var pathOffset = 0; | 1239 var pathOffset = 0; |
1198 var index; | 1240 var index; |
1199 var subPart; | 1241 var subPart; |
1200 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1242 unittest.expect( |
| 1243 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1201 pathOffset += 1; | 1244 pathOffset += 1; |
1202 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1245 unittest.expect( |
| 1246 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1203 pathOffset += 3; | 1247 pathOffset += 3; |
1204 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1248 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1205 | 1249 |
1206 var query = (req.url).query; | 1250 var query = (req.url).query; |
1207 var queryOffset = 0; | 1251 var queryOffset = 0; |
1208 var queryMap = {}; | 1252 var queryMap = {}; |
1209 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1253 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1210 parseBool(n) { | 1254 parseBool(n) { |
1211 if (n == "true") return true; | 1255 if (n == "true") return true; |
1212 if (n == "false") return false; | 1256 if (n == "false") return false; |
1213 if (n == null) return null; | 1257 if (n == null) return null; |
1214 throw new core.ArgumentError("Invalid boolean: $n"); | 1258 throw new core.ArgumentError("Invalid boolean: $n"); |
1215 } | 1259 } |
| 1260 |
1216 if (query.length > 0) { | 1261 if (query.length > 0) { |
1217 for (var part in query.split("&")) { | 1262 for (var part in query.split("&")) { |
1218 var keyvalue = part.split("="); | 1263 var keyvalue = part.split("="); |
1219 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1264 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1265 core.Uri.decodeQueryComponent(keyvalue[1])); |
1220 } | 1266 } |
1221 } | 1267 } |
1222 | 1268 |
1223 | |
1224 var h = { | 1269 var h = { |
1225 "content-type" : "application/json; charset=utf-8", | 1270 "content-type": "application/json; charset=utf-8", |
1226 }; | 1271 }; |
1227 var resp = convert.JSON.encode(buildTransferJob()); | 1272 var resp = convert.JSON.encode(buildTransferJob()); |
1228 return new async.Future.value(stringResponse(200, h, resp)); | 1273 return new async.Future.value(stringResponse(200, h, resp)); |
1229 }), true); | 1274 }), true); |
1230 res.patch(arg_request, arg_jobName).then(unittest.expectAsync1(((api.Trans
ferJob response) { | 1275 res |
| 1276 .patch(arg_request, arg_jobName) |
| 1277 .then(unittest.expectAsync1(((api.TransferJob response) { |
1231 checkTransferJob(response); | 1278 checkTransferJob(response); |
1232 }))); | 1279 }))); |
1233 }); | 1280 }); |
1234 | |
1235 }); | 1281 }); |
1236 | 1282 |
1237 | |
1238 unittest.group("resource-TransferOperationsResourceApi", () { | 1283 unittest.group("resource-TransferOperationsResourceApi", () { |
1239 unittest.test("method--cancel", () { | 1284 unittest.test("method--cancel", () { |
1240 | |
1241 var mock = new HttpServerMock(); | 1285 var mock = new HttpServerMock(); |
1242 api.TransferOperationsResourceApi res = new api.StoragetransferApi(mock).t
ransferOperations; | 1286 api.TransferOperationsResourceApi res = |
| 1287 new api.StoragetransferApi(mock).transferOperations; |
1243 var arg_name = "foo"; | 1288 var arg_name = "foo"; |
1244 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1289 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1245 var path = (req.url).path; | 1290 var path = (req.url).path; |
1246 var pathOffset = 0; | 1291 var pathOffset = 0; |
1247 var index; | 1292 var index; |
1248 var subPart; | 1293 var subPart; |
1249 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1294 unittest.expect( |
| 1295 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1250 pathOffset += 1; | 1296 pathOffset += 1; |
1251 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1297 unittest.expect( |
| 1298 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1252 pathOffset += 3; | 1299 pathOffset += 3; |
1253 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1300 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1254 | 1301 |
1255 var query = (req.url).query; | 1302 var query = (req.url).query; |
1256 var queryOffset = 0; | 1303 var queryOffset = 0; |
1257 var queryMap = {}; | 1304 var queryMap = {}; |
1258 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1305 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1259 parseBool(n) { | 1306 parseBool(n) { |
1260 if (n == "true") return true; | 1307 if (n == "true") return true; |
1261 if (n == "false") return false; | 1308 if (n == "false") return false; |
1262 if (n == null) return null; | 1309 if (n == null) return null; |
1263 throw new core.ArgumentError("Invalid boolean: $n"); | 1310 throw new core.ArgumentError("Invalid boolean: $n"); |
1264 } | 1311 } |
| 1312 |
1265 if (query.length > 0) { | 1313 if (query.length > 0) { |
1266 for (var part in query.split("&")) { | 1314 for (var part in query.split("&")) { |
1267 var keyvalue = part.split("="); | 1315 var keyvalue = part.split("="); |
1268 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1316 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1317 core.Uri.decodeQueryComponent(keyvalue[1])); |
1269 } | 1318 } |
1270 } | 1319 } |
1271 | 1320 |
1272 | |
1273 var h = { | 1321 var h = { |
1274 "content-type" : "application/json; charset=utf-8", | 1322 "content-type": "application/json; charset=utf-8", |
1275 }; | 1323 }; |
1276 var resp = convert.JSON.encode(buildEmpty()); | 1324 var resp = convert.JSON.encode(buildEmpty()); |
1277 return new async.Future.value(stringResponse(200, h, resp)); | 1325 return new async.Future.value(stringResponse(200, h, resp)); |
1278 }), true); | 1326 }), true); |
1279 res.cancel(arg_name).then(unittest.expectAsync1(((api.Empty response) { | 1327 res.cancel(arg_name).then(unittest.expectAsync1(((api.Empty response) { |
1280 checkEmpty(response); | 1328 checkEmpty(response); |
1281 }))); | 1329 }))); |
1282 }); | 1330 }); |
1283 | 1331 |
1284 unittest.test("method--delete", () { | 1332 unittest.test("method--delete", () { |
1285 | |
1286 var mock = new HttpServerMock(); | 1333 var mock = new HttpServerMock(); |
1287 api.TransferOperationsResourceApi res = new api.StoragetransferApi(mock).t
ransferOperations; | 1334 api.TransferOperationsResourceApi res = |
| 1335 new api.StoragetransferApi(mock).transferOperations; |
1288 var arg_name = "foo"; | 1336 var arg_name = "foo"; |
1289 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1337 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1290 var path = (req.url).path; | 1338 var path = (req.url).path; |
1291 var pathOffset = 0; | 1339 var pathOffset = 0; |
1292 var index; | 1340 var index; |
1293 var subPart; | 1341 var subPart; |
1294 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1342 unittest.expect( |
| 1343 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1295 pathOffset += 1; | 1344 pathOffset += 1; |
1296 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1345 unittest.expect( |
| 1346 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1297 pathOffset += 3; | 1347 pathOffset += 3; |
1298 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1348 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1299 | 1349 |
1300 var query = (req.url).query; | 1350 var query = (req.url).query; |
1301 var queryOffset = 0; | 1351 var queryOffset = 0; |
1302 var queryMap = {}; | 1352 var queryMap = {}; |
1303 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1353 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1304 parseBool(n) { | 1354 parseBool(n) { |
1305 if (n == "true") return true; | 1355 if (n == "true") return true; |
1306 if (n == "false") return false; | 1356 if (n == "false") return false; |
1307 if (n == null) return null; | 1357 if (n == null) return null; |
1308 throw new core.ArgumentError("Invalid boolean: $n"); | 1358 throw new core.ArgumentError("Invalid boolean: $n"); |
1309 } | 1359 } |
| 1360 |
1310 if (query.length > 0) { | 1361 if (query.length > 0) { |
1311 for (var part in query.split("&")) { | 1362 for (var part in query.split("&")) { |
1312 var keyvalue = part.split("="); | 1363 var keyvalue = part.split("="); |
1313 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1364 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1365 core.Uri.decodeQueryComponent(keyvalue[1])); |
1314 } | 1366 } |
1315 } | 1367 } |
1316 | 1368 |
1317 | |
1318 var h = { | 1369 var h = { |
1319 "content-type" : "application/json; charset=utf-8", | 1370 "content-type": "application/json; charset=utf-8", |
1320 }; | 1371 }; |
1321 var resp = convert.JSON.encode(buildEmpty()); | 1372 var resp = convert.JSON.encode(buildEmpty()); |
1322 return new async.Future.value(stringResponse(200, h, resp)); | 1373 return new async.Future.value(stringResponse(200, h, resp)); |
1323 }), true); | 1374 }), true); |
1324 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { | 1375 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { |
1325 checkEmpty(response); | 1376 checkEmpty(response); |
1326 }))); | 1377 }))); |
1327 }); | 1378 }); |
1328 | 1379 |
1329 unittest.test("method--get", () { | 1380 unittest.test("method--get", () { |
1330 | |
1331 var mock = new HttpServerMock(); | 1381 var mock = new HttpServerMock(); |
1332 api.TransferOperationsResourceApi res = new api.StoragetransferApi(mock).t
ransferOperations; | 1382 api.TransferOperationsResourceApi res = |
| 1383 new api.StoragetransferApi(mock).transferOperations; |
1333 var arg_name = "foo"; | 1384 var arg_name = "foo"; |
1334 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1385 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1335 var path = (req.url).path; | 1386 var path = (req.url).path; |
1336 var pathOffset = 0; | 1387 var pathOffset = 0; |
1337 var index; | 1388 var index; |
1338 var subPart; | 1389 var subPart; |
1339 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1390 unittest.expect( |
| 1391 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1340 pathOffset += 1; | 1392 pathOffset += 1; |
1341 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1393 unittest.expect( |
| 1394 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1342 pathOffset += 3; | 1395 pathOffset += 3; |
1343 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1396 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1344 | 1397 |
1345 var query = (req.url).query; | 1398 var query = (req.url).query; |
1346 var queryOffset = 0; | 1399 var queryOffset = 0; |
1347 var queryMap = {}; | 1400 var queryMap = {}; |
1348 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1401 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1349 parseBool(n) { | 1402 parseBool(n) { |
1350 if (n == "true") return true; | 1403 if (n == "true") return true; |
1351 if (n == "false") return false; | 1404 if (n == "false") return false; |
1352 if (n == null) return null; | 1405 if (n == null) return null; |
1353 throw new core.ArgumentError("Invalid boolean: $n"); | 1406 throw new core.ArgumentError("Invalid boolean: $n"); |
1354 } | 1407 } |
| 1408 |
1355 if (query.length > 0) { | 1409 if (query.length > 0) { |
1356 for (var part in query.split("&")) { | 1410 for (var part in query.split("&")) { |
1357 var keyvalue = part.split("="); | 1411 var keyvalue = part.split("="); |
1358 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1412 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1413 core.Uri.decodeQueryComponent(keyvalue[1])); |
1359 } | 1414 } |
1360 } | 1415 } |
1361 | 1416 |
1362 | |
1363 var h = { | 1417 var h = { |
1364 "content-type" : "application/json; charset=utf-8", | 1418 "content-type": "application/json; charset=utf-8", |
1365 }; | 1419 }; |
1366 var resp = convert.JSON.encode(buildOperation()); | 1420 var resp = convert.JSON.encode(buildOperation()); |
1367 return new async.Future.value(stringResponse(200, h, resp)); | 1421 return new async.Future.value(stringResponse(200, h, resp)); |
1368 }), true); | 1422 }), true); |
1369 res.get(arg_name).then(unittest.expectAsync1(((api.Operation response) { | 1423 res.get(arg_name).then(unittest.expectAsync1(((api.Operation response) { |
1370 checkOperation(response); | 1424 checkOperation(response); |
1371 }))); | 1425 }))); |
1372 }); | 1426 }); |
1373 | 1427 |
1374 unittest.test("method--list", () { | 1428 unittest.test("method--list", () { |
1375 | |
1376 var mock = new HttpServerMock(); | 1429 var mock = new HttpServerMock(); |
1377 api.TransferOperationsResourceApi res = new api.StoragetransferApi(mock).t
ransferOperations; | 1430 api.TransferOperationsResourceApi res = |
| 1431 new api.StoragetransferApi(mock).transferOperations; |
1378 var arg_name = "foo"; | 1432 var arg_name = "foo"; |
1379 var arg_pageToken = "foo"; | |
1380 var arg_pageSize = 42; | 1433 var arg_pageSize = 42; |
1381 var arg_filter = "foo"; | 1434 var arg_filter = "foo"; |
| 1435 var arg_pageToken = "foo"; |
1382 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1436 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1383 var path = (req.url).path; | 1437 var path = (req.url).path; |
1384 var pathOffset = 0; | 1438 var pathOffset = 0; |
1385 var index; | 1439 var index; |
1386 var subPart; | 1440 var subPart; |
1387 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1441 unittest.expect( |
| 1442 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1388 pathOffset += 1; | 1443 pathOffset += 1; |
1389 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1444 unittest.expect( |
| 1445 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1390 pathOffset += 3; | 1446 pathOffset += 3; |
1391 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1447 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1392 | 1448 |
1393 var query = (req.url).query; | 1449 var query = (req.url).query; |
1394 var queryOffset = 0; | 1450 var queryOffset = 0; |
1395 var queryMap = {}; | 1451 var queryMap = {}; |
1396 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1452 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1397 parseBool(n) { | 1453 parseBool(n) { |
1398 if (n == "true") return true; | 1454 if (n == "true") return true; |
1399 if (n == "false") return false; | 1455 if (n == "false") return false; |
1400 if (n == null) return null; | 1456 if (n == null) return null; |
1401 throw new core.ArgumentError("Invalid boolean: $n"); | 1457 throw new core.ArgumentError("Invalid boolean: $n"); |
1402 } | 1458 } |
| 1459 |
1403 if (query.length > 0) { | 1460 if (query.length > 0) { |
1404 for (var part in query.split("&")) { | 1461 for (var part in query.split("&")) { |
1405 var keyvalue = part.split("="); | 1462 var keyvalue = part.split("="); |
1406 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1463 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1464 core.Uri.decodeQueryComponent(keyvalue[1])); |
1407 } | 1465 } |
1408 } | 1466 } |
1409 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1467 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
1410 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1468 unittest.equals(arg_pageSize)); |
1411 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 1469 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
1412 | 1470 unittest.expect( |
| 1471 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1413 | 1472 |
1414 var h = { | 1473 var h = { |
1415 "content-type" : "application/json; charset=utf-8", | 1474 "content-type": "application/json; charset=utf-8", |
1416 }; | 1475 }; |
1417 var resp = convert.JSON.encode(buildListOperationsResponse()); | 1476 var resp = convert.JSON.encode(buildListOperationsResponse()); |
1418 return new async.Future.value(stringResponse(200, h, resp)); | 1477 return new async.Future.value(stringResponse(200, h, resp)); |
1419 }), true); | 1478 }), true); |
1420 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize, filte
r: arg_filter).then(unittest.expectAsync1(((api.ListOperationsResponse response)
{ | 1479 res |
| 1480 .list(arg_name, |
| 1481 pageSize: arg_pageSize, |
| 1482 filter: arg_filter, |
| 1483 pageToken: arg_pageToken) |
| 1484 .then(unittest.expectAsync1(((api.ListOperationsResponse response) { |
1421 checkListOperationsResponse(response); | 1485 checkListOperationsResponse(response); |
1422 }))); | 1486 }))); |
1423 }); | 1487 }); |
1424 | 1488 |
1425 unittest.test("method--pause", () { | 1489 unittest.test("method--pause", () { |
1426 | |
1427 var mock = new HttpServerMock(); | 1490 var mock = new HttpServerMock(); |
1428 api.TransferOperationsResourceApi res = new api.StoragetransferApi(mock).t
ransferOperations; | 1491 api.TransferOperationsResourceApi res = |
| 1492 new api.StoragetransferApi(mock).transferOperations; |
1429 var arg_request = buildPauseTransferOperationRequest(); | 1493 var arg_request = buildPauseTransferOperationRequest(); |
1430 var arg_name = "foo"; | 1494 var arg_name = "foo"; |
1431 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1495 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1432 var obj = new api.PauseTransferOperationRequest.fromJson(json); | 1496 var obj = new api.PauseTransferOperationRequest.fromJson(json); |
1433 checkPauseTransferOperationRequest(obj); | 1497 checkPauseTransferOperationRequest(obj); |
1434 | 1498 |
1435 var path = (req.url).path; | 1499 var path = (req.url).path; |
1436 var pathOffset = 0; | 1500 var pathOffset = 0; |
1437 var index; | 1501 var index; |
1438 var subPart; | 1502 var subPart; |
1439 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1503 unittest.expect( |
| 1504 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1440 pathOffset += 1; | 1505 pathOffset += 1; |
1441 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1506 unittest.expect( |
| 1507 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1442 pathOffset += 3; | 1508 pathOffset += 3; |
1443 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1509 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1444 | 1510 |
1445 var query = (req.url).query; | 1511 var query = (req.url).query; |
1446 var queryOffset = 0; | 1512 var queryOffset = 0; |
1447 var queryMap = {}; | 1513 var queryMap = {}; |
1448 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1514 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1449 parseBool(n) { | 1515 parseBool(n) { |
1450 if (n == "true") return true; | 1516 if (n == "true") return true; |
1451 if (n == "false") return false; | 1517 if (n == "false") return false; |
1452 if (n == null) return null; | 1518 if (n == null) return null; |
1453 throw new core.ArgumentError("Invalid boolean: $n"); | 1519 throw new core.ArgumentError("Invalid boolean: $n"); |
1454 } | 1520 } |
| 1521 |
1455 if (query.length > 0) { | 1522 if (query.length > 0) { |
1456 for (var part in query.split("&")) { | 1523 for (var part in query.split("&")) { |
1457 var keyvalue = part.split("="); | 1524 var keyvalue = part.split("="); |
1458 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1525 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1526 core.Uri.decodeQueryComponent(keyvalue[1])); |
1459 } | 1527 } |
1460 } | 1528 } |
1461 | 1529 |
1462 | |
1463 var h = { | 1530 var h = { |
1464 "content-type" : "application/json; charset=utf-8", | 1531 "content-type": "application/json; charset=utf-8", |
1465 }; | 1532 }; |
1466 var resp = convert.JSON.encode(buildEmpty()); | 1533 var resp = convert.JSON.encode(buildEmpty()); |
1467 return new async.Future.value(stringResponse(200, h, resp)); | 1534 return new async.Future.value(stringResponse(200, h, resp)); |
1468 }), true); | 1535 }), true); |
1469 res.pause(arg_request, arg_name).then(unittest.expectAsync1(((api.Empty re
sponse) { | 1536 res |
| 1537 .pause(arg_request, arg_name) |
| 1538 .then(unittest.expectAsync1(((api.Empty response) { |
1470 checkEmpty(response); | 1539 checkEmpty(response); |
1471 }))); | 1540 }))); |
1472 }); | 1541 }); |
1473 | 1542 |
1474 unittest.test("method--resume", () { | 1543 unittest.test("method--resume", () { |
1475 | |
1476 var mock = new HttpServerMock(); | 1544 var mock = new HttpServerMock(); |
1477 api.TransferOperationsResourceApi res = new api.StoragetransferApi(mock).t
ransferOperations; | 1545 api.TransferOperationsResourceApi res = |
| 1546 new api.StoragetransferApi(mock).transferOperations; |
1478 var arg_request = buildResumeTransferOperationRequest(); | 1547 var arg_request = buildResumeTransferOperationRequest(); |
1479 var arg_name = "foo"; | 1548 var arg_name = "foo"; |
1480 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1549 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1481 var obj = new api.ResumeTransferOperationRequest.fromJson(json); | 1550 var obj = new api.ResumeTransferOperationRequest.fromJson(json); |
1482 checkResumeTransferOperationRequest(obj); | 1551 checkResumeTransferOperationRequest(obj); |
1483 | 1552 |
1484 var path = (req.url).path; | 1553 var path = (req.url).path; |
1485 var pathOffset = 0; | 1554 var pathOffset = 0; |
1486 var index; | 1555 var index; |
1487 var subPart; | 1556 var subPart; |
1488 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1557 unittest.expect( |
| 1558 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1489 pathOffset += 1; | 1559 pathOffset += 1; |
1490 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1560 unittest.expect( |
| 1561 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1491 pathOffset += 3; | 1562 pathOffset += 3; |
1492 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1563 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1493 | 1564 |
1494 var query = (req.url).query; | 1565 var query = (req.url).query; |
1495 var queryOffset = 0; | 1566 var queryOffset = 0; |
1496 var queryMap = {}; | 1567 var queryMap = {}; |
1497 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1568 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1498 parseBool(n) { | 1569 parseBool(n) { |
1499 if (n == "true") return true; | 1570 if (n == "true") return true; |
1500 if (n == "false") return false; | 1571 if (n == "false") return false; |
1501 if (n == null) return null; | 1572 if (n == null) return null; |
1502 throw new core.ArgumentError("Invalid boolean: $n"); | 1573 throw new core.ArgumentError("Invalid boolean: $n"); |
1503 } | 1574 } |
| 1575 |
1504 if (query.length > 0) { | 1576 if (query.length > 0) { |
1505 for (var part in query.split("&")) { | 1577 for (var part in query.split("&")) { |
1506 var keyvalue = part.split("="); | 1578 var keyvalue = part.split("="); |
1507 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1579 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1580 core.Uri.decodeQueryComponent(keyvalue[1])); |
1508 } | 1581 } |
1509 } | 1582 } |
1510 | 1583 |
1511 | |
1512 var h = { | 1584 var h = { |
1513 "content-type" : "application/json; charset=utf-8", | 1585 "content-type": "application/json; charset=utf-8", |
1514 }; | 1586 }; |
1515 var resp = convert.JSON.encode(buildEmpty()); | 1587 var resp = convert.JSON.encode(buildEmpty()); |
1516 return new async.Future.value(stringResponse(200, h, resp)); | 1588 return new async.Future.value(stringResponse(200, h, resp)); |
1517 }), true); | 1589 }), true); |
1518 res.resume(arg_request, arg_name).then(unittest.expectAsync1(((api.Empty r
esponse) { | 1590 res |
| 1591 .resume(arg_request, arg_name) |
| 1592 .then(unittest.expectAsync1(((api.Empty response) { |
1519 checkEmpty(response); | 1593 checkEmpty(response); |
1520 }))); | 1594 }))); |
1521 }); | 1595 }); |
1522 | |
1523 }); | 1596 }); |
1524 | |
1525 | |
1526 } | 1597 } |
1527 | |
OLD | NEW |