| OLD | NEW |
| 1 library googleapis.licensing.v1.test; | 1 library googleapis.licensing.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; |
| 11 import 'package:googleapis/common/common.dart' as common; | |
| 12 import 'package:googleapis/src/common_internal.dart' as common_internal; | |
| 13 import '../common/common_internal_test.dart' as common_test; | |
| 14 | 11 |
| 15 import 'package:googleapis/licensing/v1.dart' as api; | 12 import 'package:googleapis/licensing/v1.dart' as api; |
| 16 | 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 22 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 18 | 53 |
| 19 core.int buildCounterLicenseAssignment = 0; | 54 core.int buildCounterLicenseAssignment = 0; |
| 20 buildLicenseAssignment() { | 55 buildLicenseAssignment() { |
| 21 var o = new api.LicenseAssignment(); | 56 var o = new api.LicenseAssignment(); |
| 22 buildCounterLicenseAssignment++; | 57 buildCounterLicenseAssignment++; |
| 23 if (buildCounterLicenseAssignment < 3) { | 58 if (buildCounterLicenseAssignment < 3) { |
| 24 o.etags = "foo"; | 59 o.etags = "foo"; |
| 25 o.kind = "foo"; | 60 o.kind = "foo"; |
| 26 o.productId = "foo"; | 61 o.productId = "foo"; |
| 27 o.selfLink = "foo"; | 62 o.selfLink = "foo"; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 57 } | 92 } |
| 58 | 93 |
| 59 checkLicenseAssignmentInsert(api.LicenseAssignmentInsert o) { | 94 checkLicenseAssignmentInsert(api.LicenseAssignmentInsert o) { |
| 60 buildCounterLicenseAssignmentInsert++; | 95 buildCounterLicenseAssignmentInsert++; |
| 61 if (buildCounterLicenseAssignmentInsert < 3) { | 96 if (buildCounterLicenseAssignmentInsert < 3) { |
| 62 unittest.expect(o.userId, unittest.equals('foo')); | 97 unittest.expect(o.userId, unittest.equals('foo')); |
| 63 } | 98 } |
| 64 buildCounterLicenseAssignmentInsert--; | 99 buildCounterLicenseAssignmentInsert--; |
| 65 } | 100 } |
| 66 | 101 |
| 67 buildUnnamed1234() { | 102 buildUnnamed1162() { |
| 68 var o = new core.List<api.LicenseAssignment>(); | 103 var o = new core.List<api.LicenseAssignment>(); |
| 69 o.add(buildLicenseAssignment()); | 104 o.add(buildLicenseAssignment()); |
| 70 o.add(buildLicenseAssignment()); | 105 o.add(buildLicenseAssignment()); |
| 71 return o; | 106 return o; |
| 72 } | 107 } |
| 73 | 108 |
| 74 checkUnnamed1234(core.List<api.LicenseAssignment> o) { | 109 checkUnnamed1162(core.List<api.LicenseAssignment> o) { |
| 75 unittest.expect(o, unittest.hasLength(2)); | 110 unittest.expect(o, unittest.hasLength(2)); |
| 76 checkLicenseAssignment(o[0]); | 111 checkLicenseAssignment(o[0]); |
| 77 checkLicenseAssignment(o[1]); | 112 checkLicenseAssignment(o[1]); |
| 78 } | 113 } |
| 79 | 114 |
| 80 core.int buildCounterLicenseAssignmentList = 0; | 115 core.int buildCounterLicenseAssignmentList = 0; |
| 81 buildLicenseAssignmentList() { | 116 buildLicenseAssignmentList() { |
| 82 var o = new api.LicenseAssignmentList(); | 117 var o = new api.LicenseAssignmentList(); |
| 83 buildCounterLicenseAssignmentList++; | 118 buildCounterLicenseAssignmentList++; |
| 84 if (buildCounterLicenseAssignmentList < 3) { | 119 if (buildCounterLicenseAssignmentList < 3) { |
| 85 o.etag = "foo"; | 120 o.etag = "foo"; |
| 86 o.items = buildUnnamed1234(); | 121 o.items = buildUnnamed1162(); |
| 87 o.kind = "foo"; | 122 o.kind = "foo"; |
| 88 o.nextPageToken = "foo"; | 123 o.nextPageToken = "foo"; |
| 89 } | 124 } |
| 90 buildCounterLicenseAssignmentList--; | 125 buildCounterLicenseAssignmentList--; |
| 91 return o; | 126 return o; |
| 92 } | 127 } |
| 93 | 128 |
| 94 checkLicenseAssignmentList(api.LicenseAssignmentList o) { | 129 checkLicenseAssignmentList(api.LicenseAssignmentList o) { |
| 95 buildCounterLicenseAssignmentList++; | 130 buildCounterLicenseAssignmentList++; |
| 96 if (buildCounterLicenseAssignmentList < 3) { | 131 if (buildCounterLicenseAssignmentList < 3) { |
| 97 unittest.expect(o.etag, unittest.equals('foo')); | 132 unittest.expect(o.etag, unittest.equals('foo')); |
| 98 checkUnnamed1234(o.items); | 133 checkUnnamed1162(o.items); |
| 99 unittest.expect(o.kind, unittest.equals('foo')); | 134 unittest.expect(o.kind, unittest.equals('foo')); |
| 100 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 135 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 101 } | 136 } |
| 102 buildCounterLicenseAssignmentList--; | 137 buildCounterLicenseAssignmentList--; |
| 103 } | 138 } |
| 104 | 139 |
| 105 | 140 |
| 106 main() { | 141 main() { |
| 107 unittest.group("obj-schema-LicenseAssignment", () { | 142 unittest.group("obj-schema-LicenseAssignment", () { |
| 108 unittest.test("to-json--from-json", () { | 143 unittest.test("to-json--from-json", () { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 127 var o = buildLicenseAssignmentList(); | 162 var o = buildLicenseAssignmentList(); |
| 128 var od = new api.LicenseAssignmentList.fromJson(o.toJson()); | 163 var od = new api.LicenseAssignmentList.fromJson(o.toJson()); |
| 129 checkLicenseAssignmentList(od); | 164 checkLicenseAssignmentList(od); |
| 130 }); | 165 }); |
| 131 }); | 166 }); |
| 132 | 167 |
| 133 | 168 |
| 134 unittest.group("resource-LicenseAssignmentsResourceApi", () { | 169 unittest.group("resource-LicenseAssignmentsResourceApi", () { |
| 135 unittest.test("method--delete", () { | 170 unittest.test("method--delete", () { |
| 136 | 171 |
| 137 var mock = new common_test.HttpServerMock(); | 172 var mock = new HttpServerMock(); |
| 138 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; | 173 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; |
| 139 var arg_productId = "foo"; | 174 var arg_productId = "foo"; |
| 140 var arg_skuId = "foo"; | 175 var arg_skuId = "foo"; |
| 141 var arg_userId = "foo"; | 176 var arg_userId = "foo"; |
| 142 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 177 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 143 var path = (req.url).path; | 178 var path = (req.url).path; |
| 144 var pathOffset = 0; | 179 var pathOffset = 0; |
| 145 var index; | 180 var index; |
| 146 var subPart; | 181 var subPart; |
| 147 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 182 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 162 var keyvalue = part.split("="); | 197 var keyvalue = part.split("="); |
| 163 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 198 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 164 } | 199 } |
| 165 } | 200 } |
| 166 | 201 |
| 167 | 202 |
| 168 var h = { | 203 var h = { |
| 169 "content-type" : "application/json; charset=utf-8", | 204 "content-type" : "application/json; charset=utf-8", |
| 170 }; | 205 }; |
| 171 var resp = ""; | 206 var resp = ""; |
| 172 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 207 return new async.Future.value(stringResponse(200, h, resp)); |
| 173 }), true); | 208 }), true); |
| 174 res.delete(arg_productId, arg_skuId, arg_userId).then(unittest.expectAsync
((_) {})); | 209 res.delete(arg_productId, arg_skuId, arg_userId).then(unittest.expectAsync
((_) {})); |
| 175 }); | 210 }); |
| 176 | 211 |
| 177 unittest.test("method--get", () { | 212 unittest.test("method--get", () { |
| 178 | 213 |
| 179 var mock = new common_test.HttpServerMock(); | 214 var mock = new HttpServerMock(); |
| 180 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; | 215 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; |
| 181 var arg_productId = "foo"; | 216 var arg_productId = "foo"; |
| 182 var arg_skuId = "foo"; | 217 var arg_skuId = "foo"; |
| 183 var arg_userId = "foo"; | 218 var arg_userId = "foo"; |
| 184 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 219 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 185 var path = (req.url).path; | 220 var path = (req.url).path; |
| 186 var pathOffset = 0; | 221 var pathOffset = 0; |
| 187 var index; | 222 var index; |
| 188 var subPart; | 223 var subPart; |
| 189 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 224 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 204 var keyvalue = part.split("="); | 239 var keyvalue = part.split("="); |
| 205 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 240 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 206 } | 241 } |
| 207 } | 242 } |
| 208 | 243 |
| 209 | 244 |
| 210 var h = { | 245 var h = { |
| 211 "content-type" : "application/json; charset=utf-8", | 246 "content-type" : "application/json; charset=utf-8", |
| 212 }; | 247 }; |
| 213 var resp = convert.JSON.encode(buildLicenseAssignment()); | 248 var resp = convert.JSON.encode(buildLicenseAssignment()); |
| 214 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 249 return new async.Future.value(stringResponse(200, h, resp)); |
| 215 }), true); | 250 }), true); |
| 216 res.get(arg_productId, arg_skuId, arg_userId).then(unittest.expectAsync(((
api.LicenseAssignment response) { | 251 res.get(arg_productId, arg_skuId, arg_userId).then(unittest.expectAsync(((
api.LicenseAssignment response) { |
| 217 checkLicenseAssignment(response); | 252 checkLicenseAssignment(response); |
| 218 }))); | 253 }))); |
| 219 }); | 254 }); |
| 220 | 255 |
| 221 unittest.test("method--insert", () { | 256 unittest.test("method--insert", () { |
| 222 | 257 |
| 223 var mock = new common_test.HttpServerMock(); | 258 var mock = new HttpServerMock(); |
| 224 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; | 259 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; |
| 225 var arg_request = buildLicenseAssignmentInsert(); | 260 var arg_request = buildLicenseAssignmentInsert(); |
| 226 var arg_productId = "foo"; | 261 var arg_productId = "foo"; |
| 227 var arg_skuId = "foo"; | 262 var arg_skuId = "foo"; |
| 228 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 263 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 229 var obj = new api.LicenseAssignmentInsert.fromJson(json); | 264 var obj = new api.LicenseAssignmentInsert.fromJson(json); |
| 230 checkLicenseAssignmentInsert(obj); | 265 checkLicenseAssignmentInsert(obj); |
| 231 | 266 |
| 232 var path = (req.url).path; | 267 var path = (req.url).path; |
| 233 var pathOffset = 0; | 268 var pathOffset = 0; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 251 var keyvalue = part.split("="); | 286 var keyvalue = part.split("="); |
| 252 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 287 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 253 } | 288 } |
| 254 } | 289 } |
| 255 | 290 |
| 256 | 291 |
| 257 var h = { | 292 var h = { |
| 258 "content-type" : "application/json; charset=utf-8", | 293 "content-type" : "application/json; charset=utf-8", |
| 259 }; | 294 }; |
| 260 var resp = convert.JSON.encode(buildLicenseAssignment()); | 295 var resp = convert.JSON.encode(buildLicenseAssignment()); |
| 261 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 296 return new async.Future.value(stringResponse(200, h, resp)); |
| 262 }), true); | 297 }), true); |
| 263 res.insert(arg_request, arg_productId, arg_skuId).then(unittest.expectAsyn
c(((api.LicenseAssignment response) { | 298 res.insert(arg_request, arg_productId, arg_skuId).then(unittest.expectAsyn
c(((api.LicenseAssignment response) { |
| 264 checkLicenseAssignment(response); | 299 checkLicenseAssignment(response); |
| 265 }))); | 300 }))); |
| 266 }); | 301 }); |
| 267 | 302 |
| 268 unittest.test("method--listForProduct", () { | 303 unittest.test("method--listForProduct", () { |
| 269 | 304 |
| 270 var mock = new common_test.HttpServerMock(); | 305 var mock = new HttpServerMock(); |
| 271 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; | 306 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; |
| 272 var arg_productId = "foo"; | 307 var arg_productId = "foo"; |
| 273 var arg_customerId = "foo"; | 308 var arg_customerId = "foo"; |
| 274 var arg_maxResults = 42; | 309 var arg_maxResults = 42; |
| 275 var arg_pageToken = "foo"; | 310 var arg_pageToken = "foo"; |
| 276 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 311 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 277 var path = (req.url).path; | 312 var path = (req.url).path; |
| 278 var pathOffset = 0; | 313 var pathOffset = 0; |
| 279 var index; | 314 var index; |
| 280 var subPart; | 315 var subPart; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 299 } | 334 } |
| 300 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); | 335 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); |
| 301 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 336 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 302 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 337 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 303 | 338 |
| 304 | 339 |
| 305 var h = { | 340 var h = { |
| 306 "content-type" : "application/json; charset=utf-8", | 341 "content-type" : "application/json; charset=utf-8", |
| 307 }; | 342 }; |
| 308 var resp = convert.JSON.encode(buildLicenseAssignmentList()); | 343 var resp = convert.JSON.encode(buildLicenseAssignmentList()); |
| 309 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 344 return new async.Future.value(stringResponse(200, h, resp)); |
| 310 }), true); | 345 }), true); |
| 311 res.listForProduct(arg_productId, arg_customerId, maxResults: arg_maxResul
ts, pageToken: arg_pageToken).then(unittest.expectAsync(((api.LicenseAssignmentL
ist response) { | 346 res.listForProduct(arg_productId, arg_customerId, maxResults: arg_maxResul
ts, pageToken: arg_pageToken).then(unittest.expectAsync(((api.LicenseAssignmentL
ist response) { |
| 312 checkLicenseAssignmentList(response); | 347 checkLicenseAssignmentList(response); |
| 313 }))); | 348 }))); |
| 314 }); | 349 }); |
| 315 | 350 |
| 316 unittest.test("method--listForProductAndSku", () { | 351 unittest.test("method--listForProductAndSku", () { |
| 317 | 352 |
| 318 var mock = new common_test.HttpServerMock(); | 353 var mock = new HttpServerMock(); |
| 319 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; | 354 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; |
| 320 var arg_productId = "foo"; | 355 var arg_productId = "foo"; |
| 321 var arg_skuId = "foo"; | 356 var arg_skuId = "foo"; |
| 322 var arg_customerId = "foo"; | 357 var arg_customerId = "foo"; |
| 323 var arg_maxResults = 42; | 358 var arg_maxResults = 42; |
| 324 var arg_pageToken = "foo"; | 359 var arg_pageToken = "foo"; |
| 325 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 360 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 326 var path = (req.url).path; | 361 var path = (req.url).path; |
| 327 var pathOffset = 0; | 362 var pathOffset = 0; |
| 328 var index; | 363 var index; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 348 } | 383 } |
| 349 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); | 384 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); |
| 350 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 385 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 351 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 386 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 352 | 387 |
| 353 | 388 |
| 354 var h = { | 389 var h = { |
| 355 "content-type" : "application/json; charset=utf-8", | 390 "content-type" : "application/json; charset=utf-8", |
| 356 }; | 391 }; |
| 357 var resp = convert.JSON.encode(buildLicenseAssignmentList()); | 392 var resp = convert.JSON.encode(buildLicenseAssignmentList()); |
| 358 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 393 return new async.Future.value(stringResponse(200, h, resp)); |
| 359 }), true); | 394 }), true); |
| 360 res.listForProductAndSku(arg_productId, arg_skuId, arg_customerId, maxResu
lts: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.L
icenseAssignmentList response) { | 395 res.listForProductAndSku(arg_productId, arg_skuId, arg_customerId, maxResu
lts: arg_maxResults, pageToken: arg_pageToken).then(unittest.expectAsync(((api.L
icenseAssignmentList response) { |
| 361 checkLicenseAssignmentList(response); | 396 checkLicenseAssignmentList(response); |
| 362 }))); | 397 }))); |
| 363 }); | 398 }); |
| 364 | 399 |
| 365 unittest.test("method--patch", () { | 400 unittest.test("method--patch", () { |
| 366 | 401 |
| 367 var mock = new common_test.HttpServerMock(); | 402 var mock = new HttpServerMock(); |
| 368 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; | 403 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; |
| 369 var arg_request = buildLicenseAssignment(); | 404 var arg_request = buildLicenseAssignment(); |
| 370 var arg_productId = "foo"; | 405 var arg_productId = "foo"; |
| 371 var arg_skuId = "foo"; | 406 var arg_skuId = "foo"; |
| 372 var arg_userId = "foo"; | 407 var arg_userId = "foo"; |
| 373 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 408 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 374 var obj = new api.LicenseAssignment.fromJson(json); | 409 var obj = new api.LicenseAssignment.fromJson(json); |
| 375 checkLicenseAssignment(obj); | 410 checkLicenseAssignment(obj); |
| 376 | 411 |
| 377 var path = (req.url).path; | 412 var path = (req.url).path; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 396 var keyvalue = part.split("="); | 431 var keyvalue = part.split("="); |
| 397 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 432 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 398 } | 433 } |
| 399 } | 434 } |
| 400 | 435 |
| 401 | 436 |
| 402 var h = { | 437 var h = { |
| 403 "content-type" : "application/json; charset=utf-8", | 438 "content-type" : "application/json; charset=utf-8", |
| 404 }; | 439 }; |
| 405 var resp = convert.JSON.encode(buildLicenseAssignment()); | 440 var resp = convert.JSON.encode(buildLicenseAssignment()); |
| 406 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 441 return new async.Future.value(stringResponse(200, h, resp)); |
| 407 }), true); | 442 }), true); |
| 408 res.patch(arg_request, arg_productId, arg_skuId, arg_userId).then(unittest
.expectAsync(((api.LicenseAssignment response) { | 443 res.patch(arg_request, arg_productId, arg_skuId, arg_userId).then(unittest
.expectAsync(((api.LicenseAssignment response) { |
| 409 checkLicenseAssignment(response); | 444 checkLicenseAssignment(response); |
| 410 }))); | 445 }))); |
| 411 }); | 446 }); |
| 412 | 447 |
| 413 unittest.test("method--update", () { | 448 unittest.test("method--update", () { |
| 414 | 449 |
| 415 var mock = new common_test.HttpServerMock(); | 450 var mock = new HttpServerMock(); |
| 416 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; | 451 api.LicenseAssignmentsResourceApi res = new api.LicensingApi(mock).license
Assignments; |
| 417 var arg_request = buildLicenseAssignment(); | 452 var arg_request = buildLicenseAssignment(); |
| 418 var arg_productId = "foo"; | 453 var arg_productId = "foo"; |
| 419 var arg_skuId = "foo"; | 454 var arg_skuId = "foo"; |
| 420 var arg_userId = "foo"; | 455 var arg_userId = "foo"; |
| 421 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 456 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 422 var obj = new api.LicenseAssignment.fromJson(json); | 457 var obj = new api.LicenseAssignment.fromJson(json); |
| 423 checkLicenseAssignment(obj); | 458 checkLicenseAssignment(obj); |
| 424 | 459 |
| 425 var path = (req.url).path; | 460 var path = (req.url).path; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 444 var keyvalue = part.split("="); | 479 var keyvalue = part.split("="); |
| 445 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 480 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 446 } | 481 } |
| 447 } | 482 } |
| 448 | 483 |
| 449 | 484 |
| 450 var h = { | 485 var h = { |
| 451 "content-type" : "application/json; charset=utf-8", | 486 "content-type" : "application/json; charset=utf-8", |
| 452 }; | 487 }; |
| 453 var resp = convert.JSON.encode(buildLicenseAssignment()); | 488 var resp = convert.JSON.encode(buildLicenseAssignment()); |
| 454 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 489 return new async.Future.value(stringResponse(200, h, resp)); |
| 455 }), true); | 490 }), true); |
| 456 res.update(arg_request, arg_productId, arg_skuId, arg_userId).then(unittes
t.expectAsync(((api.LicenseAssignment response) { | 491 res.update(arg_request, arg_productId, arg_skuId, arg_userId).then(unittes
t.expectAsync(((api.LicenseAssignment response) { |
| 457 checkLicenseAssignment(response); | 492 checkLicenseAssignment(response); |
| 458 }))); | 493 }))); |
| 459 }); | 494 }); |
| 460 | 495 |
| 461 }); | 496 }); |
| 462 | 497 |
| 463 | 498 |
| 464 } | 499 } |
| 465 | 500 |
| OLD | NEW |