| 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; | |
| 5 import "dart:async" as async; | 4 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
| 7 | 6 |
| 8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; | |
| 10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
| 11 | 9 |
| 12 import 'package:googleapis/manufacturers/v1.dart' as api; | 10 import 'package:googleapis/manufacturers/v1.dart' as api; |
| 13 | 11 |
| 14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 13 core.Function _callback; |
| 16 core.bool _expectJson; | 14 core.bool _expectJson; |
| 17 | 15 |
| 18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 17 _callback = callback; |
| 20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
| 21 } | 19 } |
| 22 | 20 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { | 22 if (_expectJson) { |
| 25 return request.finalize() | 23 return request |
| 24 .finalize() |
| 26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
| 27 .join('') | 26 .join('') |
| 28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); | 29 return _callback(request, null); |
| 31 } else { | 30 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } | 32 } |
| 34 }); | 33 }); |
| 35 } else { | 34 } else { |
| 36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
| 37 if (stream == null) { | 36 if (stream == null) { |
| 38 return _callback(request, []); | 37 return _callback(request, []); |
| 39 } else { | 38 } else { |
| 40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 40 return _callback(request, data); |
| 42 }); | 41 }); |
| 43 } | 42 } |
| 44 } | 43 } |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 | 46 |
| 48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
| 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 51 } |
| 53 | 52 |
| 54 buildUnnamed1604() { | 53 buildUnnamed1599() { |
| 55 var o = new core.List<api.Image>(); | 54 var o = new core.List<api.Image>(); |
| 56 o.add(buildImage()); | 55 o.add(buildImage()); |
| 57 o.add(buildImage()); | 56 o.add(buildImage()); |
| 58 return o; | 57 return o; |
| 59 } | 58 } |
| 60 | 59 |
| 61 checkUnnamed1604(core.List<api.Image> o) { | 60 checkUnnamed1599(core.List<api.Image> o) { |
| 62 unittest.expect(o, unittest.hasLength(2)); | 61 unittest.expect(o, unittest.hasLength(2)); |
| 63 checkImage(o[0]); | 62 checkImage(o[0]); |
| 64 checkImage(o[1]); | 63 checkImage(o[1]); |
| 65 } | 64 } |
| 66 | 65 |
| 67 buildUnnamed1605() { | 66 buildUnnamed1600() { |
| 68 var o = new core.List<api.FeatureDescription>(); | 67 var o = new core.List<api.FeatureDescription>(); |
| 69 o.add(buildFeatureDescription()); | 68 o.add(buildFeatureDescription()); |
| 70 o.add(buildFeatureDescription()); | 69 o.add(buildFeatureDescription()); |
| 71 return o; | 70 return o; |
| 72 } | 71 } |
| 73 | 72 |
| 74 checkUnnamed1605(core.List<api.FeatureDescription> o) { | 73 checkUnnamed1600(core.List<api.FeatureDescription> o) { |
| 75 unittest.expect(o, unittest.hasLength(2)); | 74 unittest.expect(o, unittest.hasLength(2)); |
| 76 checkFeatureDescription(o[0]); | 75 checkFeatureDescription(o[0]); |
| 77 checkFeatureDescription(o[1]); | 76 checkFeatureDescription(o[1]); |
| 78 } | 77 } |
| 79 | 78 |
| 80 buildUnnamed1606() { | 79 buildUnnamed1601() { |
| 81 var o = new core.List<core.String>(); | 80 var o = new core.List<core.String>(); |
| 82 o.add("foo"); | 81 o.add("foo"); |
| 83 o.add("foo"); | 82 o.add("foo"); |
| 84 return o; | 83 return o; |
| 85 } | 84 } |
| 86 | 85 |
| 87 checkUnnamed1606(core.List<core.String> o) { | 86 checkUnnamed1601(core.List<core.String> o) { |
| 88 unittest.expect(o, unittest.hasLength(2)); | 87 unittest.expect(o, unittest.hasLength(2)); |
| 89 unittest.expect(o[0], unittest.equals('foo')); | 88 unittest.expect(o[0], unittest.equals('foo')); |
| 90 unittest.expect(o[1], unittest.equals('foo')); | 89 unittest.expect(o[1], unittest.equals('foo')); |
| 91 } | 90 } |
| 92 | 91 |
| 93 buildUnnamed1607() { | 92 buildUnnamed1602() { |
| 94 var o = new core.List<api.ProductDetail>(); | 93 var o = new core.List<api.ProductDetail>(); |
| 95 o.add(buildProductDetail()); | 94 o.add(buildProductDetail()); |
| 96 o.add(buildProductDetail()); | 95 o.add(buildProductDetail()); |
| 97 return o; | 96 return o; |
| 98 } | 97 } |
| 99 | 98 |
| 100 checkUnnamed1607(core.List<api.ProductDetail> o) { | 99 checkUnnamed1602(core.List<api.ProductDetail> o) { |
| 101 unittest.expect(o, unittest.hasLength(2)); | 100 unittest.expect(o, unittest.hasLength(2)); |
| 102 checkProductDetail(o[0]); | 101 checkProductDetail(o[0]); |
| 103 checkProductDetail(o[1]); | 102 checkProductDetail(o[1]); |
| 104 } | 103 } |
| 105 | 104 |
| 106 buildUnnamed1608() { | 105 buildUnnamed1603() { |
| 107 var o = new core.List<core.String>(); | 106 var o = new core.List<core.String>(); |
| 108 o.add("foo"); | 107 o.add("foo"); |
| 109 o.add("foo"); | 108 o.add("foo"); |
| 110 return o; | 109 return o; |
| 111 } | 110 } |
| 112 | 111 |
| 113 checkUnnamed1608(core.List<core.String> o) { | 112 checkUnnamed1603(core.List<core.String> o) { |
| 114 unittest.expect(o, unittest.hasLength(2)); | 113 unittest.expect(o, unittest.hasLength(2)); |
| 115 unittest.expect(o[0], unittest.equals('foo')); | 114 unittest.expect(o[0], unittest.equals('foo')); |
| 116 unittest.expect(o[1], unittest.equals('foo')); | 115 unittest.expect(o[1], unittest.equals('foo')); |
| 117 } | 116 } |
| 118 | 117 |
| 119 buildUnnamed1609() { | 118 buildUnnamed1604() { |
| 120 var o = new core.List<core.String>(); | 119 var o = new core.List<core.String>(); |
| 121 o.add("foo"); | 120 o.add("foo"); |
| 122 o.add("foo"); | 121 o.add("foo"); |
| 123 return o; | 122 return o; |
| 124 } | 123 } |
| 125 | 124 |
| 126 checkUnnamed1609(core.List<core.String> o) { | 125 checkUnnamed1604(core.List<core.String> o) { |
| 127 unittest.expect(o, unittest.hasLength(2)); | 126 unittest.expect(o, unittest.hasLength(2)); |
| 128 unittest.expect(o[0], unittest.equals('foo')); | 127 unittest.expect(o[0], unittest.equals('foo')); |
| 129 unittest.expect(o[1], unittest.equals('foo')); | 128 unittest.expect(o[1], unittest.equals('foo')); |
| 130 } | 129 } |
| 131 | 130 |
| 132 core.int buildCounterAttributes = 0; | 131 core.int buildCounterAttributes = 0; |
| 133 buildAttributes() { | 132 buildAttributes() { |
| 134 var o = new api.Attributes(); | 133 var o = new api.Attributes(); |
| 135 buildCounterAttributes++; | 134 buildCounterAttributes++; |
| 136 if (buildCounterAttributes < 3) { | 135 if (buildCounterAttributes < 3) { |
| 137 o.additionalImageLink = buildUnnamed1604(); | 136 o.additionalImageLink = buildUnnamed1599(); |
| 138 o.ageGroup = "foo"; | 137 o.ageGroup = "foo"; |
| 139 o.brand = "foo"; | 138 o.brand = "foo"; |
| 140 o.capacity = buildCapacity(); | 139 o.capacity = buildCapacity(); |
| 141 o.color = "foo"; | 140 o.color = "foo"; |
| 142 o.count = buildCount(); | 141 o.count = buildCount(); |
| 143 o.description = "foo"; | 142 o.description = "foo"; |
| 144 o.disclosureDate = "foo"; | 143 o.disclosureDate = "foo"; |
| 145 o.featureDescription = buildUnnamed1605(); | 144 o.featureDescription = buildUnnamed1600(); |
| 146 o.flavor = "foo"; | 145 o.flavor = "foo"; |
| 147 o.format = "foo"; | 146 o.format = "foo"; |
| 148 o.gender = "foo"; | 147 o.gender = "foo"; |
| 149 o.gtin = buildUnnamed1606(); | 148 o.gtin = buildUnnamed1601(); |
| 150 o.imageLink = buildImage(); | 149 o.imageLink = buildImage(); |
| 151 o.itemGroupId = "foo"; | 150 o.itemGroupId = "foo"; |
| 152 o.material = "foo"; | 151 o.material = "foo"; |
| 153 o.mpn = "foo"; | 152 o.mpn = "foo"; |
| 154 o.pattern = "foo"; | 153 o.pattern = "foo"; |
| 155 o.productDetail = buildUnnamed1607(); | 154 o.productDetail = buildUnnamed1602(); |
| 156 o.productLine = "foo"; | 155 o.productLine = "foo"; |
| 157 o.productName = "foo"; | 156 o.productName = "foo"; |
| 158 o.productPageUrl = "foo"; | 157 o.productPageUrl = "foo"; |
| 159 o.productType = buildUnnamed1608(); | 158 o.productType = buildUnnamed1603(); |
| 160 o.releaseDate = "foo"; | 159 o.releaseDate = "foo"; |
| 161 o.scent = "foo"; | 160 o.scent = "foo"; |
| 162 o.size = "foo"; | 161 o.size = "foo"; |
| 163 o.sizeSystem = "foo"; | 162 o.sizeSystem = "foo"; |
| 164 o.sizeType = "foo"; | 163 o.sizeType = "foo"; |
| 165 o.suggestedRetailPrice = buildPrice(); | 164 o.suggestedRetailPrice = buildPrice(); |
| 166 o.targetAccountId = "foo"; | 165 o.targetAccountId = "foo"; |
| 167 o.theme = "foo"; | 166 o.theme = "foo"; |
| 168 o.title = "foo"; | 167 o.title = "foo"; |
| 169 o.videoLink = buildUnnamed1609(); | 168 o.videoLink = buildUnnamed1604(); |
| 170 } | 169 } |
| 171 buildCounterAttributes--; | 170 buildCounterAttributes--; |
| 172 return o; | 171 return o; |
| 173 } | 172 } |
| 174 | 173 |
| 175 checkAttributes(api.Attributes o) { | 174 checkAttributes(api.Attributes o) { |
| 176 buildCounterAttributes++; | 175 buildCounterAttributes++; |
| 177 if (buildCounterAttributes < 3) { | 176 if (buildCounterAttributes < 3) { |
| 178 checkUnnamed1604(o.additionalImageLink); | 177 checkUnnamed1599(o.additionalImageLink); |
| 179 unittest.expect(o.ageGroup, unittest.equals('foo')); | 178 unittest.expect(o.ageGroup, unittest.equals('foo')); |
| 180 unittest.expect(o.brand, unittest.equals('foo')); | 179 unittest.expect(o.brand, unittest.equals('foo')); |
| 181 checkCapacity(o.capacity); | 180 checkCapacity(o.capacity); |
| 182 unittest.expect(o.color, unittest.equals('foo')); | 181 unittest.expect(o.color, unittest.equals('foo')); |
| 183 checkCount(o.count); | 182 checkCount(o.count); |
| 184 unittest.expect(o.description, unittest.equals('foo')); | 183 unittest.expect(o.description, unittest.equals('foo')); |
| 185 unittest.expect(o.disclosureDate, unittest.equals('foo')); | 184 unittest.expect(o.disclosureDate, unittest.equals('foo')); |
| 186 checkUnnamed1605(o.featureDescription); | 185 checkUnnamed1600(o.featureDescription); |
| 187 unittest.expect(o.flavor, unittest.equals('foo')); | 186 unittest.expect(o.flavor, unittest.equals('foo')); |
| 188 unittest.expect(o.format, unittest.equals('foo')); | 187 unittest.expect(o.format, unittest.equals('foo')); |
| 189 unittest.expect(o.gender, unittest.equals('foo')); | 188 unittest.expect(o.gender, unittest.equals('foo')); |
| 190 checkUnnamed1606(o.gtin); | 189 checkUnnamed1601(o.gtin); |
| 191 checkImage(o.imageLink); | 190 checkImage(o.imageLink); |
| 192 unittest.expect(o.itemGroupId, unittest.equals('foo')); | 191 unittest.expect(o.itemGroupId, unittest.equals('foo')); |
| 193 unittest.expect(o.material, unittest.equals('foo')); | 192 unittest.expect(o.material, unittest.equals('foo')); |
| 194 unittest.expect(o.mpn, unittest.equals('foo')); | 193 unittest.expect(o.mpn, unittest.equals('foo')); |
| 195 unittest.expect(o.pattern, unittest.equals('foo')); | 194 unittest.expect(o.pattern, unittest.equals('foo')); |
| 196 checkUnnamed1607(o.productDetail); | 195 checkUnnamed1602(o.productDetail); |
| 197 unittest.expect(o.productLine, unittest.equals('foo')); | 196 unittest.expect(o.productLine, unittest.equals('foo')); |
| 198 unittest.expect(o.productName, unittest.equals('foo')); | 197 unittest.expect(o.productName, unittest.equals('foo')); |
| 199 unittest.expect(o.productPageUrl, unittest.equals('foo')); | 198 unittest.expect(o.productPageUrl, unittest.equals('foo')); |
| 200 checkUnnamed1608(o.productType); | 199 checkUnnamed1603(o.productType); |
| 201 unittest.expect(o.releaseDate, unittest.equals('foo')); | 200 unittest.expect(o.releaseDate, unittest.equals('foo')); |
| 202 unittest.expect(o.scent, unittest.equals('foo')); | 201 unittest.expect(o.scent, unittest.equals('foo')); |
| 203 unittest.expect(o.size, unittest.equals('foo')); | 202 unittest.expect(o.size, unittest.equals('foo')); |
| 204 unittest.expect(o.sizeSystem, unittest.equals('foo')); | 203 unittest.expect(o.sizeSystem, unittest.equals('foo')); |
| 205 unittest.expect(o.sizeType, unittest.equals('foo')); | 204 unittest.expect(o.sizeType, unittest.equals('foo')); |
| 206 checkPrice(o.suggestedRetailPrice); | 205 checkPrice(o.suggestedRetailPrice); |
| 207 unittest.expect(o.targetAccountId, unittest.equals('foo')); | 206 unittest.expect(o.targetAccountId, unittest.equals('foo')); |
| 208 unittest.expect(o.theme, unittest.equals('foo')); | 207 unittest.expect(o.theme, unittest.equals('foo')); |
| 209 unittest.expect(o.title, unittest.equals('foo')); | 208 unittest.expect(o.title, unittest.equals('foo')); |
| 210 checkUnnamed1609(o.videoLink); | 209 checkUnnamed1604(o.videoLink); |
| 211 } | 210 } |
| 212 buildCounterAttributes--; | 211 buildCounterAttributes--; |
| 213 } | 212 } |
| 214 | 213 |
| 215 core.int buildCounterCapacity = 0; | 214 core.int buildCounterCapacity = 0; |
| 216 buildCapacity() { | 215 buildCapacity() { |
| 217 var o = new api.Capacity(); | 216 var o = new api.Capacity(); |
| 218 buildCounterCapacity++; | 217 buildCounterCapacity++; |
| 219 if (buildCounterCapacity < 3) { | 218 if (buildCounterCapacity < 3) { |
| 220 o.unit = "foo"; | 219 o.unit = "foo"; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 251 unittest.expect(o.unit, unittest.equals('foo')); | 250 unittest.expect(o.unit, unittest.equals('foo')); |
| 252 unittest.expect(o.value, unittest.equals('foo')); | 251 unittest.expect(o.value, unittest.equals('foo')); |
| 253 } | 252 } |
| 254 buildCounterCount--; | 253 buildCounterCount--; |
| 255 } | 254 } |
| 256 | 255 |
| 257 core.int buildCounterEmpty = 0; | 256 core.int buildCounterEmpty = 0; |
| 258 buildEmpty() { | 257 buildEmpty() { |
| 259 var o = new api.Empty(); | 258 var o = new api.Empty(); |
| 260 buildCounterEmpty++; | 259 buildCounterEmpty++; |
| 261 if (buildCounterEmpty < 3) { | 260 if (buildCounterEmpty < 3) {} |
| 262 } | |
| 263 buildCounterEmpty--; | 261 buildCounterEmpty--; |
| 264 return o; | 262 return o; |
| 265 } | 263 } |
| 266 | 264 |
| 267 checkEmpty(api.Empty o) { | 265 checkEmpty(api.Empty o) { |
| 268 buildCounterEmpty++; | 266 buildCounterEmpty++; |
| 269 if (buildCounterEmpty < 3) { | 267 if (buildCounterEmpty < 3) {} |
| 270 } | |
| 271 buildCounterEmpty--; | 268 buildCounterEmpty--; |
| 272 } | 269 } |
| 273 | 270 |
| 274 core.int buildCounterFeatureDescription = 0; | 271 core.int buildCounterFeatureDescription = 0; |
| 275 buildFeatureDescription() { | 272 buildFeatureDescription() { |
| 276 var o = new api.FeatureDescription(); | 273 var o = new api.FeatureDescription(); |
| 277 buildCounterFeatureDescription++; | 274 buildCounterFeatureDescription++; |
| 278 if (buildCounterFeatureDescription < 3) { | 275 if (buildCounterFeatureDescription < 3) { |
| 279 o.headline = "foo"; | 276 o.headline = "foo"; |
| 280 o.image = buildImage(); | 277 o.image = buildImage(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 if (buildCounterIssue < 3) { | 334 if (buildCounterIssue < 3) { |
| 338 unittest.expect(o.attribute, unittest.equals('foo')); | 335 unittest.expect(o.attribute, unittest.equals('foo')); |
| 339 unittest.expect(o.description, unittest.equals('foo')); | 336 unittest.expect(o.description, unittest.equals('foo')); |
| 340 unittest.expect(o.severity, unittest.equals('foo')); | 337 unittest.expect(o.severity, unittest.equals('foo')); |
| 341 unittest.expect(o.timestamp, unittest.equals('foo')); | 338 unittest.expect(o.timestamp, unittest.equals('foo')); |
| 342 unittest.expect(o.type, unittest.equals('foo')); | 339 unittest.expect(o.type, unittest.equals('foo')); |
| 343 } | 340 } |
| 344 buildCounterIssue--; | 341 buildCounterIssue--; |
| 345 } | 342 } |
| 346 | 343 |
| 347 buildUnnamed1610() { | 344 buildUnnamed1605() { |
| 348 var o = new core.List<api.Product>(); | 345 var o = new core.List<api.Product>(); |
| 349 o.add(buildProduct()); | 346 o.add(buildProduct()); |
| 350 o.add(buildProduct()); | 347 o.add(buildProduct()); |
| 351 return o; | 348 return o; |
| 352 } | 349 } |
| 353 | 350 |
| 354 checkUnnamed1610(core.List<api.Product> o) { | 351 checkUnnamed1605(core.List<api.Product> o) { |
| 355 unittest.expect(o, unittest.hasLength(2)); | 352 unittest.expect(o, unittest.hasLength(2)); |
| 356 checkProduct(o[0]); | 353 checkProduct(o[0]); |
| 357 checkProduct(o[1]); | 354 checkProduct(o[1]); |
| 358 } | 355 } |
| 359 | 356 |
| 360 core.int buildCounterListProductsResponse = 0; | 357 core.int buildCounterListProductsResponse = 0; |
| 361 buildListProductsResponse() { | 358 buildListProductsResponse() { |
| 362 var o = new api.ListProductsResponse(); | 359 var o = new api.ListProductsResponse(); |
| 363 buildCounterListProductsResponse++; | 360 buildCounterListProductsResponse++; |
| 364 if (buildCounterListProductsResponse < 3) { | 361 if (buildCounterListProductsResponse < 3) { |
| 365 o.nextPageToken = "foo"; | 362 o.nextPageToken = "foo"; |
| 366 o.products = buildUnnamed1610(); | 363 o.products = buildUnnamed1605(); |
| 367 } | 364 } |
| 368 buildCounterListProductsResponse--; | 365 buildCounterListProductsResponse--; |
| 369 return o; | 366 return o; |
| 370 } | 367 } |
| 371 | 368 |
| 372 checkListProductsResponse(api.ListProductsResponse o) { | 369 checkListProductsResponse(api.ListProductsResponse o) { |
| 373 buildCounterListProductsResponse++; | 370 buildCounterListProductsResponse++; |
| 374 if (buildCounterListProductsResponse < 3) { | 371 if (buildCounterListProductsResponse < 3) { |
| 375 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 372 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 376 checkUnnamed1610(o.products); | 373 checkUnnamed1605(o.products); |
| 377 } | 374 } |
| 378 buildCounterListProductsResponse--; | 375 buildCounterListProductsResponse--; |
| 379 } | 376 } |
| 380 | 377 |
| 381 core.int buildCounterPrice = 0; | 378 core.int buildCounterPrice = 0; |
| 382 buildPrice() { | 379 buildPrice() { |
| 383 var o = new api.Price(); | 380 var o = new api.Price(); |
| 384 buildCounterPrice++; | 381 buildCounterPrice++; |
| 385 if (buildCounterPrice < 3) { | 382 if (buildCounterPrice < 3) { |
| 386 o.amount = "foo"; | 383 o.amount = "foo"; |
| 387 o.currency = "foo"; | 384 o.currency = "foo"; |
| 388 } | 385 } |
| 389 buildCounterPrice--; | 386 buildCounterPrice--; |
| 390 return o; | 387 return o; |
| 391 } | 388 } |
| 392 | 389 |
| 393 checkPrice(api.Price o) { | 390 checkPrice(api.Price o) { |
| 394 buildCounterPrice++; | 391 buildCounterPrice++; |
| 395 if (buildCounterPrice < 3) { | 392 if (buildCounterPrice < 3) { |
| 396 unittest.expect(o.amount, unittest.equals('foo')); | 393 unittest.expect(o.amount, unittest.equals('foo')); |
| 397 unittest.expect(o.currency, unittest.equals('foo')); | 394 unittest.expect(o.currency, unittest.equals('foo')); |
| 398 } | 395 } |
| 399 buildCounterPrice--; | 396 buildCounterPrice--; |
| 400 } | 397 } |
| 401 | 398 |
| 402 buildUnnamed1611() { | 399 buildUnnamed1606() { |
| 403 var o = new core.List<api.Issue>(); | 400 var o = new core.List<api.Issue>(); |
| 404 o.add(buildIssue()); | 401 o.add(buildIssue()); |
| 405 o.add(buildIssue()); | 402 o.add(buildIssue()); |
| 406 return o; | 403 return o; |
| 407 } | 404 } |
| 408 | 405 |
| 409 checkUnnamed1611(core.List<api.Issue> o) { | 406 checkUnnamed1606(core.List<api.Issue> o) { |
| 410 unittest.expect(o, unittest.hasLength(2)); | 407 unittest.expect(o, unittest.hasLength(2)); |
| 411 checkIssue(o[0]); | 408 checkIssue(o[0]); |
| 412 checkIssue(o[1]); | 409 checkIssue(o[1]); |
| 413 } | 410 } |
| 414 | 411 |
| 415 buildUnnamed1612() { | 412 buildUnnamed1607() { |
| 416 var o = new core.List<core.String>(); | 413 var o = new core.List<core.String>(); |
| 417 o.add("foo"); | 414 o.add("foo"); |
| 418 o.add("foo"); | 415 o.add("foo"); |
| 419 return o; | 416 return o; |
| 420 } | 417 } |
| 421 | 418 |
| 422 checkUnnamed1612(core.List<core.String> o) { | 419 checkUnnamed1607(core.List<core.String> o) { |
| 423 unittest.expect(o, unittest.hasLength(2)); | 420 unittest.expect(o, unittest.hasLength(2)); |
| 424 unittest.expect(o[0], unittest.equals('foo')); | 421 unittest.expect(o[0], unittest.equals('foo')); |
| 425 unittest.expect(o[1], unittest.equals('foo')); | 422 unittest.expect(o[1], unittest.equals('foo')); |
| 426 } | 423 } |
| 427 | 424 |
| 428 core.int buildCounterProduct = 0; | 425 core.int buildCounterProduct = 0; |
| 429 buildProduct() { | 426 buildProduct() { |
| 430 var o = new api.Product(); | 427 var o = new api.Product(); |
| 431 buildCounterProduct++; | 428 buildCounterProduct++; |
| 432 if (buildCounterProduct < 3) { | 429 if (buildCounterProduct < 3) { |
| 433 o.contentLanguage = "foo"; | 430 o.contentLanguage = "foo"; |
| 434 o.finalAttributes = buildAttributes(); | 431 o.finalAttributes = buildAttributes(); |
| 435 o.issues = buildUnnamed1611(); | 432 o.issues = buildUnnamed1606(); |
| 436 o.manuallyDeletedAttributes = buildUnnamed1612(); | 433 o.manuallyDeletedAttributes = buildUnnamed1607(); |
| 437 o.manuallyProvidedAttributes = buildAttributes(); | 434 o.manuallyProvidedAttributes = buildAttributes(); |
| 438 o.name = "foo"; | 435 o.name = "foo"; |
| 439 o.parent = "foo"; | 436 o.parent = "foo"; |
| 440 o.productId = "foo"; | 437 o.productId = "foo"; |
| 441 o.targetCountry = "foo"; | 438 o.targetCountry = "foo"; |
| 442 o.uploadedAttributes = buildAttributes(); | 439 o.uploadedAttributes = buildAttributes(); |
| 443 } | 440 } |
| 444 buildCounterProduct--; | 441 buildCounterProduct--; |
| 445 return o; | 442 return o; |
| 446 } | 443 } |
| 447 | 444 |
| 448 checkProduct(api.Product o) { | 445 checkProduct(api.Product o) { |
| 449 buildCounterProduct++; | 446 buildCounterProduct++; |
| 450 if (buildCounterProduct < 3) { | 447 if (buildCounterProduct < 3) { |
| 451 unittest.expect(o.contentLanguage, unittest.equals('foo')); | 448 unittest.expect(o.contentLanguage, unittest.equals('foo')); |
| 452 checkAttributes(o.finalAttributes); | 449 checkAttributes(o.finalAttributes); |
| 453 checkUnnamed1611(o.issues); | 450 checkUnnamed1606(o.issues); |
| 454 checkUnnamed1612(o.manuallyDeletedAttributes); | 451 checkUnnamed1607(o.manuallyDeletedAttributes); |
| 455 checkAttributes(o.manuallyProvidedAttributes); | 452 checkAttributes(o.manuallyProvidedAttributes); |
| 456 unittest.expect(o.name, unittest.equals('foo')); | 453 unittest.expect(o.name, unittest.equals('foo')); |
| 457 unittest.expect(o.parent, unittest.equals('foo')); | 454 unittest.expect(o.parent, unittest.equals('foo')); |
| 458 unittest.expect(o.productId, unittest.equals('foo')); | 455 unittest.expect(o.productId, unittest.equals('foo')); |
| 459 unittest.expect(o.targetCountry, unittest.equals('foo')); | 456 unittest.expect(o.targetCountry, unittest.equals('foo')); |
| 460 checkAttributes(o.uploadedAttributes); | 457 checkAttributes(o.uploadedAttributes); |
| 461 } | 458 } |
| 462 buildCounterProduct--; | 459 buildCounterProduct--; |
| 463 } | 460 } |
| 464 | 461 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 478 checkProductDetail(api.ProductDetail o) { | 475 checkProductDetail(api.ProductDetail o) { |
| 479 buildCounterProductDetail++; | 476 buildCounterProductDetail++; |
| 480 if (buildCounterProductDetail < 3) { | 477 if (buildCounterProductDetail < 3) { |
| 481 unittest.expect(o.attributeName, unittest.equals('foo')); | 478 unittest.expect(o.attributeName, unittest.equals('foo')); |
| 482 unittest.expect(o.attributeValue, unittest.equals('foo')); | 479 unittest.expect(o.attributeValue, unittest.equals('foo')); |
| 483 unittest.expect(o.sectionName, unittest.equals('foo')); | 480 unittest.expect(o.sectionName, unittest.equals('foo')); |
| 484 } | 481 } |
| 485 buildCounterProductDetail--; | 482 buildCounterProductDetail--; |
| 486 } | 483 } |
| 487 | 484 |
| 488 | |
| 489 main() { | 485 main() { |
| 490 unittest.group("obj-schema-Attributes", () { | 486 unittest.group("obj-schema-Attributes", () { |
| 491 unittest.test("to-json--from-json", () { | 487 unittest.test("to-json--from-json", () { |
| 492 var o = buildAttributes(); | 488 var o = buildAttributes(); |
| 493 var od = new api.Attributes.fromJson(o.toJson()); | 489 var od = new api.Attributes.fromJson(o.toJson()); |
| 494 checkAttributes(od); | 490 checkAttributes(od); |
| 495 }); | 491 }); |
| 496 }); | 492 }); |
| 497 | 493 |
| 498 | |
| 499 unittest.group("obj-schema-Capacity", () { | 494 unittest.group("obj-schema-Capacity", () { |
| 500 unittest.test("to-json--from-json", () { | 495 unittest.test("to-json--from-json", () { |
| 501 var o = buildCapacity(); | 496 var o = buildCapacity(); |
| 502 var od = new api.Capacity.fromJson(o.toJson()); | 497 var od = new api.Capacity.fromJson(o.toJson()); |
| 503 checkCapacity(od); | 498 checkCapacity(od); |
| 504 }); | 499 }); |
| 505 }); | 500 }); |
| 506 | 501 |
| 507 | |
| 508 unittest.group("obj-schema-Count", () { | 502 unittest.group("obj-schema-Count", () { |
| 509 unittest.test("to-json--from-json", () { | 503 unittest.test("to-json--from-json", () { |
| 510 var o = buildCount(); | 504 var o = buildCount(); |
| 511 var od = new api.Count.fromJson(o.toJson()); | 505 var od = new api.Count.fromJson(o.toJson()); |
| 512 checkCount(od); | 506 checkCount(od); |
| 513 }); | 507 }); |
| 514 }); | 508 }); |
| 515 | 509 |
| 516 | |
| 517 unittest.group("obj-schema-Empty", () { | 510 unittest.group("obj-schema-Empty", () { |
| 518 unittest.test("to-json--from-json", () { | 511 unittest.test("to-json--from-json", () { |
| 519 var o = buildEmpty(); | 512 var o = buildEmpty(); |
| 520 var od = new api.Empty.fromJson(o.toJson()); | 513 var od = new api.Empty.fromJson(o.toJson()); |
| 521 checkEmpty(od); | 514 checkEmpty(od); |
| 522 }); | 515 }); |
| 523 }); | 516 }); |
| 524 | 517 |
| 525 | |
| 526 unittest.group("obj-schema-FeatureDescription", () { | 518 unittest.group("obj-schema-FeatureDescription", () { |
| 527 unittest.test("to-json--from-json", () { | 519 unittest.test("to-json--from-json", () { |
| 528 var o = buildFeatureDescription(); | 520 var o = buildFeatureDescription(); |
| 529 var od = new api.FeatureDescription.fromJson(o.toJson()); | 521 var od = new api.FeatureDescription.fromJson(o.toJson()); |
| 530 checkFeatureDescription(od); | 522 checkFeatureDescription(od); |
| 531 }); | 523 }); |
| 532 }); | 524 }); |
| 533 | 525 |
| 534 | |
| 535 unittest.group("obj-schema-Image", () { | 526 unittest.group("obj-schema-Image", () { |
| 536 unittest.test("to-json--from-json", () { | 527 unittest.test("to-json--from-json", () { |
| 537 var o = buildImage(); | 528 var o = buildImage(); |
| 538 var od = new api.Image.fromJson(o.toJson()); | 529 var od = new api.Image.fromJson(o.toJson()); |
| 539 checkImage(od); | 530 checkImage(od); |
| 540 }); | 531 }); |
| 541 }); | 532 }); |
| 542 | 533 |
| 543 | |
| 544 unittest.group("obj-schema-Issue", () { | 534 unittest.group("obj-schema-Issue", () { |
| 545 unittest.test("to-json--from-json", () { | 535 unittest.test("to-json--from-json", () { |
| 546 var o = buildIssue(); | 536 var o = buildIssue(); |
| 547 var od = new api.Issue.fromJson(o.toJson()); | 537 var od = new api.Issue.fromJson(o.toJson()); |
| 548 checkIssue(od); | 538 checkIssue(od); |
| 549 }); | 539 }); |
| 550 }); | 540 }); |
| 551 | 541 |
| 552 | |
| 553 unittest.group("obj-schema-ListProductsResponse", () { | 542 unittest.group("obj-schema-ListProductsResponse", () { |
| 554 unittest.test("to-json--from-json", () { | 543 unittest.test("to-json--from-json", () { |
| 555 var o = buildListProductsResponse(); | 544 var o = buildListProductsResponse(); |
| 556 var od = new api.ListProductsResponse.fromJson(o.toJson()); | 545 var od = new api.ListProductsResponse.fromJson(o.toJson()); |
| 557 checkListProductsResponse(od); | 546 checkListProductsResponse(od); |
| 558 }); | 547 }); |
| 559 }); | 548 }); |
| 560 | 549 |
| 561 | |
| 562 unittest.group("obj-schema-Price", () { | 550 unittest.group("obj-schema-Price", () { |
| 563 unittest.test("to-json--from-json", () { | 551 unittest.test("to-json--from-json", () { |
| 564 var o = buildPrice(); | 552 var o = buildPrice(); |
| 565 var od = new api.Price.fromJson(o.toJson()); | 553 var od = new api.Price.fromJson(o.toJson()); |
| 566 checkPrice(od); | 554 checkPrice(od); |
| 567 }); | 555 }); |
| 568 }); | 556 }); |
| 569 | 557 |
| 570 | |
| 571 unittest.group("obj-schema-Product", () { | 558 unittest.group("obj-schema-Product", () { |
| 572 unittest.test("to-json--from-json", () { | 559 unittest.test("to-json--from-json", () { |
| 573 var o = buildProduct(); | 560 var o = buildProduct(); |
| 574 var od = new api.Product.fromJson(o.toJson()); | 561 var od = new api.Product.fromJson(o.toJson()); |
| 575 checkProduct(od); | 562 checkProduct(od); |
| 576 }); | 563 }); |
| 577 }); | 564 }); |
| 578 | 565 |
| 579 | |
| 580 unittest.group("obj-schema-ProductDetail", () { | 566 unittest.group("obj-schema-ProductDetail", () { |
| 581 unittest.test("to-json--from-json", () { | 567 unittest.test("to-json--from-json", () { |
| 582 var o = buildProductDetail(); | 568 var o = buildProductDetail(); |
| 583 var od = new api.ProductDetail.fromJson(o.toJson()); | 569 var od = new api.ProductDetail.fromJson(o.toJson()); |
| 584 checkProductDetail(od); | 570 checkProductDetail(od); |
| 585 }); | 571 }); |
| 586 }); | 572 }); |
| 587 | 573 |
| 588 | |
| 589 unittest.group("resource-AccountsProductsResourceApi", () { | 574 unittest.group("resource-AccountsProductsResourceApi", () { |
| 590 unittest.test("method--delete", () { | 575 unittest.test("method--delete", () { |
| 591 | |
| 592 var mock = new HttpServerMock(); | 576 var mock = new HttpServerMock(); |
| 593 api.AccountsProductsResourceApi res = new api.ManufacturersApi(mock).accou
nts.products; | 577 api.AccountsProductsResourceApi res = |
| 578 new api.ManufacturersApi(mock).accounts.products; |
| 594 var arg_parent = "foo"; | 579 var arg_parent = "foo"; |
| 595 var arg_name = "foo"; | 580 var arg_name = "foo"; |
| 596 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 581 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 597 var path = (req.url).path; | 582 var path = (req.url).path; |
| 598 var pathOffset = 0; | 583 var pathOffset = 0; |
| 599 var index; | 584 var index; |
| 600 var subPart; | 585 var subPart; |
| 601 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 586 unittest.expect( |
| 587 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 602 pathOffset += 1; | 588 pathOffset += 1; |
| 603 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 589 unittest.expect( |
| 590 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 604 pathOffset += 3; | 591 pathOffset += 3; |
| 605 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 592 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 606 | 593 |
| 607 var query = (req.url).query; | 594 var query = (req.url).query; |
| 608 var queryOffset = 0; | 595 var queryOffset = 0; |
| 609 var queryMap = {}; | 596 var queryMap = {}; |
| 610 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 597 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 611 parseBool(n) { | 598 parseBool(n) { |
| 612 if (n == "true") return true; | 599 if (n == "true") return true; |
| 613 if (n == "false") return false; | 600 if (n == "false") return false; |
| 614 if (n == null) return null; | 601 if (n == null) return null; |
| 615 throw new core.ArgumentError("Invalid boolean: $n"); | 602 throw new core.ArgumentError("Invalid boolean: $n"); |
| 616 } | 603 } |
| 604 |
| 617 if (query.length > 0) { | 605 if (query.length > 0) { |
| 618 for (var part in query.split("&")) { | 606 for (var part in query.split("&")) { |
| 619 var keyvalue = part.split("="); | 607 var keyvalue = part.split("="); |
| 620 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 608 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 609 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 621 } | 610 } |
| 622 } | 611 } |
| 623 | 612 |
| 624 | |
| 625 var h = { | 613 var h = { |
| 626 "content-type" : "application/json; charset=utf-8", | 614 "content-type": "application/json; charset=utf-8", |
| 627 }; | 615 }; |
| 628 var resp = convert.JSON.encode(buildEmpty()); | 616 var resp = convert.JSON.encode(buildEmpty()); |
| 629 return new async.Future.value(stringResponse(200, h, resp)); | 617 return new async.Future.value(stringResponse(200, h, resp)); |
| 630 }), true); | 618 }), true); |
| 631 res.delete(arg_parent, arg_name).then(unittest.expectAsync1(((api.Empty re
sponse) { | 619 res |
| 620 .delete(arg_parent, arg_name) |
| 621 .then(unittest.expectAsync1(((api.Empty response) { |
| 632 checkEmpty(response); | 622 checkEmpty(response); |
| 633 }))); | 623 }))); |
| 634 }); | 624 }); |
| 635 | 625 |
| 636 unittest.test("method--get", () { | 626 unittest.test("method--get", () { |
| 637 | |
| 638 var mock = new HttpServerMock(); | 627 var mock = new HttpServerMock(); |
| 639 api.AccountsProductsResourceApi res = new api.ManufacturersApi(mock).accou
nts.products; | 628 api.AccountsProductsResourceApi res = |
| 629 new api.ManufacturersApi(mock).accounts.products; |
| 640 var arg_parent = "foo"; | 630 var arg_parent = "foo"; |
| 641 var arg_name = "foo"; | 631 var arg_name = "foo"; |
| 642 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 632 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 643 var path = (req.url).path; | 633 var path = (req.url).path; |
| 644 var pathOffset = 0; | 634 var pathOffset = 0; |
| 645 var index; | 635 var index; |
| 646 var subPart; | 636 var subPart; |
| 647 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 637 unittest.expect( |
| 638 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 648 pathOffset += 1; | 639 pathOffset += 1; |
| 649 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 640 unittest.expect( |
| 641 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 650 pathOffset += 3; | 642 pathOffset += 3; |
| 651 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 643 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 652 | 644 |
| 653 var query = (req.url).query; | 645 var query = (req.url).query; |
| 654 var queryOffset = 0; | 646 var queryOffset = 0; |
| 655 var queryMap = {}; | 647 var queryMap = {}; |
| 656 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 648 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 657 parseBool(n) { | 649 parseBool(n) { |
| 658 if (n == "true") return true; | 650 if (n == "true") return true; |
| 659 if (n == "false") return false; | 651 if (n == "false") return false; |
| 660 if (n == null) return null; | 652 if (n == null) return null; |
| 661 throw new core.ArgumentError("Invalid boolean: $n"); | 653 throw new core.ArgumentError("Invalid boolean: $n"); |
| 662 } | 654 } |
| 655 |
| 663 if (query.length > 0) { | 656 if (query.length > 0) { |
| 664 for (var part in query.split("&")) { | 657 for (var part in query.split("&")) { |
| 665 var keyvalue = part.split("="); | 658 var keyvalue = part.split("="); |
| 666 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 659 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 660 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 667 } | 661 } |
| 668 } | 662 } |
| 669 | 663 |
| 670 | |
| 671 var h = { | 664 var h = { |
| 672 "content-type" : "application/json; charset=utf-8", | 665 "content-type": "application/json; charset=utf-8", |
| 673 }; | 666 }; |
| 674 var resp = convert.JSON.encode(buildProduct()); | 667 var resp = convert.JSON.encode(buildProduct()); |
| 675 return new async.Future.value(stringResponse(200, h, resp)); | 668 return new async.Future.value(stringResponse(200, h, resp)); |
| 676 }), true); | 669 }), true); |
| 677 res.get(arg_parent, arg_name).then(unittest.expectAsync1(((api.Product res
ponse) { | 670 res |
| 671 .get(arg_parent, arg_name) |
| 672 .then(unittest.expectAsync1(((api.Product response) { |
| 678 checkProduct(response); | 673 checkProduct(response); |
| 679 }))); | 674 }))); |
| 680 }); | 675 }); |
| 681 | 676 |
| 682 unittest.test("method--list", () { | 677 unittest.test("method--list", () { |
| 683 | |
| 684 var mock = new HttpServerMock(); | 678 var mock = new HttpServerMock(); |
| 685 api.AccountsProductsResourceApi res = new api.ManufacturersApi(mock).accou
nts.products; | 679 api.AccountsProductsResourceApi res = |
| 680 new api.ManufacturersApi(mock).accounts.products; |
| 686 var arg_parent = "foo"; | 681 var arg_parent = "foo"; |
| 687 var arg_pageToken = "foo"; | 682 var arg_pageToken = "foo"; |
| 688 var arg_pageSize = 42; | 683 var arg_pageSize = 42; |
| 689 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 684 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 690 var path = (req.url).path; | 685 var path = (req.url).path; |
| 691 var pathOffset = 0; | 686 var pathOffset = 0; |
| 692 var index; | 687 var index; |
| 693 var subPart; | 688 var subPart; |
| 694 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 689 unittest.expect( |
| 690 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 695 pathOffset += 1; | 691 pathOffset += 1; |
| 696 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 692 unittest.expect( |
| 693 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 697 pathOffset += 3; | 694 pathOffset += 3; |
| 698 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 695 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 699 | 696 |
| 700 var query = (req.url).query; | 697 var query = (req.url).query; |
| 701 var queryOffset = 0; | 698 var queryOffset = 0; |
| 702 var queryMap = {}; | 699 var queryMap = {}; |
| 703 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 700 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 704 parseBool(n) { | 701 parseBool(n) { |
| 705 if (n == "true") return true; | 702 if (n == "true") return true; |
| 706 if (n == "false") return false; | 703 if (n == "false") return false; |
| 707 if (n == null) return null; | 704 if (n == null) return null; |
| 708 throw new core.ArgumentError("Invalid boolean: $n"); | 705 throw new core.ArgumentError("Invalid boolean: $n"); |
| 709 } | 706 } |
| 707 |
| 710 if (query.length > 0) { | 708 if (query.length > 0) { |
| 711 for (var part in query.split("&")) { | 709 for (var part in query.split("&")) { |
| 712 var keyvalue = part.split("="); | 710 var keyvalue = part.split("="); |
| 713 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 711 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 712 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 714 } | 713 } |
| 715 } | 714 } |
| 716 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 715 unittest.expect( |
| 717 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 716 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 718 | 717 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 718 unittest.equals(arg_pageSize)); |
| 719 | 719 |
| 720 var h = { | 720 var h = { |
| 721 "content-type" : "application/json; charset=utf-8", | 721 "content-type": "application/json; charset=utf-8", |
| 722 }; | 722 }; |
| 723 var resp = convert.JSON.encode(buildListProductsResponse()); | 723 var resp = convert.JSON.encode(buildListProductsResponse()); |
| 724 return new async.Future.value(stringResponse(200, h, resp)); | 724 return new async.Future.value(stringResponse(200, h, resp)); |
| 725 }), true); | 725 }), true); |
| 726 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync1(((api.ListProductsResponse response) { | 726 res |
| 727 .list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize) |
| 728 .then(unittest.expectAsync1(((api.ListProductsResponse response) { |
| 727 checkListProductsResponse(response); | 729 checkListProductsResponse(response); |
| 728 }))); | 730 }))); |
| 729 }); | 731 }); |
| 730 | 732 |
| 731 unittest.test("method--update", () { | 733 unittest.test("method--update", () { |
| 732 | |
| 733 var mock = new HttpServerMock(); | 734 var mock = new HttpServerMock(); |
| 734 api.AccountsProductsResourceApi res = new api.ManufacturersApi(mock).accou
nts.products; | 735 api.AccountsProductsResourceApi res = |
| 736 new api.ManufacturersApi(mock).accounts.products; |
| 735 var arg_request = buildProduct(); | 737 var arg_request = buildProduct(); |
| 736 var arg_parent = "foo"; | 738 var arg_parent = "foo"; |
| 737 var arg_name = "foo"; | 739 var arg_name = "foo"; |
| 738 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 740 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 739 var obj = new api.Product.fromJson(json); | 741 var obj = new api.Product.fromJson(json); |
| 740 checkProduct(obj); | 742 checkProduct(obj); |
| 741 | 743 |
| 742 var path = (req.url).path; | 744 var path = (req.url).path; |
| 743 var pathOffset = 0; | 745 var pathOffset = 0; |
| 744 var index; | 746 var index; |
| 745 var subPart; | 747 var subPart; |
| 746 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 748 unittest.expect( |
| 749 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 747 pathOffset += 1; | 750 pathOffset += 1; |
| 748 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 751 unittest.expect( |
| 752 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 749 pathOffset += 3; | 753 pathOffset += 3; |
| 750 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 754 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 751 | 755 |
| 752 var query = (req.url).query; | 756 var query = (req.url).query; |
| 753 var queryOffset = 0; | 757 var queryOffset = 0; |
| 754 var queryMap = {}; | 758 var queryMap = {}; |
| 755 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 759 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 756 parseBool(n) { | 760 parseBool(n) { |
| 757 if (n == "true") return true; | 761 if (n == "true") return true; |
| 758 if (n == "false") return false; | 762 if (n == "false") return false; |
| 759 if (n == null) return null; | 763 if (n == null) return null; |
| 760 throw new core.ArgumentError("Invalid boolean: $n"); | 764 throw new core.ArgumentError("Invalid boolean: $n"); |
| 761 } | 765 } |
| 766 |
| 762 if (query.length > 0) { | 767 if (query.length > 0) { |
| 763 for (var part in query.split("&")) { | 768 for (var part in query.split("&")) { |
| 764 var keyvalue = part.split("="); | 769 var keyvalue = part.split("="); |
| 765 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 770 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 771 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 766 } | 772 } |
| 767 } | 773 } |
| 768 | 774 |
| 769 | |
| 770 var h = { | 775 var h = { |
| 771 "content-type" : "application/json; charset=utf-8", | 776 "content-type": "application/json; charset=utf-8", |
| 772 }; | 777 }; |
| 773 var resp = convert.JSON.encode(buildProduct()); | 778 var resp = convert.JSON.encode(buildProduct()); |
| 774 return new async.Future.value(stringResponse(200, h, resp)); | 779 return new async.Future.value(stringResponse(200, h, resp)); |
| 775 }), true); | 780 }), true); |
| 776 res.update(arg_request, arg_parent, arg_name).then(unittest.expectAsync1((
(api.Product response) { | 781 res |
| 782 .update(arg_request, arg_parent, arg_name) |
| 783 .then(unittest.expectAsync1(((api.Product response) { |
| 777 checkProduct(response); | 784 checkProduct(response); |
| 778 }))); | 785 }))); |
| 779 }); | 786 }); |
| 780 | |
| 781 }); | 787 }); |
| 782 | |
| 783 | |
| 784 } | 788 } |
| 785 | |
| OLD | NEW |