OLD | NEW |
1 library googleapis.manufacturers.v1.test; | 1 library googleapis.manufacturers.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:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map headers, core.String body) { |
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 buildUnnamed1394() { | 54 buildUnnamed1390() { |
55 var o = new core.List<api.Image>(); | 55 var o = new core.List<api.Image>(); |
56 o.add(buildImage()); | 56 o.add(buildImage()); |
57 o.add(buildImage()); | 57 o.add(buildImage()); |
58 return o; | 58 return o; |
59 } | 59 } |
60 | 60 |
61 checkUnnamed1394(core.List<api.Image> o) { | 61 checkUnnamed1390(core.List<api.Image> o) { |
62 unittest.expect(o, unittest.hasLength(2)); | 62 unittest.expect(o, unittest.hasLength(2)); |
63 checkImage(o[0]); | 63 checkImage(o[0]); |
64 checkImage(o[1]); | 64 checkImage(o[1]); |
65 } | 65 } |
66 | 66 |
67 buildUnnamed1395() { | 67 buildUnnamed1391() { |
68 var o = new core.List<api.FeatureDescription>(); | 68 var o = new core.List<api.FeatureDescription>(); |
69 o.add(buildFeatureDescription()); | 69 o.add(buildFeatureDescription()); |
70 o.add(buildFeatureDescription()); | 70 o.add(buildFeatureDescription()); |
71 return o; | 71 return o; |
72 } | 72 } |
73 | 73 |
74 checkUnnamed1395(core.List<api.FeatureDescription> o) { | 74 checkUnnamed1391(core.List<api.FeatureDescription> o) { |
75 unittest.expect(o, unittest.hasLength(2)); | 75 unittest.expect(o, unittest.hasLength(2)); |
76 checkFeatureDescription(o[0]); | 76 checkFeatureDescription(o[0]); |
77 checkFeatureDescription(o[1]); | 77 checkFeatureDescription(o[1]); |
78 } | 78 } |
79 | 79 |
80 buildUnnamed1396() { | 80 buildUnnamed1392() { |
81 var o = new core.List<core.String>(); | 81 var o = new core.List<core.String>(); |
82 o.add("foo"); | 82 o.add("foo"); |
83 o.add("foo"); | 83 o.add("foo"); |
84 return o; | 84 return o; |
85 } | 85 } |
86 | 86 |
87 checkUnnamed1396(core.List<core.String> o) { | 87 checkUnnamed1392(core.List<core.String> o) { |
88 unittest.expect(o, unittest.hasLength(2)); | 88 unittest.expect(o, unittest.hasLength(2)); |
89 unittest.expect(o[0], unittest.equals('foo')); | 89 unittest.expect(o[0], unittest.equals('foo')); |
90 unittest.expect(o[1], unittest.equals('foo')); | 90 unittest.expect(o[1], unittest.equals('foo')); |
91 } | 91 } |
92 | 92 |
93 buildUnnamed1397() { | 93 buildUnnamed1393() { |
94 var o = new core.List<api.ProductDetail>(); | 94 var o = new core.List<api.ProductDetail>(); |
95 o.add(buildProductDetail()); | 95 o.add(buildProductDetail()); |
96 o.add(buildProductDetail()); | 96 o.add(buildProductDetail()); |
97 return o; | 97 return o; |
98 } | 98 } |
99 | 99 |
100 checkUnnamed1397(core.List<api.ProductDetail> o) { | 100 checkUnnamed1393(core.List<api.ProductDetail> o) { |
101 unittest.expect(o, unittest.hasLength(2)); | 101 unittest.expect(o, unittest.hasLength(2)); |
102 checkProductDetail(o[0]); | 102 checkProductDetail(o[0]); |
103 checkProductDetail(o[1]); | 103 checkProductDetail(o[1]); |
104 } | 104 } |
105 | 105 |
106 buildUnnamed1398() { | 106 buildUnnamed1394() { |
107 var o = new core.List<core.String>(); | 107 var o = new core.List<core.String>(); |
108 o.add("foo"); | 108 o.add("foo"); |
109 o.add("foo"); | 109 o.add("foo"); |
110 return o; | 110 return o; |
111 } | 111 } |
112 | 112 |
113 checkUnnamed1398(core.List<core.String> o) { | 113 checkUnnamed1394(core.List<core.String> o) { |
114 unittest.expect(o, unittest.hasLength(2)); | 114 unittest.expect(o, unittest.hasLength(2)); |
115 unittest.expect(o[0], unittest.equals('foo')); | 115 unittest.expect(o[0], unittest.equals('foo')); |
116 unittest.expect(o[1], unittest.equals('foo')); | 116 unittest.expect(o[1], unittest.equals('foo')); |
117 } | 117 } |
118 | 118 |
119 buildUnnamed1399() { | 119 buildUnnamed1395() { |
120 var o = new core.List<core.String>(); | 120 var o = new core.List<core.String>(); |
121 o.add("foo"); | 121 o.add("foo"); |
122 o.add("foo"); | 122 o.add("foo"); |
123 return o; | 123 return o; |
124 } | 124 } |
125 | 125 |
126 checkUnnamed1399(core.List<core.String> o) { | 126 checkUnnamed1395(core.List<core.String> o) { |
127 unittest.expect(o, unittest.hasLength(2)); | 127 unittest.expect(o, unittest.hasLength(2)); |
128 unittest.expect(o[0], unittest.equals('foo')); | 128 unittest.expect(o[0], unittest.equals('foo')); |
129 unittest.expect(o[1], unittest.equals('foo')); | 129 unittest.expect(o[1], unittest.equals('foo')); |
130 } | 130 } |
131 | 131 |
132 core.int buildCounterAttributes = 0; | 132 core.int buildCounterAttributes = 0; |
133 buildAttributes() { | 133 buildAttributes() { |
134 var o = new api.Attributes(); | 134 var o = new api.Attributes(); |
135 buildCounterAttributes++; | 135 buildCounterAttributes++; |
136 if (buildCounterAttributes < 3) { | 136 if (buildCounterAttributes < 3) { |
137 o.additionalImageLink = buildUnnamed1394(); | 137 o.additionalImageLink = buildUnnamed1390(); |
138 o.ageGroup = "foo"; | 138 o.ageGroup = "foo"; |
139 o.brand = "foo"; | 139 o.brand = "foo"; |
140 o.capacity = buildCapacity(); | 140 o.capacity = buildCapacity(); |
141 o.color = "foo"; | 141 o.color = "foo"; |
142 o.count = buildCount(); | 142 o.count = buildCount(); |
143 o.description = "foo"; | 143 o.description = "foo"; |
144 o.disclosureDate = "foo"; | 144 o.disclosureDate = "foo"; |
145 o.featureDescription = buildUnnamed1395(); | 145 o.featureDescription = buildUnnamed1391(); |
146 o.flavor = "foo"; | 146 o.flavor = "foo"; |
147 o.format = "foo"; | 147 o.format = "foo"; |
148 o.gender = "foo"; | 148 o.gender = "foo"; |
149 o.gtin = buildUnnamed1396(); | 149 o.gtin = buildUnnamed1392(); |
150 o.imageLink = buildImage(); | 150 o.imageLink = buildImage(); |
151 o.itemGroupId = "foo"; | 151 o.itemGroupId = "foo"; |
152 o.material = "foo"; | 152 o.material = "foo"; |
153 o.mpn = "foo"; | 153 o.mpn = "foo"; |
154 o.pattern = "foo"; | 154 o.pattern = "foo"; |
155 o.productDetail = buildUnnamed1397(); | 155 o.productDetail = buildUnnamed1393(); |
156 o.productLine = "foo"; | 156 o.productLine = "foo"; |
157 o.productName = "foo"; | 157 o.productName = "foo"; |
158 o.productPageUrl = "foo"; | 158 o.productPageUrl = "foo"; |
159 o.productType = buildUnnamed1398(); | 159 o.productType = buildUnnamed1394(); |
160 o.releaseDate = "foo"; | 160 o.releaseDate = "foo"; |
161 o.scent = "foo"; | 161 o.scent = "foo"; |
162 o.size = "foo"; | 162 o.size = "foo"; |
163 o.sizeSystem = "foo"; | 163 o.sizeSystem = "foo"; |
164 o.sizeType = "foo"; | 164 o.sizeType = "foo"; |
165 o.suggestedRetailPrice = buildPrice(); | 165 o.suggestedRetailPrice = buildPrice(); |
166 o.theme = "foo"; | 166 o.theme = "foo"; |
167 o.title = "foo"; | 167 o.title = "foo"; |
168 o.videoLink = buildUnnamed1399(); | 168 o.videoLink = buildUnnamed1395(); |
169 } | 169 } |
170 buildCounterAttributes--; | 170 buildCounterAttributes--; |
171 return o; | 171 return o; |
172 } | 172 } |
173 | 173 |
174 checkAttributes(api.Attributes o) { | 174 checkAttributes(api.Attributes o) { |
175 buildCounterAttributes++; | 175 buildCounterAttributes++; |
176 if (buildCounterAttributes < 3) { | 176 if (buildCounterAttributes < 3) { |
177 checkUnnamed1394(o.additionalImageLink); | 177 checkUnnamed1390(o.additionalImageLink); |
178 unittest.expect(o.ageGroup, unittest.equals('foo')); | 178 unittest.expect(o.ageGroup, unittest.equals('foo')); |
179 unittest.expect(o.brand, unittest.equals('foo')); | 179 unittest.expect(o.brand, unittest.equals('foo')); |
180 checkCapacity(o.capacity); | 180 checkCapacity(o.capacity); |
181 unittest.expect(o.color, unittest.equals('foo')); | 181 unittest.expect(o.color, unittest.equals('foo')); |
182 checkCount(o.count); | 182 checkCount(o.count); |
183 unittest.expect(o.description, unittest.equals('foo')); | 183 unittest.expect(o.description, unittest.equals('foo')); |
184 unittest.expect(o.disclosureDate, unittest.equals('foo')); | 184 unittest.expect(o.disclosureDate, unittest.equals('foo')); |
185 checkUnnamed1395(o.featureDescription); | 185 checkUnnamed1391(o.featureDescription); |
186 unittest.expect(o.flavor, unittest.equals('foo')); | 186 unittest.expect(o.flavor, unittest.equals('foo')); |
187 unittest.expect(o.format, unittest.equals('foo')); | 187 unittest.expect(o.format, unittest.equals('foo')); |
188 unittest.expect(o.gender, unittest.equals('foo')); | 188 unittest.expect(o.gender, unittest.equals('foo')); |
189 checkUnnamed1396(o.gtin); | 189 checkUnnamed1392(o.gtin); |
190 checkImage(o.imageLink); | 190 checkImage(o.imageLink); |
191 unittest.expect(o.itemGroupId, unittest.equals('foo')); | 191 unittest.expect(o.itemGroupId, unittest.equals('foo')); |
192 unittest.expect(o.material, unittest.equals('foo')); | 192 unittest.expect(o.material, unittest.equals('foo')); |
193 unittest.expect(o.mpn, unittest.equals('foo')); | 193 unittest.expect(o.mpn, unittest.equals('foo')); |
194 unittest.expect(o.pattern, unittest.equals('foo')); | 194 unittest.expect(o.pattern, unittest.equals('foo')); |
195 checkUnnamed1397(o.productDetail); | 195 checkUnnamed1393(o.productDetail); |
196 unittest.expect(o.productLine, unittest.equals('foo')); | 196 unittest.expect(o.productLine, unittest.equals('foo')); |
197 unittest.expect(o.productName, unittest.equals('foo')); | 197 unittest.expect(o.productName, unittest.equals('foo')); |
198 unittest.expect(o.productPageUrl, unittest.equals('foo')); | 198 unittest.expect(o.productPageUrl, unittest.equals('foo')); |
199 checkUnnamed1398(o.productType); | 199 checkUnnamed1394(o.productType); |
200 unittest.expect(o.releaseDate, unittest.equals('foo')); | 200 unittest.expect(o.releaseDate, unittest.equals('foo')); |
201 unittest.expect(o.scent, unittest.equals('foo')); | 201 unittest.expect(o.scent, unittest.equals('foo')); |
202 unittest.expect(o.size, unittest.equals('foo')); | 202 unittest.expect(o.size, unittest.equals('foo')); |
203 unittest.expect(o.sizeSystem, unittest.equals('foo')); | 203 unittest.expect(o.sizeSystem, unittest.equals('foo')); |
204 unittest.expect(o.sizeType, unittest.equals('foo')); | 204 unittest.expect(o.sizeType, unittest.equals('foo')); |
205 checkPrice(o.suggestedRetailPrice); | 205 checkPrice(o.suggestedRetailPrice); |
206 unittest.expect(o.theme, unittest.equals('foo')); | 206 unittest.expect(o.theme, unittest.equals('foo')); |
207 unittest.expect(o.title, unittest.equals('foo')); | 207 unittest.expect(o.title, unittest.equals('foo')); |
208 checkUnnamed1399(o.videoLink); | 208 checkUnnamed1395(o.videoLink); |
209 } | 209 } |
210 buildCounterAttributes--; | 210 buildCounterAttributes--; |
211 } | 211 } |
212 | 212 |
213 core.int buildCounterCapacity = 0; | 213 core.int buildCounterCapacity = 0; |
214 buildCapacity() { | 214 buildCapacity() { |
215 var o = new api.Capacity(); | 215 var o = new api.Capacity(); |
216 buildCounterCapacity++; | 216 buildCounterCapacity++; |
217 if (buildCounterCapacity < 3) { | 217 if (buildCounterCapacity < 3) { |
218 o.unit = "foo"; | 218 o.unit = "foo"; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 if (buildCounterIssue < 3) { | 318 if (buildCounterIssue < 3) { |
319 unittest.expect(o.attribute, unittest.equals('foo')); | 319 unittest.expect(o.attribute, unittest.equals('foo')); |
320 unittest.expect(o.description, unittest.equals('foo')); | 320 unittest.expect(o.description, unittest.equals('foo')); |
321 unittest.expect(o.severity, unittest.equals('foo')); | 321 unittest.expect(o.severity, unittest.equals('foo')); |
322 unittest.expect(o.timestamp, unittest.equals('foo')); | 322 unittest.expect(o.timestamp, unittest.equals('foo')); |
323 unittest.expect(o.type, unittest.equals('foo')); | 323 unittest.expect(o.type, unittest.equals('foo')); |
324 } | 324 } |
325 buildCounterIssue--; | 325 buildCounterIssue--; |
326 } | 326 } |
327 | 327 |
328 buildUnnamed1400() { | 328 buildUnnamed1396() { |
329 var o = new core.List<api.Product>(); | 329 var o = new core.List<api.Product>(); |
330 o.add(buildProduct()); | 330 o.add(buildProduct()); |
331 o.add(buildProduct()); | 331 o.add(buildProduct()); |
332 return o; | 332 return o; |
333 } | 333 } |
334 | 334 |
335 checkUnnamed1400(core.List<api.Product> o) { | 335 checkUnnamed1396(core.List<api.Product> o) { |
336 unittest.expect(o, unittest.hasLength(2)); | 336 unittest.expect(o, unittest.hasLength(2)); |
337 checkProduct(o[0]); | 337 checkProduct(o[0]); |
338 checkProduct(o[1]); | 338 checkProduct(o[1]); |
339 } | 339 } |
340 | 340 |
341 core.int buildCounterListProductsResponse = 0; | 341 core.int buildCounterListProductsResponse = 0; |
342 buildListProductsResponse() { | 342 buildListProductsResponse() { |
343 var o = new api.ListProductsResponse(); | 343 var o = new api.ListProductsResponse(); |
344 buildCounterListProductsResponse++; | 344 buildCounterListProductsResponse++; |
345 if (buildCounterListProductsResponse < 3) { | 345 if (buildCounterListProductsResponse < 3) { |
346 o.nextPageToken = "foo"; | 346 o.nextPageToken = "foo"; |
347 o.products = buildUnnamed1400(); | 347 o.products = buildUnnamed1396(); |
348 } | 348 } |
349 buildCounterListProductsResponse--; | 349 buildCounterListProductsResponse--; |
350 return o; | 350 return o; |
351 } | 351 } |
352 | 352 |
353 checkListProductsResponse(api.ListProductsResponse o) { | 353 checkListProductsResponse(api.ListProductsResponse o) { |
354 buildCounterListProductsResponse++; | 354 buildCounterListProductsResponse++; |
355 if (buildCounterListProductsResponse < 3) { | 355 if (buildCounterListProductsResponse < 3) { |
356 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 356 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
357 checkUnnamed1400(o.products); | 357 checkUnnamed1396(o.products); |
358 } | 358 } |
359 buildCounterListProductsResponse--; | 359 buildCounterListProductsResponse--; |
360 } | 360 } |
361 | 361 |
362 core.int buildCounterPrice = 0; | 362 core.int buildCounterPrice = 0; |
363 buildPrice() { | 363 buildPrice() { |
364 var o = new api.Price(); | 364 var o = new api.Price(); |
365 buildCounterPrice++; | 365 buildCounterPrice++; |
366 if (buildCounterPrice < 3) { | 366 if (buildCounterPrice < 3) { |
367 o.amount = "foo"; | 367 o.amount = "foo"; |
368 o.currency = "foo"; | 368 o.currency = "foo"; |
369 } | 369 } |
370 buildCounterPrice--; | 370 buildCounterPrice--; |
371 return o; | 371 return o; |
372 } | 372 } |
373 | 373 |
374 checkPrice(api.Price o) { | 374 checkPrice(api.Price o) { |
375 buildCounterPrice++; | 375 buildCounterPrice++; |
376 if (buildCounterPrice < 3) { | 376 if (buildCounterPrice < 3) { |
377 unittest.expect(o.amount, unittest.equals('foo')); | 377 unittest.expect(o.amount, unittest.equals('foo')); |
378 unittest.expect(o.currency, unittest.equals('foo')); | 378 unittest.expect(o.currency, unittest.equals('foo')); |
379 } | 379 } |
380 buildCounterPrice--; | 380 buildCounterPrice--; |
381 } | 381 } |
382 | 382 |
383 buildUnnamed1401() { | 383 buildUnnamed1397() { |
384 var o = new core.List<api.Issue>(); | 384 var o = new core.List<api.Issue>(); |
385 o.add(buildIssue()); | 385 o.add(buildIssue()); |
386 o.add(buildIssue()); | 386 o.add(buildIssue()); |
387 return o; | 387 return o; |
388 } | 388 } |
389 | 389 |
390 checkUnnamed1401(core.List<api.Issue> o) { | 390 checkUnnamed1397(core.List<api.Issue> o) { |
391 unittest.expect(o, unittest.hasLength(2)); | 391 unittest.expect(o, unittest.hasLength(2)); |
392 checkIssue(o[0]); | 392 checkIssue(o[0]); |
393 checkIssue(o[1]); | 393 checkIssue(o[1]); |
394 } | 394 } |
395 | 395 |
396 buildUnnamed1402() { | 396 buildUnnamed1398() { |
397 var o = new core.List<core.String>(); | 397 var o = new core.List<core.String>(); |
398 o.add("foo"); | 398 o.add("foo"); |
399 o.add("foo"); | 399 o.add("foo"); |
400 return o; | 400 return o; |
401 } | 401 } |
402 | 402 |
403 checkUnnamed1402(core.List<core.String> o) { | 403 checkUnnamed1398(core.List<core.String> o) { |
404 unittest.expect(o, unittest.hasLength(2)); | 404 unittest.expect(o, unittest.hasLength(2)); |
405 unittest.expect(o[0], unittest.equals('foo')); | 405 unittest.expect(o[0], unittest.equals('foo')); |
406 unittest.expect(o[1], unittest.equals('foo')); | 406 unittest.expect(o[1], unittest.equals('foo')); |
407 } | 407 } |
408 | 408 |
409 core.int buildCounterProduct = 0; | 409 core.int buildCounterProduct = 0; |
410 buildProduct() { | 410 buildProduct() { |
411 var o = new api.Product(); | 411 var o = new api.Product(); |
412 buildCounterProduct++; | 412 buildCounterProduct++; |
413 if (buildCounterProduct < 3) { | 413 if (buildCounterProduct < 3) { |
414 o.contentLanguage = "foo"; | 414 o.contentLanguage = "foo"; |
415 o.finalAttributes = buildAttributes(); | 415 o.finalAttributes = buildAttributes(); |
416 o.issues = buildUnnamed1401(); | 416 o.issues = buildUnnamed1397(); |
417 o.manuallyDeletedAttributes = buildUnnamed1402(); | 417 o.manuallyDeletedAttributes = buildUnnamed1398(); |
418 o.manuallyProvidedAttributes = buildAttributes(); | 418 o.manuallyProvidedAttributes = buildAttributes(); |
419 o.name = "foo"; | 419 o.name = "foo"; |
420 o.parent = "foo"; | 420 o.parent = "foo"; |
421 o.productId = "foo"; | 421 o.productId = "foo"; |
422 o.targetCountry = "foo"; | 422 o.targetCountry = "foo"; |
423 o.uploadedAttributes = buildAttributes(); | 423 o.uploadedAttributes = buildAttributes(); |
424 } | 424 } |
425 buildCounterProduct--; | 425 buildCounterProduct--; |
426 return o; | 426 return o; |
427 } | 427 } |
428 | 428 |
429 checkProduct(api.Product o) { | 429 checkProduct(api.Product o) { |
430 buildCounterProduct++; | 430 buildCounterProduct++; |
431 if (buildCounterProduct < 3) { | 431 if (buildCounterProduct < 3) { |
432 unittest.expect(o.contentLanguage, unittest.equals('foo')); | 432 unittest.expect(o.contentLanguage, unittest.equals('foo')); |
433 checkAttributes(o.finalAttributes); | 433 checkAttributes(o.finalAttributes); |
434 checkUnnamed1401(o.issues); | 434 checkUnnamed1397(o.issues); |
435 checkUnnamed1402(o.manuallyDeletedAttributes); | 435 checkUnnamed1398(o.manuallyDeletedAttributes); |
436 checkAttributes(o.manuallyProvidedAttributes); | 436 checkAttributes(o.manuallyProvidedAttributes); |
437 unittest.expect(o.name, unittest.equals('foo')); | 437 unittest.expect(o.name, unittest.equals('foo')); |
438 unittest.expect(o.parent, unittest.equals('foo')); | 438 unittest.expect(o.parent, unittest.equals('foo')); |
439 unittest.expect(o.productId, unittest.equals('foo')); | 439 unittest.expect(o.productId, unittest.equals('foo')); |
440 unittest.expect(o.targetCountry, unittest.equals('foo')); | 440 unittest.expect(o.targetCountry, unittest.equals('foo')); |
441 checkAttributes(o.uploadedAttributes); | 441 checkAttributes(o.uploadedAttributes); |
442 } | 442 } |
443 buildCounterProduct--; | 443 buildCounterProduct--; |
444 } | 444 } |
445 | 445 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 res.get(arg_parent, arg_name).then(unittest.expectAsync(((api.Product resp
onse) { | 603 res.get(arg_parent, arg_name).then(unittest.expectAsync(((api.Product resp
onse) { |
604 checkProduct(response); | 604 checkProduct(response); |
605 }))); | 605 }))); |
606 }); | 606 }); |
607 | 607 |
608 unittest.test("method--list", () { | 608 unittest.test("method--list", () { |
609 | 609 |
610 var mock = new HttpServerMock(); | 610 var mock = new HttpServerMock(); |
611 api.AccountsProductsResourceApi res = new api.ManufacturersApi(mock).accou
nts.products; | 611 api.AccountsProductsResourceApi res = new api.ManufacturersApi(mock).accou
nts.products; |
612 var arg_parent = "foo"; | 612 var arg_parent = "foo"; |
| 613 var arg_pageSize = 42; |
613 var arg_pageToken = "foo"; | 614 var arg_pageToken = "foo"; |
614 var arg_pageSize = 42; | |
615 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 615 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
616 var path = (req.url).path; | 616 var path = (req.url).path; |
617 var pathOffset = 0; | 617 var pathOffset = 0; |
618 var index; | 618 var index; |
619 var subPart; | 619 var subPart; |
620 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 620 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
621 pathOffset += 1; | 621 pathOffset += 1; |
622 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 622 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
623 pathOffset += 3; | 623 pathOffset += 3; |
624 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 624 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
625 | 625 |
626 var query = (req.url).query; | 626 var query = (req.url).query; |
627 var queryOffset = 0; | 627 var queryOffset = 0; |
628 var queryMap = {}; | 628 var queryMap = {}; |
629 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 629 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
630 parseBool(n) { | 630 parseBool(n) { |
631 if (n == "true") return true; | 631 if (n == "true") return true; |
632 if (n == "false") return false; | 632 if (n == "false") return false; |
633 if (n == null) return null; | 633 if (n == null) return null; |
634 throw new core.ArgumentError("Invalid boolean: $n"); | 634 throw new core.ArgumentError("Invalid boolean: $n"); |
635 } | 635 } |
636 if (query.length > 0) { | 636 if (query.length > 0) { |
637 for (var part in query.split("&")) { | 637 for (var part in query.split("&")) { |
638 var keyvalue = part.split("="); | 638 var keyvalue = part.split("="); |
639 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 639 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
640 } | 640 } |
641 } | 641 } |
| 642 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
642 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 643 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
643 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
644 | 644 |
645 | 645 |
646 var h = { | 646 var h = { |
647 "content-type" : "application/json; charset=utf-8", | 647 "content-type" : "application/json; charset=utf-8", |
648 }; | 648 }; |
649 var resp = convert.JSON.encode(buildListProductsResponse()); | 649 var resp = convert.JSON.encode(buildListProductsResponse()); |
650 return new async.Future.value(stringResponse(200, h, resp)); | 650 return new async.Future.value(stringResponse(200, h, resp)); |
651 }), true); | 651 }), true); |
652 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.ListProductsResponse response) { | 652 res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).the
n(unittest.expectAsync(((api.ListProductsResponse response) { |
653 checkListProductsResponse(response); | 653 checkListProductsResponse(response); |
654 }))); | 654 }))); |
655 }); | 655 }); |
656 | 656 |
657 }); | 657 }); |
658 | 658 |
659 | 659 |
660 } | 660 } |
661 | 661 |
OLD | NEW |