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

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

Issue 3003493002: Api-Roll 53: 2017-08-21 (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
1 library googleapis.cloudbilling.v1.test; 1 library googleapis.cloudbilling.v1.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing; 9 import 'package:http/testing.dart' as http_testing;
10 import 'package:test/test.dart' as unittest; 10 import 'package:test/test.dart' as unittest;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 } 45 }
46 } 46 }
47 47
48 http.StreamedResponse stringResponse( 48 http.StreamedResponse stringResponse(
49 core.int status, core.Map<core.String, core.String> headers, core.String bod y) { 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)]); 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers); 51 return new http.StreamedResponse(stream, status, headers: headers);
52 } 52 }
53 53
54 core.int buildCounterAggregationInfo = 0;
55 buildAggregationInfo() {
56 var o = new api.AggregationInfo();
57 buildCounterAggregationInfo++;
58 if (buildCounterAggregationInfo < 3) {
59 o.aggregationCount = 42;
60 o.aggregationInterval = "foo";
61 o.aggregationLevel = "foo";
62 }
63 buildCounterAggregationInfo--;
64 return o;
65 }
66
67 checkAggregationInfo(api.AggregationInfo o) {
68 buildCounterAggregationInfo++;
69 if (buildCounterAggregationInfo < 3) {
70 unittest.expect(o.aggregationCount, unittest.equals(42));
71 unittest.expect(o.aggregationInterval, unittest.equals('foo'));
72 unittest.expect(o.aggregationLevel, unittest.equals('foo'));
73 }
74 buildCounterAggregationInfo--;
75 }
76
54 core.int buildCounterBillingAccount = 0; 77 core.int buildCounterBillingAccount = 0;
55 buildBillingAccount() { 78 buildBillingAccount() {
56 var o = new api.BillingAccount(); 79 var o = new api.BillingAccount();
57 buildCounterBillingAccount++; 80 buildCounterBillingAccount++;
58 if (buildCounterBillingAccount < 3) { 81 if (buildCounterBillingAccount < 3) {
59 o.displayName = "foo"; 82 o.displayName = "foo";
60 o.name = "foo"; 83 o.name = "foo";
61 o.open = true; 84 o.open = true;
62 } 85 }
63 buildCounterBillingAccount--; 86 buildCounterBillingAccount--;
64 return o; 87 return o;
65 } 88 }
66 89
67 checkBillingAccount(api.BillingAccount o) { 90 checkBillingAccount(api.BillingAccount o) {
68 buildCounterBillingAccount++; 91 buildCounterBillingAccount++;
69 if (buildCounterBillingAccount < 3) { 92 if (buildCounterBillingAccount < 3) {
70 unittest.expect(o.displayName, unittest.equals('foo')); 93 unittest.expect(o.displayName, unittest.equals('foo'));
71 unittest.expect(o.name, unittest.equals('foo')); 94 unittest.expect(o.name, unittest.equals('foo'));
72 unittest.expect(o.open, unittest.isTrue); 95 unittest.expect(o.open, unittest.isTrue);
73 } 96 }
74 buildCounterBillingAccount--; 97 buildCounterBillingAccount--;
75 } 98 }
76 99
100 core.int buildCounterCategory = 0;
101 buildCategory() {
102 var o = new api.Category();
103 buildCounterCategory++;
104 if (buildCounterCategory < 3) {
105 o.resourceFamily = "foo";
106 o.resourceGroup = "foo";
107 o.serviceDisplayName = "foo";
108 o.usageType = "foo";
109 }
110 buildCounterCategory--;
111 return o;
112 }
113
114 checkCategory(api.Category o) {
115 buildCounterCategory++;
116 if (buildCounterCategory < 3) {
117 unittest.expect(o.resourceFamily, unittest.equals('foo'));
118 unittest.expect(o.resourceGroup, unittest.equals('foo'));
119 unittest.expect(o.serviceDisplayName, unittest.equals('foo'));
120 unittest.expect(o.usageType, unittest.equals('foo'));
121 }
122 buildCounterCategory--;
123 }
124
77 buildUnnamed68() { 125 buildUnnamed68() {
78 var o = new core.List<api.BillingAccount>(); 126 var o = new core.List<api.BillingAccount>();
79 o.add(buildBillingAccount()); 127 o.add(buildBillingAccount());
80 o.add(buildBillingAccount()); 128 o.add(buildBillingAccount());
81 return o; 129 return o;
82 } 130 }
83 131
84 checkUnnamed68(core.List<api.BillingAccount> o) { 132 checkUnnamed68(core.List<api.BillingAccount> o) {
85 unittest.expect(o, unittest.hasLength(2)); 133 unittest.expect(o, unittest.hasLength(2));
86 checkBillingAccount(o[0]); 134 checkBillingAccount(o[0]);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 183
136 checkListProjectBillingInfoResponse(api.ListProjectBillingInfoResponse o) { 184 checkListProjectBillingInfoResponse(api.ListProjectBillingInfoResponse o) {
137 buildCounterListProjectBillingInfoResponse++; 185 buildCounterListProjectBillingInfoResponse++;
138 if (buildCounterListProjectBillingInfoResponse < 3) { 186 if (buildCounterListProjectBillingInfoResponse < 3) {
139 unittest.expect(o.nextPageToken, unittest.equals('foo')); 187 unittest.expect(o.nextPageToken, unittest.equals('foo'));
140 checkUnnamed69(o.projectBillingInfo); 188 checkUnnamed69(o.projectBillingInfo);
141 } 189 }
142 buildCounterListProjectBillingInfoResponse--; 190 buildCounterListProjectBillingInfoResponse--;
143 } 191 }
144 192
193 buildUnnamed70() {
194 var o = new core.List<api.Service>();
195 o.add(buildService());
196 o.add(buildService());
197 return o;
198 }
199
200 checkUnnamed70(core.List<api.Service> o) {
201 unittest.expect(o, unittest.hasLength(2));
202 checkService(o[0]);
203 checkService(o[1]);
204 }
205
206 core.int buildCounterListServicesResponse = 0;
207 buildListServicesResponse() {
208 var o = new api.ListServicesResponse();
209 buildCounterListServicesResponse++;
210 if (buildCounterListServicesResponse < 3) {
211 o.nextPageToken = "foo";
212 o.services = buildUnnamed70();
213 }
214 buildCounterListServicesResponse--;
215 return o;
216 }
217
218 checkListServicesResponse(api.ListServicesResponse o) {
219 buildCounterListServicesResponse++;
220 if (buildCounterListServicesResponse < 3) {
221 unittest.expect(o.nextPageToken, unittest.equals('foo'));
222 checkUnnamed70(o.services);
223 }
224 buildCounterListServicesResponse--;
225 }
226
227 buildUnnamed71() {
228 var o = new core.List<api.Sku>();
229 o.add(buildSku());
230 o.add(buildSku());
231 return o;
232 }
233
234 checkUnnamed71(core.List<api.Sku> o) {
235 unittest.expect(o, unittest.hasLength(2));
236 checkSku(o[0]);
237 checkSku(o[1]);
238 }
239
240 core.int buildCounterListSkusResponse = 0;
241 buildListSkusResponse() {
242 var o = new api.ListSkusResponse();
243 buildCounterListSkusResponse++;
244 if (buildCounterListSkusResponse < 3) {
245 o.nextPageToken = "foo";
246 o.skus = buildUnnamed71();
247 }
248 buildCounterListSkusResponse--;
249 return o;
250 }
251
252 checkListSkusResponse(api.ListSkusResponse o) {
253 buildCounterListSkusResponse++;
254 if (buildCounterListSkusResponse < 3) {
255 unittest.expect(o.nextPageToken, unittest.equals('foo'));
256 checkUnnamed71(o.skus);
257 }
258 buildCounterListSkusResponse--;
259 }
260
261 core.int buildCounterMoney = 0;
262 buildMoney() {
263 var o = new api.Money();
264 buildCounterMoney++;
265 if (buildCounterMoney < 3) {
266 o.currencyCode = "foo";
267 o.nanos = 42;
268 o.units = "foo";
269 }
270 buildCounterMoney--;
271 return o;
272 }
273
274 checkMoney(api.Money o) {
275 buildCounterMoney++;
276 if (buildCounterMoney < 3) {
277 unittest.expect(o.currencyCode, unittest.equals('foo'));
278 unittest.expect(o.nanos, unittest.equals(42));
279 unittest.expect(o.units, unittest.equals('foo'));
280 }
281 buildCounterMoney--;
282 }
283
284 buildUnnamed72() {
285 var o = new core.List<api.TierRate>();
286 o.add(buildTierRate());
287 o.add(buildTierRate());
288 return o;
289 }
290
291 checkUnnamed72(core.List<api.TierRate> o) {
292 unittest.expect(o, unittest.hasLength(2));
293 checkTierRate(o[0]);
294 checkTierRate(o[1]);
295 }
296
297 core.int buildCounterPricingExpression = 0;
298 buildPricingExpression() {
299 var o = new api.PricingExpression();
300 buildCounterPricingExpression++;
301 if (buildCounterPricingExpression < 3) {
302 o.baseUnit = "foo";
303 o.baseUnitConversionFactor = 42.0;
304 o.baseUnitDescription = "foo";
305 o.displayQuantity = 42.0;
306 o.tieredRates = buildUnnamed72();
307 o.usageUnit = "foo";
308 o.usageUnitDescription = "foo";
309 }
310 buildCounterPricingExpression--;
311 return o;
312 }
313
314 checkPricingExpression(api.PricingExpression o) {
315 buildCounterPricingExpression++;
316 if (buildCounterPricingExpression < 3) {
317 unittest.expect(o.baseUnit, unittest.equals('foo'));
318 unittest.expect(o.baseUnitConversionFactor, unittest.equals(42.0));
319 unittest.expect(o.baseUnitDescription, unittest.equals('foo'));
320 unittest.expect(o.displayQuantity, unittest.equals(42.0));
321 checkUnnamed72(o.tieredRates);
322 unittest.expect(o.usageUnit, unittest.equals('foo'));
323 unittest.expect(o.usageUnitDescription, unittest.equals('foo'));
324 }
325 buildCounterPricingExpression--;
326 }
327
328 core.int buildCounterPricingInfo = 0;
329 buildPricingInfo() {
330 var o = new api.PricingInfo();
331 buildCounterPricingInfo++;
332 if (buildCounterPricingInfo < 3) {
333 o.aggregationInfo = buildAggregationInfo();
334 o.currencyConversionRate = 42.0;
335 o.effectiveTime = "foo";
336 o.pricingExpression = buildPricingExpression();
337 o.summary = "foo";
338 }
339 buildCounterPricingInfo--;
340 return o;
341 }
342
343 checkPricingInfo(api.PricingInfo o) {
344 buildCounterPricingInfo++;
345 if (buildCounterPricingInfo < 3) {
346 checkAggregationInfo(o.aggregationInfo);
347 unittest.expect(o.currencyConversionRate, unittest.equals(42.0));
348 unittest.expect(o.effectiveTime, unittest.equals('foo'));
349 checkPricingExpression(o.pricingExpression);
350 unittest.expect(o.summary, unittest.equals('foo'));
351 }
352 buildCounterPricingInfo--;
353 }
354
145 core.int buildCounterProjectBillingInfo = 0; 355 core.int buildCounterProjectBillingInfo = 0;
146 buildProjectBillingInfo() { 356 buildProjectBillingInfo() {
147 var o = new api.ProjectBillingInfo(); 357 var o = new api.ProjectBillingInfo();
148 buildCounterProjectBillingInfo++; 358 buildCounterProjectBillingInfo++;
149 if (buildCounterProjectBillingInfo < 3) { 359 if (buildCounterProjectBillingInfo < 3) {
150 o.billingAccountName = "foo"; 360 o.billingAccountName = "foo";
151 o.billingEnabled = true; 361 o.billingEnabled = true;
152 o.name = "foo"; 362 o.name = "foo";
153 o.projectId = "foo"; 363 o.projectId = "foo";
154 } 364 }
155 buildCounterProjectBillingInfo--; 365 buildCounterProjectBillingInfo--;
156 return o; 366 return o;
157 } 367 }
158 368
159 checkProjectBillingInfo(api.ProjectBillingInfo o) { 369 checkProjectBillingInfo(api.ProjectBillingInfo o) {
160 buildCounterProjectBillingInfo++; 370 buildCounterProjectBillingInfo++;
161 if (buildCounterProjectBillingInfo < 3) { 371 if (buildCounterProjectBillingInfo < 3) {
162 unittest.expect(o.billingAccountName, unittest.equals('foo')); 372 unittest.expect(o.billingAccountName, unittest.equals('foo'));
163 unittest.expect(o.billingEnabled, unittest.isTrue); 373 unittest.expect(o.billingEnabled, unittest.isTrue);
164 unittest.expect(o.name, unittest.equals('foo')); 374 unittest.expect(o.name, unittest.equals('foo'));
165 unittest.expect(o.projectId, unittest.equals('foo')); 375 unittest.expect(o.projectId, unittest.equals('foo'));
166 } 376 }
167 buildCounterProjectBillingInfo--; 377 buildCounterProjectBillingInfo--;
168 } 378 }
169 379
380 core.int buildCounterService = 0;
381 buildService() {
382 var o = new api.Service();
383 buildCounterService++;
384 if (buildCounterService < 3) {
385 o.displayName = "foo";
386 o.name = "foo";
387 o.serviceId = "foo";
388 }
389 buildCounterService--;
390 return o;
391 }
392
393 checkService(api.Service o) {
394 buildCounterService++;
395 if (buildCounterService < 3) {
396 unittest.expect(o.displayName, unittest.equals('foo'));
397 unittest.expect(o.name, unittest.equals('foo'));
398 unittest.expect(o.serviceId, unittest.equals('foo'));
399 }
400 buildCounterService--;
401 }
402
403 buildUnnamed73() {
404 var o = new core.List<api.PricingInfo>();
405 o.add(buildPricingInfo());
406 o.add(buildPricingInfo());
407 return o;
408 }
409
410 checkUnnamed73(core.List<api.PricingInfo> o) {
411 unittest.expect(o, unittest.hasLength(2));
412 checkPricingInfo(o[0]);
413 checkPricingInfo(o[1]);
414 }
415
416 buildUnnamed74() {
417 var o = new core.List<core.String>();
418 o.add("foo");
419 o.add("foo");
420 return o;
421 }
422
423 checkUnnamed74(core.List<core.String> o) {
424 unittest.expect(o, unittest.hasLength(2));
425 unittest.expect(o[0], unittest.equals('foo'));
426 unittest.expect(o[1], unittest.equals('foo'));
427 }
428
429 core.int buildCounterSku = 0;
430 buildSku() {
431 var o = new api.Sku();
432 buildCounterSku++;
433 if (buildCounterSku < 3) {
434 o.category = buildCategory();
435 o.description = "foo";
436 o.name = "foo";
437 o.pricingInfo = buildUnnamed73();
438 o.serviceProviderName = "foo";
439 o.serviceRegions = buildUnnamed74();
440 o.skuId = "foo";
441 }
442 buildCounterSku--;
443 return o;
444 }
445
446 checkSku(api.Sku o) {
447 buildCounterSku++;
448 if (buildCounterSku < 3) {
449 checkCategory(o.category);
450 unittest.expect(o.description, unittest.equals('foo'));
451 unittest.expect(o.name, unittest.equals('foo'));
452 checkUnnamed73(o.pricingInfo);
453 unittest.expect(o.serviceProviderName, unittest.equals('foo'));
454 checkUnnamed74(o.serviceRegions);
455 unittest.expect(o.skuId, unittest.equals('foo'));
456 }
457 buildCounterSku--;
458 }
459
460 core.int buildCounterTierRate = 0;
461 buildTierRate() {
462 var o = new api.TierRate();
463 buildCounterTierRate++;
464 if (buildCounterTierRate < 3) {
465 o.startUsageAmount = 42.0;
466 o.unitPrice = buildMoney();
467 }
468 buildCounterTierRate--;
469 return o;
470 }
471
472 checkTierRate(api.TierRate o) {
473 buildCounterTierRate++;
474 if (buildCounterTierRate < 3) {
475 unittest.expect(o.startUsageAmount, unittest.equals(42.0));
476 checkMoney(o.unitPrice);
477 }
478 buildCounterTierRate--;
479 }
480
170 481
171 main() { 482 main() {
483 unittest.group("obj-schema-AggregationInfo", () {
484 unittest.test("to-json--from-json", () {
485 var o = buildAggregationInfo();
486 var od = new api.AggregationInfo.fromJson(o.toJson());
487 checkAggregationInfo(od);
488 });
489 });
490
491
172 unittest.group("obj-schema-BillingAccount", () { 492 unittest.group("obj-schema-BillingAccount", () {
173 unittest.test("to-json--from-json", () { 493 unittest.test("to-json--from-json", () {
174 var o = buildBillingAccount(); 494 var o = buildBillingAccount();
175 var od = new api.BillingAccount.fromJson(o.toJson()); 495 var od = new api.BillingAccount.fromJson(o.toJson());
176 checkBillingAccount(od); 496 checkBillingAccount(od);
177 }); 497 });
178 }); 498 });
179 499
180 500
501 unittest.group("obj-schema-Category", () {
502 unittest.test("to-json--from-json", () {
503 var o = buildCategory();
504 var od = new api.Category.fromJson(o.toJson());
505 checkCategory(od);
506 });
507 });
508
509
181 unittest.group("obj-schema-ListBillingAccountsResponse", () { 510 unittest.group("obj-schema-ListBillingAccountsResponse", () {
182 unittest.test("to-json--from-json", () { 511 unittest.test("to-json--from-json", () {
183 var o = buildListBillingAccountsResponse(); 512 var o = buildListBillingAccountsResponse();
184 var od = new api.ListBillingAccountsResponse.fromJson(o.toJson()); 513 var od = new api.ListBillingAccountsResponse.fromJson(o.toJson());
185 checkListBillingAccountsResponse(od); 514 checkListBillingAccountsResponse(od);
186 }); 515 });
187 }); 516 });
188 517
189 518
190 unittest.group("obj-schema-ListProjectBillingInfoResponse", () { 519 unittest.group("obj-schema-ListProjectBillingInfoResponse", () {
191 unittest.test("to-json--from-json", () { 520 unittest.test("to-json--from-json", () {
192 var o = buildListProjectBillingInfoResponse(); 521 var o = buildListProjectBillingInfoResponse();
193 var od = new api.ListProjectBillingInfoResponse.fromJson(o.toJson()); 522 var od = new api.ListProjectBillingInfoResponse.fromJson(o.toJson());
194 checkListProjectBillingInfoResponse(od); 523 checkListProjectBillingInfoResponse(od);
195 }); 524 });
196 }); 525 });
197 526
198 527
528 unittest.group("obj-schema-ListServicesResponse", () {
529 unittest.test("to-json--from-json", () {
530 var o = buildListServicesResponse();
531 var od = new api.ListServicesResponse.fromJson(o.toJson());
532 checkListServicesResponse(od);
533 });
534 });
535
536
537 unittest.group("obj-schema-ListSkusResponse", () {
538 unittest.test("to-json--from-json", () {
539 var o = buildListSkusResponse();
540 var od = new api.ListSkusResponse.fromJson(o.toJson());
541 checkListSkusResponse(od);
542 });
543 });
544
545
546 unittest.group("obj-schema-Money", () {
547 unittest.test("to-json--from-json", () {
548 var o = buildMoney();
549 var od = new api.Money.fromJson(o.toJson());
550 checkMoney(od);
551 });
552 });
553
554
555 unittest.group("obj-schema-PricingExpression", () {
556 unittest.test("to-json--from-json", () {
557 var o = buildPricingExpression();
558 var od = new api.PricingExpression.fromJson(o.toJson());
559 checkPricingExpression(od);
560 });
561 });
562
563
564 unittest.group("obj-schema-PricingInfo", () {
565 unittest.test("to-json--from-json", () {
566 var o = buildPricingInfo();
567 var od = new api.PricingInfo.fromJson(o.toJson());
568 checkPricingInfo(od);
569 });
570 });
571
572
199 unittest.group("obj-schema-ProjectBillingInfo", () { 573 unittest.group("obj-schema-ProjectBillingInfo", () {
200 unittest.test("to-json--from-json", () { 574 unittest.test("to-json--from-json", () {
201 var o = buildProjectBillingInfo(); 575 var o = buildProjectBillingInfo();
202 var od = new api.ProjectBillingInfo.fromJson(o.toJson()); 576 var od = new api.ProjectBillingInfo.fromJson(o.toJson());
203 checkProjectBillingInfo(od); 577 checkProjectBillingInfo(od);
204 }); 578 });
205 }); 579 });
206 580
207 581
582 unittest.group("obj-schema-Service", () {
583 unittest.test("to-json--from-json", () {
584 var o = buildService();
585 var od = new api.Service.fromJson(o.toJson());
586 checkService(od);
587 });
588 });
589
590
591 unittest.group("obj-schema-Sku", () {
592 unittest.test("to-json--from-json", () {
593 var o = buildSku();
594 var od = new api.Sku.fromJson(o.toJson());
595 checkSku(od);
596 });
597 });
598
599
600 unittest.group("obj-schema-TierRate", () {
601 unittest.test("to-json--from-json", () {
602 var o = buildTierRate();
603 var od = new api.TierRate.fromJson(o.toJson());
604 checkTierRate(od);
605 });
606 });
607
608
208 unittest.group("resource-BillingAccountsResourceApi", () { 609 unittest.group("resource-BillingAccountsResourceApi", () {
209 unittest.test("method--get", () { 610 unittest.test("method--get", () {
210 611
211 var mock = new HttpServerMock(); 612 var mock = new HttpServerMock();
212 api.BillingAccountsResourceApi res = new api.CloudbillingApi(mock).billing Accounts; 613 api.BillingAccountsResourceApi res = new api.CloudbillingApi(mock).billing Accounts;
213 var arg_name = "foo"; 614 var arg_name = "foo";
214 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 615 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
215 var path = (req.url).path; 616 var path = (req.url).path;
216 var pathOffset = 0; 617 var pathOffset = 0;
217 var index; 618 var index;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 return new async.Future.value(stringResponse(200, h, resp)); 846 return new async.Future.value(stringResponse(200, h, resp));
446 }), true); 847 }), true);
447 res.updateBillingInfo(arg_request, arg_name).then(unittest.expectAsync1((( api.ProjectBillingInfo response) { 848 res.updateBillingInfo(arg_request, arg_name).then(unittest.expectAsync1((( api.ProjectBillingInfo response) {
448 checkProjectBillingInfo(response); 849 checkProjectBillingInfo(response);
449 }))); 850 })));
450 }); 851 });
451 852
452 }); 853 });
453 854
454 855
856 unittest.group("resource-ServicesResourceApi", () {
857 unittest.test("method--list", () {
858
859 var mock = new HttpServerMock();
860 api.ServicesResourceApi res = new api.CloudbillingApi(mock).services;
861 var arg_pageSize = 42;
862 var arg_pageToken = "foo";
863 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
864 var path = (req.url).path;
865 var pathOffset = 0;
866 var index;
867 var subPart;
868 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
869 pathOffset += 1;
870 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq uals("v1/services"));
871 pathOffset += 11;
872
873 var query = (req.url).query;
874 var queryOffset = 0;
875 var queryMap = {};
876 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
877 parseBool(n) {
878 if (n == "true") return true;
879 if (n == "false") return false;
880 if (n == null) return null;
881 throw new core.ArgumentError("Invalid boolean: $n");
882 }
883 if (query.length > 0) {
884 for (var part in query.split("&")) {
885 var keyvalue = part.split("=");
886 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
887 }
888 }
889 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize));
890 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en));
891
892
893 var h = {
894 "content-type" : "application/json; charset=utf-8",
895 };
896 var resp = convert.JSON.encode(buildListServicesResponse());
897 return new async.Future.value(stringResponse(200, h, resp));
898 }), true);
899 res.list(pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.e xpectAsync1(((api.ListServicesResponse response) {
900 checkListServicesResponse(response);
901 })));
902 });
903
904 });
905
906
907 unittest.group("resource-ServicesSkusResourceApi", () {
908 unittest.test("method--list", () {
909
910 var mock = new HttpServerMock();
911 api.ServicesSkusResourceApi res = new api.CloudbillingApi(mock).services.s kus;
912 var arg_parent = "foo";
913 var arg_currencyCode = "foo";
914 var arg_endTime = "foo";
915 var arg_pageSize = 42;
916 var arg_startTime = "foo";
917 var arg_pageToken = "foo";
918 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
919 var path = (req.url).path;
920 var pathOffset = 0;
921 var index;
922 var subPart;
923 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
924 pathOffset += 1;
925 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
926 pathOffset += 3;
927 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
928
929 var query = (req.url).query;
930 var queryOffset = 0;
931 var queryMap = {};
932 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
933 parseBool(n) {
934 if (n == "true") return true;
935 if (n == "false") return false;
936 if (n == null) return null;
937 throw new core.ArgumentError("Invalid boolean: $n");
938 }
939 if (query.length > 0) {
940 for (var part in query.split("&")) {
941 var keyvalue = part.split("=");
942 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
943 }
944 }
945 unittest.expect(queryMap["currencyCode"].first, unittest.equals(arg_curr encyCode));
946 unittest.expect(queryMap["endTime"].first, unittest.equals(arg_endTime)) ;
947 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize));
948 unittest.expect(queryMap["startTime"].first, unittest.equals(arg_startTi me));
949 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en));
950
951
952 var h = {
953 "content-type" : "application/json; charset=utf-8",
954 };
955 var resp = convert.JSON.encode(buildListSkusResponse());
956 return new async.Future.value(stringResponse(200, h, resp));
957 }), true);
958 res.list(arg_parent, currencyCode: arg_currencyCode, endTime: arg_endTime, pageSize: arg_pageSize, startTime: arg_startTime, pageToken: arg_pageToken).the n(unittest.expectAsync1(((api.ListSkusResponse response) {
959 checkListSkusResponse(response);
960 })));
961 });
962
963 });
964
965
455 } 966 }
456 967
OLDNEW
« no previous file with comments | « generated/googleapis/test/appstate/v1_test.dart ('k') | generated/googleapis/test/cloudbuild/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698