Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: generated/googleapis/test/androiddeviceprovisioning/v1_test.dart

Issue 2987103002: Api-Roll 52: 2017-07-31 (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library googleapis.androiddeviceprovisioning.v1.test;
2
3 import "dart:core" as core;
4 import "dart:collection" as collection;
5 import "dart:async" as async;
6 import "dart:convert" as convert;
7
8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing;
10 import 'package:test/test.dart' as unittest;
11
12 import 'package:googleapis/androiddeviceprovisioning/v1.dart' as api;
13
14 class HttpServerMock extends http.BaseClient {
15 core.Function _callback;
16 core.bool _expectJson;
17
18 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback;
20 _expectJson = expectJson;
21 }
22
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) {
24 if (_expectJson) {
25 return request.finalize()
26 .transform(convert.UTF8.decoder)
27 .join('')
28 .then((core.String jsonString) {
29 if (jsonString.isEmpty) {
30 return _callback(request, null);
31 } else {
32 return _callback(request, convert.JSON.decode(jsonString));
33 }
34 });
35 } else {
36 var stream = request.finalize();
37 if (stream == null) {
38 return _callback(request, []);
39 } else {
40 return stream.toBytes().then((data) {
41 return _callback(request, data);
42 });
43 }
44 }
45 }
46 }
47
48 http.StreamedResponse stringResponse(
49 core.int status, core.Map<core.String, core.String> headers, core.String bod y) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers);
52 }
53
54 core.int buildCounterClaimDeviceRequest = 0;
55 buildClaimDeviceRequest() {
56 var o = new api.ClaimDeviceRequest();
57 buildCounterClaimDeviceRequest++;
58 if (buildCounterClaimDeviceRequest < 3) {
59 o.customerId = "foo";
60 o.deviceIdentifier = buildDeviceIdentifier();
61 o.sectionType = "foo";
62 }
63 buildCounterClaimDeviceRequest--;
64 return o;
65 }
66
67 checkClaimDeviceRequest(api.ClaimDeviceRequest o) {
68 buildCounterClaimDeviceRequest++;
69 if (buildCounterClaimDeviceRequest < 3) {
70 unittest.expect(o.customerId, unittest.equals('foo'));
71 checkDeviceIdentifier(o.deviceIdentifier);
72 unittest.expect(o.sectionType, unittest.equals('foo'));
73 }
74 buildCounterClaimDeviceRequest--;
75 }
76
77 core.int buildCounterClaimDeviceResponse = 0;
78 buildClaimDeviceResponse() {
79 var o = new api.ClaimDeviceResponse();
80 buildCounterClaimDeviceResponse++;
81 if (buildCounterClaimDeviceResponse < 3) {
82 o.deviceId = "foo";
83 o.deviceName = "foo";
84 }
85 buildCounterClaimDeviceResponse--;
86 return o;
87 }
88
89 checkClaimDeviceResponse(api.ClaimDeviceResponse o) {
90 buildCounterClaimDeviceResponse++;
91 if (buildCounterClaimDeviceResponse < 3) {
92 unittest.expect(o.deviceId, unittest.equals('foo'));
93 unittest.expect(o.deviceName, unittest.equals('foo'));
94 }
95 buildCounterClaimDeviceResponse--;
96 }
97
98 buildUnnamed54() {
99 var o = new core.List<api.PartnerClaim>();
100 o.add(buildPartnerClaim());
101 o.add(buildPartnerClaim());
102 return o;
103 }
104
105 checkUnnamed54(core.List<api.PartnerClaim> o) {
106 unittest.expect(o, unittest.hasLength(2));
107 checkPartnerClaim(o[0]);
108 checkPartnerClaim(o[1]);
109 }
110
111 core.int buildCounterClaimDevicesRequest = 0;
112 buildClaimDevicesRequest() {
113 var o = new api.ClaimDevicesRequest();
114 buildCounterClaimDevicesRequest++;
115 if (buildCounterClaimDevicesRequest < 3) {
116 o.claims = buildUnnamed54();
117 }
118 buildCounterClaimDevicesRequest--;
119 return o;
120 }
121
122 checkClaimDevicesRequest(api.ClaimDevicesRequest o) {
123 buildCounterClaimDevicesRequest++;
124 if (buildCounterClaimDevicesRequest < 3) {
125 checkUnnamed54(o.claims);
126 }
127 buildCounterClaimDevicesRequest--;
128 }
129
130 core.int buildCounterCompany = 0;
131 buildCompany() {
132 var o = new api.Company();
133 buildCounterCompany++;
134 if (buildCounterCompany < 3) {
135 o.companyId = "foo";
136 o.companyName = "foo";
137 }
138 buildCounterCompany--;
139 return o;
140 }
141
142 checkCompany(api.Company o) {
143 buildCounterCompany++;
144 if (buildCounterCompany < 3) {
145 unittest.expect(o.companyId, unittest.equals('foo'));
146 unittest.expect(o.companyName, unittest.equals('foo'));
147 }
148 buildCounterCompany--;
149 }
150
151 buildUnnamed55() {
152 var o = new core.List<api.DeviceClaim>();
153 o.add(buildDeviceClaim());
154 o.add(buildDeviceClaim());
155 return o;
156 }
157
158 checkUnnamed55(core.List<api.DeviceClaim> o) {
159 unittest.expect(o, unittest.hasLength(2));
160 checkDeviceClaim(o[0]);
161 checkDeviceClaim(o[1]);
162 }
163
164 core.int buildCounterDevice = 0;
165 buildDevice() {
166 var o = new api.Device();
167 buildCounterDevice++;
168 if (buildCounterDevice < 3) {
169 o.claims = buildUnnamed55();
170 o.deviceId = "foo";
171 o.deviceIdentifier = buildDeviceIdentifier();
172 o.deviceMetadata = buildDeviceMetadata();
173 o.name = "foo";
174 }
175 buildCounterDevice--;
176 return o;
177 }
178
179 checkDevice(api.Device o) {
180 buildCounterDevice++;
181 if (buildCounterDevice < 3) {
182 checkUnnamed55(o.claims);
183 unittest.expect(o.deviceId, unittest.equals('foo'));
184 checkDeviceIdentifier(o.deviceIdentifier);
185 checkDeviceMetadata(o.deviceMetadata);
186 unittest.expect(o.name, unittest.equals('foo'));
187 }
188 buildCounterDevice--;
189 }
190
191 core.int buildCounterDeviceClaim = 0;
192 buildDeviceClaim() {
193 var o = new api.DeviceClaim();
194 buildCounterDeviceClaim++;
195 if (buildCounterDeviceClaim < 3) {
196 o.ownerCompanyId = "foo";
197 o.sectionType = "foo";
198 }
199 buildCounterDeviceClaim--;
200 return o;
201 }
202
203 checkDeviceClaim(api.DeviceClaim o) {
204 buildCounterDeviceClaim++;
205 if (buildCounterDeviceClaim < 3) {
206 unittest.expect(o.ownerCompanyId, unittest.equals('foo'));
207 unittest.expect(o.sectionType, unittest.equals('foo'));
208 }
209 buildCounterDeviceClaim--;
210 }
211
212 core.int buildCounterDeviceIdentifier = 0;
213 buildDeviceIdentifier() {
214 var o = new api.DeviceIdentifier();
215 buildCounterDeviceIdentifier++;
216 if (buildCounterDeviceIdentifier < 3) {
217 o.imei = "foo";
218 o.manufacturer = "foo";
219 o.meid = "foo";
220 o.model = "foo";
221 o.serialNumber = "foo";
222 }
223 buildCounterDeviceIdentifier--;
224 return o;
225 }
226
227 checkDeviceIdentifier(api.DeviceIdentifier o) {
228 buildCounterDeviceIdentifier++;
229 if (buildCounterDeviceIdentifier < 3) {
230 unittest.expect(o.imei, unittest.equals('foo'));
231 unittest.expect(o.manufacturer, unittest.equals('foo'));
232 unittest.expect(o.meid, unittest.equals('foo'));
233 unittest.expect(o.model, unittest.equals('foo'));
234 unittest.expect(o.serialNumber, unittest.equals('foo'));
235 }
236 buildCounterDeviceIdentifier--;
237 }
238
239 buildUnnamed56() {
240 var o = new core.Map<core.String, core.String>();
241 o["x"] = "foo";
242 o["y"] = "foo";
243 return o;
244 }
245
246 checkUnnamed56(core.Map<core.String, core.String> o) {
247 unittest.expect(o, unittest.hasLength(2));
248 unittest.expect(o["x"], unittest.equals('foo'));
249 unittest.expect(o["y"], unittest.equals('foo'));
250 }
251
252 core.int buildCounterDeviceMetadata = 0;
253 buildDeviceMetadata() {
254 var o = new api.DeviceMetadata();
255 buildCounterDeviceMetadata++;
256 if (buildCounterDeviceMetadata < 3) {
257 o.entries = buildUnnamed56();
258 }
259 buildCounterDeviceMetadata--;
260 return o;
261 }
262
263 checkDeviceMetadata(api.DeviceMetadata o) {
264 buildCounterDeviceMetadata++;
265 if (buildCounterDeviceMetadata < 3) {
266 checkUnnamed56(o.entries);
267 }
268 buildCounterDeviceMetadata--;
269 }
270
271 core.int buildCounterDevicesLongRunningOperationMetadata = 0;
272 buildDevicesLongRunningOperationMetadata() {
273 var o = new api.DevicesLongRunningOperationMetadata();
274 buildCounterDevicesLongRunningOperationMetadata++;
275 if (buildCounterDevicesLongRunningOperationMetadata < 3) {
276 o.devicesCount = 42;
277 o.processingStatus = "foo";
278 o.progress = 42;
279 }
280 buildCounterDevicesLongRunningOperationMetadata--;
281 return o;
282 }
283
284 checkDevicesLongRunningOperationMetadata(api.DevicesLongRunningOperationMetadata o) {
285 buildCounterDevicesLongRunningOperationMetadata++;
286 if (buildCounterDevicesLongRunningOperationMetadata < 3) {
287 unittest.expect(o.devicesCount, unittest.equals(42));
288 unittest.expect(o.processingStatus, unittest.equals('foo'));
289 unittest.expect(o.progress, unittest.equals(42));
290 }
291 buildCounterDevicesLongRunningOperationMetadata--;
292 }
293
294 buildUnnamed57() {
295 var o = new core.List<api.OperationPerDevice>();
296 o.add(buildOperationPerDevice());
297 o.add(buildOperationPerDevice());
298 return o;
299 }
300
301 checkUnnamed57(core.List<api.OperationPerDevice> o) {
302 unittest.expect(o, unittest.hasLength(2));
303 checkOperationPerDevice(o[0]);
304 checkOperationPerDevice(o[1]);
305 }
306
307 core.int buildCounterDevicesLongRunningOperationResponse = 0;
308 buildDevicesLongRunningOperationResponse() {
309 var o = new api.DevicesLongRunningOperationResponse();
310 buildCounterDevicesLongRunningOperationResponse++;
311 if (buildCounterDevicesLongRunningOperationResponse < 3) {
312 o.perDeviceStatus = buildUnnamed57();
313 o.successCount = 42;
314 }
315 buildCounterDevicesLongRunningOperationResponse--;
316 return o;
317 }
318
319 checkDevicesLongRunningOperationResponse(api.DevicesLongRunningOperationResponse o) {
320 buildCounterDevicesLongRunningOperationResponse++;
321 if (buildCounterDevicesLongRunningOperationResponse < 3) {
322 checkUnnamed57(o.perDeviceStatus);
323 unittest.expect(o.successCount, unittest.equals(42));
324 }
325 buildCounterDevicesLongRunningOperationResponse--;
326 }
327
328 core.int buildCounterEmpty = 0;
329 buildEmpty() {
330 var o = new api.Empty();
331 buildCounterEmpty++;
332 if (buildCounterEmpty < 3) {
333 }
334 buildCounterEmpty--;
335 return o;
336 }
337
338 checkEmpty(api.Empty o) {
339 buildCounterEmpty++;
340 if (buildCounterEmpty < 3) {
341 }
342 buildCounterEmpty--;
343 }
344
345 core.int buildCounterFindDevicesByDeviceIdentifierRequest = 0;
346 buildFindDevicesByDeviceIdentifierRequest() {
347 var o = new api.FindDevicesByDeviceIdentifierRequest();
348 buildCounterFindDevicesByDeviceIdentifierRequest++;
349 if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) {
350 o.deviceIdentifier = buildDeviceIdentifier();
351 o.limit = "foo";
352 o.pageToken = "foo";
353 }
354 buildCounterFindDevicesByDeviceIdentifierRequest--;
355 return o;
356 }
357
358 checkFindDevicesByDeviceIdentifierRequest(api.FindDevicesByDeviceIdentifierReque st o) {
359 buildCounterFindDevicesByDeviceIdentifierRequest++;
360 if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) {
361 checkDeviceIdentifier(o.deviceIdentifier);
362 unittest.expect(o.limit, unittest.equals('foo'));
363 unittest.expect(o.pageToken, unittest.equals('foo'));
364 }
365 buildCounterFindDevicesByDeviceIdentifierRequest--;
366 }
367
368 buildUnnamed58() {
369 var o = new core.List<api.Device>();
370 o.add(buildDevice());
371 o.add(buildDevice());
372 return o;
373 }
374
375 checkUnnamed58(core.List<api.Device> o) {
376 unittest.expect(o, unittest.hasLength(2));
377 checkDevice(o[0]);
378 checkDevice(o[1]);
379 }
380
381 core.int buildCounterFindDevicesByDeviceIdentifierResponse = 0;
382 buildFindDevicesByDeviceIdentifierResponse() {
383 var o = new api.FindDevicesByDeviceIdentifierResponse();
384 buildCounterFindDevicesByDeviceIdentifierResponse++;
385 if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) {
386 o.devices = buildUnnamed58();
387 o.nextPageToken = "foo";
388 }
389 buildCounterFindDevicesByDeviceIdentifierResponse--;
390 return o;
391 }
392
393 checkFindDevicesByDeviceIdentifierResponse(api.FindDevicesByDeviceIdentifierResp onse o) {
394 buildCounterFindDevicesByDeviceIdentifierResponse++;
395 if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) {
396 checkUnnamed58(o.devices);
397 unittest.expect(o.nextPageToken, unittest.equals('foo'));
398 }
399 buildCounterFindDevicesByDeviceIdentifierResponse--;
400 }
401
402 buildUnnamed59() {
403 var o = new core.List<core.String>();
404 o.add("foo");
405 o.add("foo");
406 return o;
407 }
408
409 checkUnnamed59(core.List<core.String> o) {
410 unittest.expect(o, unittest.hasLength(2));
411 unittest.expect(o[0], unittest.equals('foo'));
412 unittest.expect(o[1], unittest.equals('foo'));
413 }
414
415 core.int buildCounterFindDevicesByOwnerRequest = 0;
416 buildFindDevicesByOwnerRequest() {
417 var o = new api.FindDevicesByOwnerRequest();
418 buildCounterFindDevicesByOwnerRequest++;
419 if (buildCounterFindDevicesByOwnerRequest < 3) {
420 o.customerId = buildUnnamed59();
421 o.limit = "foo";
422 o.pageToken = "foo";
423 o.sectionType = "foo";
424 }
425 buildCounterFindDevicesByOwnerRequest--;
426 return o;
427 }
428
429 checkFindDevicesByOwnerRequest(api.FindDevicesByOwnerRequest o) {
430 buildCounterFindDevicesByOwnerRequest++;
431 if (buildCounterFindDevicesByOwnerRequest < 3) {
432 checkUnnamed59(o.customerId);
433 unittest.expect(o.limit, unittest.equals('foo'));
434 unittest.expect(o.pageToken, unittest.equals('foo'));
435 unittest.expect(o.sectionType, unittest.equals('foo'));
436 }
437 buildCounterFindDevicesByOwnerRequest--;
438 }
439
440 buildUnnamed60() {
441 var o = new core.List<api.Device>();
442 o.add(buildDevice());
443 o.add(buildDevice());
444 return o;
445 }
446
447 checkUnnamed60(core.List<api.Device> o) {
448 unittest.expect(o, unittest.hasLength(2));
449 checkDevice(o[0]);
450 checkDevice(o[1]);
451 }
452
453 core.int buildCounterFindDevicesByOwnerResponse = 0;
454 buildFindDevicesByOwnerResponse() {
455 var o = new api.FindDevicesByOwnerResponse();
456 buildCounterFindDevicesByOwnerResponse++;
457 if (buildCounterFindDevicesByOwnerResponse < 3) {
458 o.devices = buildUnnamed60();
459 o.nextPageToken = "foo";
460 }
461 buildCounterFindDevicesByOwnerResponse--;
462 return o;
463 }
464
465 checkFindDevicesByOwnerResponse(api.FindDevicesByOwnerResponse o) {
466 buildCounterFindDevicesByOwnerResponse++;
467 if (buildCounterFindDevicesByOwnerResponse < 3) {
468 checkUnnamed60(o.devices);
469 unittest.expect(o.nextPageToken, unittest.equals('foo'));
470 }
471 buildCounterFindDevicesByOwnerResponse--;
472 }
473
474 buildUnnamed61() {
475 var o = new core.List<api.Company>();
476 o.add(buildCompany());
477 o.add(buildCompany());
478 return o;
479 }
480
481 checkUnnamed61(core.List<api.Company> o) {
482 unittest.expect(o, unittest.hasLength(2));
483 checkCompany(o[0]);
484 checkCompany(o[1]);
485 }
486
487 core.int buildCounterListCustomersResponse = 0;
488 buildListCustomersResponse() {
489 var o = new api.ListCustomersResponse();
490 buildCounterListCustomersResponse++;
491 if (buildCounterListCustomersResponse < 3) {
492 o.customers = buildUnnamed61();
493 }
494 buildCounterListCustomersResponse--;
495 return o;
496 }
497
498 checkListCustomersResponse(api.ListCustomersResponse o) {
499 buildCounterListCustomersResponse++;
500 if (buildCounterListCustomersResponse < 3) {
501 checkUnnamed61(o.customers);
502 }
503 buildCounterListCustomersResponse--;
504 }
505
506 buildUnnamed62() {
507 var o = new core.Map<core.String, core.Object>();
508 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
509 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
510 return o;
511 }
512
513 checkUnnamed62(core.Map<core.String, core.Object> o) {
514 unittest.expect(o, unittest.hasLength(2));
515 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'));
516 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'));
517 }
518
519 buildUnnamed63() {
520 var o = new core.Map<core.String, core.Object>();
521 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
522 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
523 return o;
524 }
525
526 checkUnnamed63(core.Map<core.String, core.Object> o) {
527 unittest.expect(o, unittest.hasLength(2));
528 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'));
529 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'));
530 }
531
532 core.int buildCounterOperation = 0;
533 buildOperation() {
534 var o = new api.Operation();
535 buildCounterOperation++;
536 if (buildCounterOperation < 3) {
537 o.done = true;
538 o.error = buildStatus();
539 o.metadata = buildUnnamed62();
540 o.name = "foo";
541 o.response = buildUnnamed63();
542 }
543 buildCounterOperation--;
544 return o;
545 }
546
547 checkOperation(api.Operation o) {
548 buildCounterOperation++;
549 if (buildCounterOperation < 3) {
550 unittest.expect(o.done, unittest.isTrue);
551 checkStatus(o.error);
552 checkUnnamed62(o.metadata);
553 unittest.expect(o.name, unittest.equals('foo'));
554 checkUnnamed63(o.response);
555 }
556 buildCounterOperation--;
557 }
558
559 core.int buildCounterOperationPerDevice = 0;
560 buildOperationPerDevice() {
561 var o = new api.OperationPerDevice();
562 buildCounterOperationPerDevice++;
563 if (buildCounterOperationPerDevice < 3) {
564 o.claim = buildPartnerClaim();
565 o.result = buildPerDeviceStatusInBatch();
566 o.unclaim = buildPartnerUnclaim();
567 o.updateMetadata = buildUpdateMetadataArguments();
568 }
569 buildCounterOperationPerDevice--;
570 return o;
571 }
572
573 checkOperationPerDevice(api.OperationPerDevice o) {
574 buildCounterOperationPerDevice++;
575 if (buildCounterOperationPerDevice < 3) {
576 checkPartnerClaim(o.claim);
577 checkPerDeviceStatusInBatch(o.result);
578 checkPartnerUnclaim(o.unclaim);
579 checkUpdateMetadataArguments(o.updateMetadata);
580 }
581 buildCounterOperationPerDevice--;
582 }
583
584 core.int buildCounterPartnerClaim = 0;
585 buildPartnerClaim() {
586 var o = new api.PartnerClaim();
587 buildCounterPartnerClaim++;
588 if (buildCounterPartnerClaim < 3) {
589 o.customerId = "foo";
590 o.deviceIdentifier = buildDeviceIdentifier();
591 o.deviceMetadata = buildDeviceMetadata();
592 o.sectionType = "foo";
593 }
594 buildCounterPartnerClaim--;
595 return o;
596 }
597
598 checkPartnerClaim(api.PartnerClaim o) {
599 buildCounterPartnerClaim++;
600 if (buildCounterPartnerClaim < 3) {
601 unittest.expect(o.customerId, unittest.equals('foo'));
602 checkDeviceIdentifier(o.deviceIdentifier);
603 checkDeviceMetadata(o.deviceMetadata);
604 unittest.expect(o.sectionType, unittest.equals('foo'));
605 }
606 buildCounterPartnerClaim--;
607 }
608
609 core.int buildCounterPartnerUnclaim = 0;
610 buildPartnerUnclaim() {
611 var o = new api.PartnerUnclaim();
612 buildCounterPartnerUnclaim++;
613 if (buildCounterPartnerUnclaim < 3) {
614 o.deviceId = "foo";
615 o.deviceIdentifier = buildDeviceIdentifier();
616 o.sectionType = "foo";
617 }
618 buildCounterPartnerUnclaim--;
619 return o;
620 }
621
622 checkPartnerUnclaim(api.PartnerUnclaim o) {
623 buildCounterPartnerUnclaim++;
624 if (buildCounterPartnerUnclaim < 3) {
625 unittest.expect(o.deviceId, unittest.equals('foo'));
626 checkDeviceIdentifier(o.deviceIdentifier);
627 unittest.expect(o.sectionType, unittest.equals('foo'));
628 }
629 buildCounterPartnerUnclaim--;
630 }
631
632 core.int buildCounterPerDeviceStatusInBatch = 0;
633 buildPerDeviceStatusInBatch() {
634 var o = new api.PerDeviceStatusInBatch();
635 buildCounterPerDeviceStatusInBatch++;
636 if (buildCounterPerDeviceStatusInBatch < 3) {
637 o.deviceId = "foo";
638 o.errorIdentifier = "foo";
639 o.errorMessage = "foo";
640 o.status = "foo";
641 }
642 buildCounterPerDeviceStatusInBatch--;
643 return o;
644 }
645
646 checkPerDeviceStatusInBatch(api.PerDeviceStatusInBatch o) {
647 buildCounterPerDeviceStatusInBatch++;
648 if (buildCounterPerDeviceStatusInBatch < 3) {
649 unittest.expect(o.deviceId, unittest.equals('foo'));
650 unittest.expect(o.errorIdentifier, unittest.equals('foo'));
651 unittest.expect(o.errorMessage, unittest.equals('foo'));
652 unittest.expect(o.status, unittest.equals('foo'));
653 }
654 buildCounterPerDeviceStatusInBatch--;
655 }
656
657 buildUnnamed64() {
658 var o = new core.Map<core.String, core.Object>();
659 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
660 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
661 return o;
662 }
663
664 checkUnnamed64(core.Map<core.String, core.Object> o) {
665 unittest.expect(o, unittest.hasLength(2));
666 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'));
667 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'));
668 }
669
670 buildUnnamed65() {
671 var o = new core.List<core.Map<core.String, core.Object>>();
672 o.add(buildUnnamed64());
673 o.add(buildUnnamed64());
674 return o;
675 }
676
677 checkUnnamed65(core.List<core.Map<core.String, core.Object>> o) {
678 unittest.expect(o, unittest.hasLength(2));
679 checkUnnamed64(o[0]);
680 checkUnnamed64(o[1]);
681 }
682
683 core.int buildCounterStatus = 0;
684 buildStatus() {
685 var o = new api.Status();
686 buildCounterStatus++;
687 if (buildCounterStatus < 3) {
688 o.code = 42;
689 o.details = buildUnnamed65();
690 o.message = "foo";
691 }
692 buildCounterStatus--;
693 return o;
694 }
695
696 checkStatus(api.Status o) {
697 buildCounterStatus++;
698 if (buildCounterStatus < 3) {
699 unittest.expect(o.code, unittest.equals(42));
700 checkUnnamed65(o.details);
701 unittest.expect(o.message, unittest.equals('foo'));
702 }
703 buildCounterStatus--;
704 }
705
706 core.int buildCounterUnclaimDeviceRequest = 0;
707 buildUnclaimDeviceRequest() {
708 var o = new api.UnclaimDeviceRequest();
709 buildCounterUnclaimDeviceRequest++;
710 if (buildCounterUnclaimDeviceRequest < 3) {
711 o.deviceId = "foo";
712 o.deviceIdentifier = buildDeviceIdentifier();
713 o.sectionType = "foo";
714 }
715 buildCounterUnclaimDeviceRequest--;
716 return o;
717 }
718
719 checkUnclaimDeviceRequest(api.UnclaimDeviceRequest o) {
720 buildCounterUnclaimDeviceRequest++;
721 if (buildCounterUnclaimDeviceRequest < 3) {
722 unittest.expect(o.deviceId, unittest.equals('foo'));
723 checkDeviceIdentifier(o.deviceIdentifier);
724 unittest.expect(o.sectionType, unittest.equals('foo'));
725 }
726 buildCounterUnclaimDeviceRequest--;
727 }
728
729 buildUnnamed66() {
730 var o = new core.List<api.PartnerUnclaim>();
731 o.add(buildPartnerUnclaim());
732 o.add(buildPartnerUnclaim());
733 return o;
734 }
735
736 checkUnnamed66(core.List<api.PartnerUnclaim> o) {
737 unittest.expect(o, unittest.hasLength(2));
738 checkPartnerUnclaim(o[0]);
739 checkPartnerUnclaim(o[1]);
740 }
741
742 core.int buildCounterUnclaimDevicesRequest = 0;
743 buildUnclaimDevicesRequest() {
744 var o = new api.UnclaimDevicesRequest();
745 buildCounterUnclaimDevicesRequest++;
746 if (buildCounterUnclaimDevicesRequest < 3) {
747 o.unclaims = buildUnnamed66();
748 }
749 buildCounterUnclaimDevicesRequest--;
750 return o;
751 }
752
753 checkUnclaimDevicesRequest(api.UnclaimDevicesRequest o) {
754 buildCounterUnclaimDevicesRequest++;
755 if (buildCounterUnclaimDevicesRequest < 3) {
756 checkUnnamed66(o.unclaims);
757 }
758 buildCounterUnclaimDevicesRequest--;
759 }
760
761 buildUnnamed67() {
762 var o = new core.List<api.UpdateMetadataArguments>();
763 o.add(buildUpdateMetadataArguments());
764 o.add(buildUpdateMetadataArguments());
765 return o;
766 }
767
768 checkUnnamed67(core.List<api.UpdateMetadataArguments> o) {
769 unittest.expect(o, unittest.hasLength(2));
770 checkUpdateMetadataArguments(o[0]);
771 checkUpdateMetadataArguments(o[1]);
772 }
773
774 core.int buildCounterUpdateDeviceMetadataInBatchRequest = 0;
775 buildUpdateDeviceMetadataInBatchRequest() {
776 var o = new api.UpdateDeviceMetadataInBatchRequest();
777 buildCounterUpdateDeviceMetadataInBatchRequest++;
778 if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) {
779 o.updates = buildUnnamed67();
780 }
781 buildCounterUpdateDeviceMetadataInBatchRequest--;
782 return o;
783 }
784
785 checkUpdateDeviceMetadataInBatchRequest(api.UpdateDeviceMetadataInBatchRequest o ) {
786 buildCounterUpdateDeviceMetadataInBatchRequest++;
787 if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) {
788 checkUnnamed67(o.updates);
789 }
790 buildCounterUpdateDeviceMetadataInBatchRequest--;
791 }
792
793 core.int buildCounterUpdateDeviceMetadataRequest = 0;
794 buildUpdateDeviceMetadataRequest() {
795 var o = new api.UpdateDeviceMetadataRequest();
796 buildCounterUpdateDeviceMetadataRequest++;
797 if (buildCounterUpdateDeviceMetadataRequest < 3) {
798 o.deviceMetadata = buildDeviceMetadata();
799 }
800 buildCounterUpdateDeviceMetadataRequest--;
801 return o;
802 }
803
804 checkUpdateDeviceMetadataRequest(api.UpdateDeviceMetadataRequest o) {
805 buildCounterUpdateDeviceMetadataRequest++;
806 if (buildCounterUpdateDeviceMetadataRequest < 3) {
807 checkDeviceMetadata(o.deviceMetadata);
808 }
809 buildCounterUpdateDeviceMetadataRequest--;
810 }
811
812 core.int buildCounterUpdateMetadataArguments = 0;
813 buildUpdateMetadataArguments() {
814 var o = new api.UpdateMetadataArguments();
815 buildCounterUpdateMetadataArguments++;
816 if (buildCounterUpdateMetadataArguments < 3) {
817 o.deviceId = "foo";
818 o.deviceIdentifier = buildDeviceIdentifier();
819 o.deviceMetadata = buildDeviceMetadata();
820 }
821 buildCounterUpdateMetadataArguments--;
822 return o;
823 }
824
825 checkUpdateMetadataArguments(api.UpdateMetadataArguments o) {
826 buildCounterUpdateMetadataArguments++;
827 if (buildCounterUpdateMetadataArguments < 3) {
828 unittest.expect(o.deviceId, unittest.equals('foo'));
829 checkDeviceIdentifier(o.deviceIdentifier);
830 checkDeviceMetadata(o.deviceMetadata);
831 }
832 buildCounterUpdateMetadataArguments--;
833 }
834
835
836 main() {
837 unittest.group("obj-schema-ClaimDeviceRequest", () {
838 unittest.test("to-json--from-json", () {
839 var o = buildClaimDeviceRequest();
840 var od = new api.ClaimDeviceRequest.fromJson(o.toJson());
841 checkClaimDeviceRequest(od);
842 });
843 });
844
845
846 unittest.group("obj-schema-ClaimDeviceResponse", () {
847 unittest.test("to-json--from-json", () {
848 var o = buildClaimDeviceResponse();
849 var od = new api.ClaimDeviceResponse.fromJson(o.toJson());
850 checkClaimDeviceResponse(od);
851 });
852 });
853
854
855 unittest.group("obj-schema-ClaimDevicesRequest", () {
856 unittest.test("to-json--from-json", () {
857 var o = buildClaimDevicesRequest();
858 var od = new api.ClaimDevicesRequest.fromJson(o.toJson());
859 checkClaimDevicesRequest(od);
860 });
861 });
862
863
864 unittest.group("obj-schema-Company", () {
865 unittest.test("to-json--from-json", () {
866 var o = buildCompany();
867 var od = new api.Company.fromJson(o.toJson());
868 checkCompany(od);
869 });
870 });
871
872
873 unittest.group("obj-schema-Device", () {
874 unittest.test("to-json--from-json", () {
875 var o = buildDevice();
876 var od = new api.Device.fromJson(o.toJson());
877 checkDevice(od);
878 });
879 });
880
881
882 unittest.group("obj-schema-DeviceClaim", () {
883 unittest.test("to-json--from-json", () {
884 var o = buildDeviceClaim();
885 var od = new api.DeviceClaim.fromJson(o.toJson());
886 checkDeviceClaim(od);
887 });
888 });
889
890
891 unittest.group("obj-schema-DeviceIdentifier", () {
892 unittest.test("to-json--from-json", () {
893 var o = buildDeviceIdentifier();
894 var od = new api.DeviceIdentifier.fromJson(o.toJson());
895 checkDeviceIdentifier(od);
896 });
897 });
898
899
900 unittest.group("obj-schema-DeviceMetadata", () {
901 unittest.test("to-json--from-json", () {
902 var o = buildDeviceMetadata();
903 var od = new api.DeviceMetadata.fromJson(o.toJson());
904 checkDeviceMetadata(od);
905 });
906 });
907
908
909 unittest.group("obj-schema-DevicesLongRunningOperationMetadata", () {
910 unittest.test("to-json--from-json", () {
911 var o = buildDevicesLongRunningOperationMetadata();
912 var od = new api.DevicesLongRunningOperationMetadata.fromJson(o.toJson());
913 checkDevicesLongRunningOperationMetadata(od);
914 });
915 });
916
917
918 unittest.group("obj-schema-DevicesLongRunningOperationResponse", () {
919 unittest.test("to-json--from-json", () {
920 var o = buildDevicesLongRunningOperationResponse();
921 var od = new api.DevicesLongRunningOperationResponse.fromJson(o.toJson());
922 checkDevicesLongRunningOperationResponse(od);
923 });
924 });
925
926
927 unittest.group("obj-schema-Empty", () {
928 unittest.test("to-json--from-json", () {
929 var o = buildEmpty();
930 var od = new api.Empty.fromJson(o.toJson());
931 checkEmpty(od);
932 });
933 });
934
935
936 unittest.group("obj-schema-FindDevicesByDeviceIdentifierRequest", () {
937 unittest.test("to-json--from-json", () {
938 var o = buildFindDevicesByDeviceIdentifierRequest();
939 var od = new api.FindDevicesByDeviceIdentifierRequest.fromJson(o.toJson()) ;
940 checkFindDevicesByDeviceIdentifierRequest(od);
941 });
942 });
943
944
945 unittest.group("obj-schema-FindDevicesByDeviceIdentifierResponse", () {
946 unittest.test("to-json--from-json", () {
947 var o = buildFindDevicesByDeviceIdentifierResponse();
948 var od = new api.FindDevicesByDeviceIdentifierResponse.fromJson(o.toJson() );
949 checkFindDevicesByDeviceIdentifierResponse(od);
950 });
951 });
952
953
954 unittest.group("obj-schema-FindDevicesByOwnerRequest", () {
955 unittest.test("to-json--from-json", () {
956 var o = buildFindDevicesByOwnerRequest();
957 var od = new api.FindDevicesByOwnerRequest.fromJson(o.toJson());
958 checkFindDevicesByOwnerRequest(od);
959 });
960 });
961
962
963 unittest.group("obj-schema-FindDevicesByOwnerResponse", () {
964 unittest.test("to-json--from-json", () {
965 var o = buildFindDevicesByOwnerResponse();
966 var od = new api.FindDevicesByOwnerResponse.fromJson(o.toJson());
967 checkFindDevicesByOwnerResponse(od);
968 });
969 });
970
971
972 unittest.group("obj-schema-ListCustomersResponse", () {
973 unittest.test("to-json--from-json", () {
974 var o = buildListCustomersResponse();
975 var od = new api.ListCustomersResponse.fromJson(o.toJson());
976 checkListCustomersResponse(od);
977 });
978 });
979
980
981 unittest.group("obj-schema-Operation", () {
982 unittest.test("to-json--from-json", () {
983 var o = buildOperation();
984 var od = new api.Operation.fromJson(o.toJson());
985 checkOperation(od);
986 });
987 });
988
989
990 unittest.group("obj-schema-OperationPerDevice", () {
991 unittest.test("to-json--from-json", () {
992 var o = buildOperationPerDevice();
993 var od = new api.OperationPerDevice.fromJson(o.toJson());
994 checkOperationPerDevice(od);
995 });
996 });
997
998
999 unittest.group("obj-schema-PartnerClaim", () {
1000 unittest.test("to-json--from-json", () {
1001 var o = buildPartnerClaim();
1002 var od = new api.PartnerClaim.fromJson(o.toJson());
1003 checkPartnerClaim(od);
1004 });
1005 });
1006
1007
1008 unittest.group("obj-schema-PartnerUnclaim", () {
1009 unittest.test("to-json--from-json", () {
1010 var o = buildPartnerUnclaim();
1011 var od = new api.PartnerUnclaim.fromJson(o.toJson());
1012 checkPartnerUnclaim(od);
1013 });
1014 });
1015
1016
1017 unittest.group("obj-schema-PerDeviceStatusInBatch", () {
1018 unittest.test("to-json--from-json", () {
1019 var o = buildPerDeviceStatusInBatch();
1020 var od = new api.PerDeviceStatusInBatch.fromJson(o.toJson());
1021 checkPerDeviceStatusInBatch(od);
1022 });
1023 });
1024
1025
1026 unittest.group("obj-schema-Status", () {
1027 unittest.test("to-json--from-json", () {
1028 var o = buildStatus();
1029 var od = new api.Status.fromJson(o.toJson());
1030 checkStatus(od);
1031 });
1032 });
1033
1034
1035 unittest.group("obj-schema-UnclaimDeviceRequest", () {
1036 unittest.test("to-json--from-json", () {
1037 var o = buildUnclaimDeviceRequest();
1038 var od = new api.UnclaimDeviceRequest.fromJson(o.toJson());
1039 checkUnclaimDeviceRequest(od);
1040 });
1041 });
1042
1043
1044 unittest.group("obj-schema-UnclaimDevicesRequest", () {
1045 unittest.test("to-json--from-json", () {
1046 var o = buildUnclaimDevicesRequest();
1047 var od = new api.UnclaimDevicesRequest.fromJson(o.toJson());
1048 checkUnclaimDevicesRequest(od);
1049 });
1050 });
1051
1052
1053 unittest.group("obj-schema-UpdateDeviceMetadataInBatchRequest", () {
1054 unittest.test("to-json--from-json", () {
1055 var o = buildUpdateDeviceMetadataInBatchRequest();
1056 var od = new api.UpdateDeviceMetadataInBatchRequest.fromJson(o.toJson());
1057 checkUpdateDeviceMetadataInBatchRequest(od);
1058 });
1059 });
1060
1061
1062 unittest.group("obj-schema-UpdateDeviceMetadataRequest", () {
1063 unittest.test("to-json--from-json", () {
1064 var o = buildUpdateDeviceMetadataRequest();
1065 var od = new api.UpdateDeviceMetadataRequest.fromJson(o.toJson());
1066 checkUpdateDeviceMetadataRequest(od);
1067 });
1068 });
1069
1070
1071 unittest.group("obj-schema-UpdateMetadataArguments", () {
1072 unittest.test("to-json--from-json", () {
1073 var o = buildUpdateMetadataArguments();
1074 var od = new api.UpdateMetadataArguments.fromJson(o.toJson());
1075 checkUpdateMetadataArguments(od);
1076 });
1077 });
1078
1079
1080 unittest.group("resource-OperationsResourceApi", () {
1081 unittest.test("method--get", () {
1082
1083 var mock = new HttpServerMock();
1084 api.OperationsResourceApi res = new api.AndroiddeviceprovisioningApi(mock) .operations;
1085 var arg_name = "foo";
1086 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1087 var path = (req.url).path;
1088 var pathOffset = 0;
1089 var index;
1090 var subPart;
1091 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1092 pathOffset += 1;
1093 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
1094 pathOffset += 3;
1095 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1096
1097 var query = (req.url).query;
1098 var queryOffset = 0;
1099 var queryMap = {};
1100 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1101 parseBool(n) {
1102 if (n == "true") return true;
1103 if (n == "false") return false;
1104 if (n == null) return null;
1105 throw new core.ArgumentError("Invalid boolean: $n");
1106 }
1107 if (query.length > 0) {
1108 for (var part in query.split("&")) {
1109 var keyvalue = part.split("=");
1110 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1111 }
1112 }
1113
1114
1115 var h = {
1116 "content-type" : "application/json; charset=utf-8",
1117 };
1118 var resp = convert.JSON.encode(buildOperation());
1119 return new async.Future.value(stringResponse(200, h, resp));
1120 }), true);
1121 res.get(arg_name).then(unittest.expectAsync1(((api.Operation response) {
1122 checkOperation(response);
1123 })));
1124 });
1125
1126 });
1127
1128
1129 unittest.group("resource-PartnersCustomersResourceApi", () {
1130 unittest.test("method--list", () {
1131
1132 var mock = new HttpServerMock();
1133 api.PartnersCustomersResourceApi res = new api.AndroiddeviceprovisioningAp i(mock).partners.customers;
1134 var arg_partnerId = "foo";
1135 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1136 var path = (req.url).path;
1137 var pathOffset = 0;
1138 var index;
1139 var subPart;
1140 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1141 pathOffset += 1;
1142 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1143 pathOffset += 12;
1144 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1145
1146 var query = (req.url).query;
1147 var queryOffset = 0;
1148 var queryMap = {};
1149 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1150 parseBool(n) {
1151 if (n == "true") return true;
1152 if (n == "false") return false;
1153 if (n == null) return null;
1154 throw new core.ArgumentError("Invalid boolean: $n");
1155 }
1156 if (query.length > 0) {
1157 for (var part in query.split("&")) {
1158 var keyvalue = part.split("=");
1159 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1160 }
1161 }
1162
1163
1164 var h = {
1165 "content-type" : "application/json; charset=utf-8",
1166 };
1167 var resp = convert.JSON.encode(buildListCustomersResponse());
1168 return new async.Future.value(stringResponse(200, h, resp));
1169 }), true);
1170 res.list(arg_partnerId).then(unittest.expectAsync1(((api.ListCustomersResp onse response) {
1171 checkListCustomersResponse(response);
1172 })));
1173 });
1174
1175 });
1176
1177
1178 unittest.group("resource-PartnersDevicesResourceApi", () {
1179 unittest.test("method--claim", () {
1180
1181 var mock = new HttpServerMock();
1182 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1183 var arg_request = buildClaimDeviceRequest();
1184 var arg_partnerId = "foo";
1185 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1186 var obj = new api.ClaimDeviceRequest.fromJson(json);
1187 checkClaimDeviceRequest(obj);
1188
1189 var path = (req.url).path;
1190 var pathOffset = 0;
1191 var index;
1192 var subPart;
1193 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1194 pathOffset += 1;
1195 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1196 pathOffset += 12;
1197 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1198
1199 var query = (req.url).query;
1200 var queryOffset = 0;
1201 var queryMap = {};
1202 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1203 parseBool(n) {
1204 if (n == "true") return true;
1205 if (n == "false") return false;
1206 if (n == null) return null;
1207 throw new core.ArgumentError("Invalid boolean: $n");
1208 }
1209 if (query.length > 0) {
1210 for (var part in query.split("&")) {
1211 var keyvalue = part.split("=");
1212 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1213 }
1214 }
1215
1216
1217 var h = {
1218 "content-type" : "application/json; charset=utf-8",
1219 };
1220 var resp = convert.JSON.encode(buildClaimDeviceResponse());
1221 return new async.Future.value(stringResponse(200, h, resp));
1222 }), true);
1223 res.claim(arg_request, arg_partnerId).then(unittest.expectAsync1(((api.Cla imDeviceResponse response) {
1224 checkClaimDeviceResponse(response);
1225 })));
1226 });
1227
1228 unittest.test("method--claimAsync", () {
1229
1230 var mock = new HttpServerMock();
1231 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1232 var arg_request = buildClaimDevicesRequest();
1233 var arg_partnerId = "foo";
1234 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1235 var obj = new api.ClaimDevicesRequest.fromJson(json);
1236 checkClaimDevicesRequest(obj);
1237
1238 var path = (req.url).path;
1239 var pathOffset = 0;
1240 var index;
1241 var subPart;
1242 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1243 pathOffset += 1;
1244 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1245 pathOffset += 12;
1246 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1247
1248 var query = (req.url).query;
1249 var queryOffset = 0;
1250 var queryMap = {};
1251 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1252 parseBool(n) {
1253 if (n == "true") return true;
1254 if (n == "false") return false;
1255 if (n == null) return null;
1256 throw new core.ArgumentError("Invalid boolean: $n");
1257 }
1258 if (query.length > 0) {
1259 for (var part in query.split("&")) {
1260 var keyvalue = part.split("=");
1261 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1262 }
1263 }
1264
1265
1266 var h = {
1267 "content-type" : "application/json; charset=utf-8",
1268 };
1269 var resp = convert.JSON.encode(buildOperation());
1270 return new async.Future.value(stringResponse(200, h, resp));
1271 }), true);
1272 res.claimAsync(arg_request, arg_partnerId).then(unittest.expectAsync1(((ap i.Operation response) {
1273 checkOperation(response);
1274 })));
1275 });
1276
1277 unittest.test("method--findByIdentifier", () {
1278
1279 var mock = new HttpServerMock();
1280 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1281 var arg_request = buildFindDevicesByDeviceIdentifierRequest();
1282 var arg_partnerId = "foo";
1283 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1284 var obj = new api.FindDevicesByDeviceIdentifierRequest.fromJson(json);
1285 checkFindDevicesByDeviceIdentifierRequest(obj);
1286
1287 var path = (req.url).path;
1288 var pathOffset = 0;
1289 var index;
1290 var subPart;
1291 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1292 pathOffset += 1;
1293 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1294 pathOffset += 12;
1295 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1296
1297 var query = (req.url).query;
1298 var queryOffset = 0;
1299 var queryMap = {};
1300 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1301 parseBool(n) {
1302 if (n == "true") return true;
1303 if (n == "false") return false;
1304 if (n == null) return null;
1305 throw new core.ArgumentError("Invalid boolean: $n");
1306 }
1307 if (query.length > 0) {
1308 for (var part in query.split("&")) {
1309 var keyvalue = part.split("=");
1310 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1311 }
1312 }
1313
1314
1315 var h = {
1316 "content-type" : "application/json; charset=utf-8",
1317 };
1318 var resp = convert.JSON.encode(buildFindDevicesByDeviceIdentifierRespons e());
1319 return new async.Future.value(stringResponse(200, h, resp));
1320 }), true);
1321 res.findByIdentifier(arg_request, arg_partnerId).then(unittest.expectAsync 1(((api.FindDevicesByDeviceIdentifierResponse response) {
1322 checkFindDevicesByDeviceIdentifierResponse(response);
1323 })));
1324 });
1325
1326 unittest.test("method--findByOwner", () {
1327
1328 var mock = new HttpServerMock();
1329 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1330 var arg_request = buildFindDevicesByOwnerRequest();
1331 var arg_partnerId = "foo";
1332 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1333 var obj = new api.FindDevicesByOwnerRequest.fromJson(json);
1334 checkFindDevicesByOwnerRequest(obj);
1335
1336 var path = (req.url).path;
1337 var pathOffset = 0;
1338 var index;
1339 var subPart;
1340 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1341 pathOffset += 1;
1342 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1343 pathOffset += 12;
1344 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1345
1346 var query = (req.url).query;
1347 var queryOffset = 0;
1348 var queryMap = {};
1349 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1350 parseBool(n) {
1351 if (n == "true") return true;
1352 if (n == "false") return false;
1353 if (n == null) return null;
1354 throw new core.ArgumentError("Invalid boolean: $n");
1355 }
1356 if (query.length > 0) {
1357 for (var part in query.split("&")) {
1358 var keyvalue = part.split("=");
1359 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1360 }
1361 }
1362
1363
1364 var h = {
1365 "content-type" : "application/json; charset=utf-8",
1366 };
1367 var resp = convert.JSON.encode(buildFindDevicesByOwnerResponse());
1368 return new async.Future.value(stringResponse(200, h, resp));
1369 }), true);
1370 res.findByOwner(arg_request, arg_partnerId).then(unittest.expectAsync1(((a pi.FindDevicesByOwnerResponse response) {
1371 checkFindDevicesByOwnerResponse(response);
1372 })));
1373 });
1374
1375 unittest.test("method--get", () {
1376
1377 var mock = new HttpServerMock();
1378 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1379 var arg_name = "foo";
1380 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1381 var path = (req.url).path;
1382 var pathOffset = 0;
1383 var index;
1384 var subPart;
1385 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1386 pathOffset += 1;
1387 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
1388 pathOffset += 3;
1389 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1390
1391 var query = (req.url).query;
1392 var queryOffset = 0;
1393 var queryMap = {};
1394 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1395 parseBool(n) {
1396 if (n == "true") return true;
1397 if (n == "false") return false;
1398 if (n == null) return null;
1399 throw new core.ArgumentError("Invalid boolean: $n");
1400 }
1401 if (query.length > 0) {
1402 for (var part in query.split("&")) {
1403 var keyvalue = part.split("=");
1404 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1405 }
1406 }
1407
1408
1409 var h = {
1410 "content-type" : "application/json; charset=utf-8",
1411 };
1412 var resp = convert.JSON.encode(buildDevice());
1413 return new async.Future.value(stringResponse(200, h, resp));
1414 }), true);
1415 res.get(arg_name).then(unittest.expectAsync1(((api.Device response) {
1416 checkDevice(response);
1417 })));
1418 });
1419
1420 unittest.test("method--metadata", () {
1421
1422 var mock = new HttpServerMock();
1423 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1424 var arg_request = buildUpdateDeviceMetadataRequest();
1425 var arg_metadataOwnerId = "foo";
1426 var arg_deviceId = "foo";
1427 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1428 var obj = new api.UpdateDeviceMetadataRequest.fromJson(json);
1429 checkUpdateDeviceMetadataRequest(obj);
1430
1431 var path = (req.url).path;
1432 var pathOffset = 0;
1433 var index;
1434 var subPart;
1435 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1436 pathOffset += 1;
1437 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1438 pathOffset += 12;
1439 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1440
1441 var query = (req.url).query;
1442 var queryOffset = 0;
1443 var queryMap = {};
1444 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1445 parseBool(n) {
1446 if (n == "true") return true;
1447 if (n == "false") return false;
1448 if (n == null) return null;
1449 throw new core.ArgumentError("Invalid boolean: $n");
1450 }
1451 if (query.length > 0) {
1452 for (var part in query.split("&")) {
1453 var keyvalue = part.split("=");
1454 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1455 }
1456 }
1457
1458
1459 var h = {
1460 "content-type" : "application/json; charset=utf-8",
1461 };
1462 var resp = convert.JSON.encode(buildDeviceMetadata());
1463 return new async.Future.value(stringResponse(200, h, resp));
1464 }), true);
1465 res.metadata(arg_request, arg_metadataOwnerId, arg_deviceId).then(unittest .expectAsync1(((api.DeviceMetadata response) {
1466 checkDeviceMetadata(response);
1467 })));
1468 });
1469
1470 unittest.test("method--unclaim", () {
1471
1472 var mock = new HttpServerMock();
1473 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1474 var arg_request = buildUnclaimDeviceRequest();
1475 var arg_partnerId = "foo";
1476 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1477 var obj = new api.UnclaimDeviceRequest.fromJson(json);
1478 checkUnclaimDeviceRequest(obj);
1479
1480 var path = (req.url).path;
1481 var pathOffset = 0;
1482 var index;
1483 var subPart;
1484 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1485 pathOffset += 1;
1486 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1487 pathOffset += 12;
1488 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1489
1490 var query = (req.url).query;
1491 var queryOffset = 0;
1492 var queryMap = {};
1493 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1494 parseBool(n) {
1495 if (n == "true") return true;
1496 if (n == "false") return false;
1497 if (n == null) return null;
1498 throw new core.ArgumentError("Invalid boolean: $n");
1499 }
1500 if (query.length > 0) {
1501 for (var part in query.split("&")) {
1502 var keyvalue = part.split("=");
1503 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1504 }
1505 }
1506
1507
1508 var h = {
1509 "content-type" : "application/json; charset=utf-8",
1510 };
1511 var resp = convert.JSON.encode(buildEmpty());
1512 return new async.Future.value(stringResponse(200, h, resp));
1513 }), true);
1514 res.unclaim(arg_request, arg_partnerId).then(unittest.expectAsync1(((api.E mpty response) {
1515 checkEmpty(response);
1516 })));
1517 });
1518
1519 unittest.test("method--unclaimAsync", () {
1520
1521 var mock = new HttpServerMock();
1522 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1523 var arg_request = buildUnclaimDevicesRequest();
1524 var arg_partnerId = "foo";
1525 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1526 var obj = new api.UnclaimDevicesRequest.fromJson(json);
1527 checkUnclaimDevicesRequest(obj);
1528
1529 var path = (req.url).path;
1530 var pathOffset = 0;
1531 var index;
1532 var subPart;
1533 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1534 pathOffset += 1;
1535 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1536 pathOffset += 12;
1537 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1538
1539 var query = (req.url).query;
1540 var queryOffset = 0;
1541 var queryMap = {};
1542 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1543 parseBool(n) {
1544 if (n == "true") return true;
1545 if (n == "false") return false;
1546 if (n == null) return null;
1547 throw new core.ArgumentError("Invalid boolean: $n");
1548 }
1549 if (query.length > 0) {
1550 for (var part in query.split("&")) {
1551 var keyvalue = part.split("=");
1552 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1553 }
1554 }
1555
1556
1557 var h = {
1558 "content-type" : "application/json; charset=utf-8",
1559 };
1560 var resp = convert.JSON.encode(buildOperation());
1561 return new async.Future.value(stringResponse(200, h, resp));
1562 }), true);
1563 res.unclaimAsync(arg_request, arg_partnerId).then(unittest.expectAsync1((( api.Operation response) {
1564 checkOperation(response);
1565 })));
1566 });
1567
1568 unittest.test("method--updateMetadataAsync", () {
1569
1570 var mock = new HttpServerMock();
1571 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi( mock).partners.devices;
1572 var arg_request = buildUpdateDeviceMetadataInBatchRequest();
1573 var arg_partnerId = "foo";
1574 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1575 var obj = new api.UpdateDeviceMetadataInBatchRequest.fromJson(json);
1576 checkUpdateDeviceMetadataInBatchRequest(obj);
1577
1578 var path = (req.url).path;
1579 var pathOffset = 0;
1580 var index;
1581 var subPart;
1582 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
1583 pathOffset += 1;
1584 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq uals("v1/partners/"));
1585 pathOffset += 12;
1586 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1587
1588 var query = (req.url).query;
1589 var queryOffset = 0;
1590 var queryMap = {};
1591 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1592 parseBool(n) {
1593 if (n == "true") return true;
1594 if (n == "false") return false;
1595 if (n == null) return null;
1596 throw new core.ArgumentError("Invalid boolean: $n");
1597 }
1598 if (query.length > 0) {
1599 for (var part in query.split("&")) {
1600 var keyvalue = part.split("=");
1601 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
1602 }
1603 }
1604
1605
1606 var h = {
1607 "content-type" : "application/json; charset=utf-8",
1608 };
1609 var resp = convert.JSON.encode(buildOperation());
1610 return new async.Future.value(stringResponse(200, h, resp));
1611 }), true);
1612 res.updateMetadataAsync(arg_request, arg_partnerId).then(unittest.expectAs ync1(((api.Operation response) {
1613 checkOperation(response);
1614 })));
1615 });
1616
1617 });
1618
1619
1620 }
1621
OLDNEW
« no previous file with comments | « generated/googleapis/test/analyticsreporting/v4_test.dart ('k') | generated/googleapis/test/androidenterprise/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698