| OLD | NEW |
| 1 library googleapis.vault.v1.test; | 1 library googleapis.vault.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/vault/v1.dart' as api; | 10 import 'package:googleapis/vault/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 core.int buildCounterAddMatterPermissionsRequest = 0; | 53 core.int buildCounterAddMatterPermissionsRequest = 0; |
| 55 buildAddMatterPermissionsRequest() { | 54 buildAddMatterPermissionsRequest() { |
| 56 var o = new api.AddMatterPermissionsRequest(); | 55 var o = new api.AddMatterPermissionsRequest(); |
| 57 buildCounterAddMatterPermissionsRequest++; | 56 buildCounterAddMatterPermissionsRequest++; |
| 58 if (buildCounterAddMatterPermissionsRequest < 3) { | 57 if (buildCounterAddMatterPermissionsRequest < 3) { |
| 59 o.ccMe = true; | 58 o.ccMe = true; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 checkMatterPermission(o.matterPermission); | 70 checkMatterPermission(o.matterPermission); |
| 72 unittest.expect(o.sendEmails, unittest.isTrue); | 71 unittest.expect(o.sendEmails, unittest.isTrue); |
| 73 } | 72 } |
| 74 buildCounterAddMatterPermissionsRequest--; | 73 buildCounterAddMatterPermissionsRequest--; |
| 75 } | 74 } |
| 76 | 75 |
| 77 core.int buildCounterCloseMatterRequest = 0; | 76 core.int buildCounterCloseMatterRequest = 0; |
| 78 buildCloseMatterRequest() { | 77 buildCloseMatterRequest() { |
| 79 var o = new api.CloseMatterRequest(); | 78 var o = new api.CloseMatterRequest(); |
| 80 buildCounterCloseMatterRequest++; | 79 buildCounterCloseMatterRequest++; |
| 81 if (buildCounterCloseMatterRequest < 3) { | 80 if (buildCounterCloseMatterRequest < 3) {} |
| 82 } | |
| 83 buildCounterCloseMatterRequest--; | 81 buildCounterCloseMatterRequest--; |
| 84 return o; | 82 return o; |
| 85 } | 83 } |
| 86 | 84 |
| 87 checkCloseMatterRequest(api.CloseMatterRequest o) { | 85 checkCloseMatterRequest(api.CloseMatterRequest o) { |
| 88 buildCounterCloseMatterRequest++; | 86 buildCounterCloseMatterRequest++; |
| 89 if (buildCounterCloseMatterRequest < 3) { | 87 if (buildCounterCloseMatterRequest < 3) {} |
| 90 } | |
| 91 buildCounterCloseMatterRequest--; | 88 buildCounterCloseMatterRequest--; |
| 92 } | 89 } |
| 93 | 90 |
| 94 core.int buildCounterCloseMatterResponse = 0; | 91 core.int buildCounterCloseMatterResponse = 0; |
| 95 buildCloseMatterResponse() { | 92 buildCloseMatterResponse() { |
| 96 var o = new api.CloseMatterResponse(); | 93 var o = new api.CloseMatterResponse(); |
| 97 buildCounterCloseMatterResponse++; | 94 buildCounterCloseMatterResponse++; |
| 98 if (buildCounterCloseMatterResponse < 3) { | 95 if (buildCounterCloseMatterResponse < 3) { |
| 99 o.matter = buildMatter(); | 96 o.matter = buildMatter(); |
| 100 } | 97 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 130 checkHeldGroupsQuery(o.groupsQuery); | 127 checkHeldGroupsQuery(o.groupsQuery); |
| 131 checkHeldMailQuery(o.mailQuery); | 128 checkHeldMailQuery(o.mailQuery); |
| 132 } | 129 } |
| 133 buildCounterCorpusQuery--; | 130 buildCounterCorpusQuery--; |
| 134 } | 131 } |
| 135 | 132 |
| 136 core.int buildCounterEmpty = 0; | 133 core.int buildCounterEmpty = 0; |
| 137 buildEmpty() { | 134 buildEmpty() { |
| 138 var o = new api.Empty(); | 135 var o = new api.Empty(); |
| 139 buildCounterEmpty++; | 136 buildCounterEmpty++; |
| 140 if (buildCounterEmpty < 3) { | 137 if (buildCounterEmpty < 3) {} |
| 141 } | |
| 142 buildCounterEmpty--; | 138 buildCounterEmpty--; |
| 143 return o; | 139 return o; |
| 144 } | 140 } |
| 145 | 141 |
| 146 checkEmpty(api.Empty o) { | 142 checkEmpty(api.Empty o) { |
| 147 buildCounterEmpty++; | 143 buildCounterEmpty++; |
| 148 if (buildCounterEmpty < 3) { | 144 if (buildCounterEmpty < 3) {} |
| 149 } | |
| 150 buildCounterEmpty--; | 145 buildCounterEmpty--; |
| 151 } | 146 } |
| 152 | 147 |
| 153 core.int buildCounterHeldAccount = 0; | 148 core.int buildCounterHeldAccount = 0; |
| 154 buildHeldAccount() { | 149 buildHeldAccount() { |
| 155 var o = new api.HeldAccount(); | 150 var o = new api.HeldAccount(); |
| 156 buildCounterHeldAccount++; | 151 buildCounterHeldAccount++; |
| 157 if (buildCounterHeldAccount < 3) { | 152 if (buildCounterHeldAccount < 3) { |
| 158 o.accountId = "foo"; | 153 o.accountId = "foo"; |
| 159 o.holdTime = "foo"; | 154 o.holdTime = "foo"; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 245 |
| 251 checkHeldOrgUnit(api.HeldOrgUnit o) { | 246 checkHeldOrgUnit(api.HeldOrgUnit o) { |
| 252 buildCounterHeldOrgUnit++; | 247 buildCounterHeldOrgUnit++; |
| 253 if (buildCounterHeldOrgUnit < 3) { | 248 if (buildCounterHeldOrgUnit < 3) { |
| 254 unittest.expect(o.holdTime, unittest.equals('foo')); | 249 unittest.expect(o.holdTime, unittest.equals('foo')); |
| 255 unittest.expect(o.orgUnitId, unittest.equals('foo')); | 250 unittest.expect(o.orgUnitId, unittest.equals('foo')); |
| 256 } | 251 } |
| 257 buildCounterHeldOrgUnit--; | 252 buildCounterHeldOrgUnit--; |
| 258 } | 253 } |
| 259 | 254 |
| 260 buildUnnamed1637() { | 255 buildUnnamed1633() { |
| 261 var o = new core.List<api.HeldAccount>(); | 256 var o = new core.List<api.HeldAccount>(); |
| 262 o.add(buildHeldAccount()); | 257 o.add(buildHeldAccount()); |
| 263 o.add(buildHeldAccount()); | 258 o.add(buildHeldAccount()); |
| 264 return o; | 259 return o; |
| 265 } | 260 } |
| 266 | 261 |
| 267 checkUnnamed1637(core.List<api.HeldAccount> o) { | 262 checkUnnamed1633(core.List<api.HeldAccount> o) { |
| 268 unittest.expect(o, unittest.hasLength(2)); | 263 unittest.expect(o, unittest.hasLength(2)); |
| 269 checkHeldAccount(o[0]); | 264 checkHeldAccount(o[0]); |
| 270 checkHeldAccount(o[1]); | 265 checkHeldAccount(o[1]); |
| 271 } | 266 } |
| 272 | 267 |
| 273 core.int buildCounterHold = 0; | 268 core.int buildCounterHold = 0; |
| 274 buildHold() { | 269 buildHold() { |
| 275 var o = new api.Hold(); | 270 var o = new api.Hold(); |
| 276 buildCounterHold++; | 271 buildCounterHold++; |
| 277 if (buildCounterHold < 3) { | 272 if (buildCounterHold < 3) { |
| 278 o.accounts = buildUnnamed1637(); | 273 o.accounts = buildUnnamed1633(); |
| 279 o.corpus = "foo"; | 274 o.corpus = "foo"; |
| 280 o.holdId = "foo"; | 275 o.holdId = "foo"; |
| 281 o.name = "foo"; | 276 o.name = "foo"; |
| 282 o.orgUnit = buildHeldOrgUnit(); | 277 o.orgUnit = buildHeldOrgUnit(); |
| 283 o.query = buildCorpusQuery(); | 278 o.query = buildCorpusQuery(); |
| 284 o.updateTime = "foo"; | 279 o.updateTime = "foo"; |
| 285 } | 280 } |
| 286 buildCounterHold--; | 281 buildCounterHold--; |
| 287 return o; | 282 return o; |
| 288 } | 283 } |
| 289 | 284 |
| 290 checkHold(api.Hold o) { | 285 checkHold(api.Hold o) { |
| 291 buildCounterHold++; | 286 buildCounterHold++; |
| 292 if (buildCounterHold < 3) { | 287 if (buildCounterHold < 3) { |
| 293 checkUnnamed1637(o.accounts); | 288 checkUnnamed1633(o.accounts); |
| 294 unittest.expect(o.corpus, unittest.equals('foo')); | 289 unittest.expect(o.corpus, unittest.equals('foo')); |
| 295 unittest.expect(o.holdId, unittest.equals('foo')); | 290 unittest.expect(o.holdId, unittest.equals('foo')); |
| 296 unittest.expect(o.name, unittest.equals('foo')); | 291 unittest.expect(o.name, unittest.equals('foo')); |
| 297 checkHeldOrgUnit(o.orgUnit); | 292 checkHeldOrgUnit(o.orgUnit); |
| 298 checkCorpusQuery(o.query); | 293 checkCorpusQuery(o.query); |
| 299 unittest.expect(o.updateTime, unittest.equals('foo')); | 294 unittest.expect(o.updateTime, unittest.equals('foo')); |
| 300 } | 295 } |
| 301 buildCounterHold--; | 296 buildCounterHold--; |
| 302 } | 297 } |
| 303 | 298 |
| 304 buildUnnamed1638() { | 299 buildUnnamed1634() { |
| 305 var o = new core.List<api.HeldAccount>(); | 300 var o = new core.List<api.HeldAccount>(); |
| 306 o.add(buildHeldAccount()); | 301 o.add(buildHeldAccount()); |
| 307 o.add(buildHeldAccount()); | 302 o.add(buildHeldAccount()); |
| 308 return o; | 303 return o; |
| 309 } | 304 } |
| 310 | 305 |
| 311 checkUnnamed1638(core.List<api.HeldAccount> o) { | 306 checkUnnamed1634(core.List<api.HeldAccount> o) { |
| 312 unittest.expect(o, unittest.hasLength(2)); | 307 unittest.expect(o, unittest.hasLength(2)); |
| 313 checkHeldAccount(o[0]); | 308 checkHeldAccount(o[0]); |
| 314 checkHeldAccount(o[1]); | 309 checkHeldAccount(o[1]); |
| 315 } | 310 } |
| 316 | 311 |
| 317 core.int buildCounterListHeldAccountsResponse = 0; | 312 core.int buildCounterListHeldAccountsResponse = 0; |
| 318 buildListHeldAccountsResponse() { | 313 buildListHeldAccountsResponse() { |
| 319 var o = new api.ListHeldAccountsResponse(); | 314 var o = new api.ListHeldAccountsResponse(); |
| 320 buildCounterListHeldAccountsResponse++; | 315 buildCounterListHeldAccountsResponse++; |
| 321 if (buildCounterListHeldAccountsResponse < 3) { | 316 if (buildCounterListHeldAccountsResponse < 3) { |
| 322 o.accounts = buildUnnamed1638(); | 317 o.accounts = buildUnnamed1634(); |
| 323 } | 318 } |
| 324 buildCounterListHeldAccountsResponse--; | 319 buildCounterListHeldAccountsResponse--; |
| 325 return o; | 320 return o; |
| 326 } | 321 } |
| 327 | 322 |
| 328 checkListHeldAccountsResponse(api.ListHeldAccountsResponse o) { | 323 checkListHeldAccountsResponse(api.ListHeldAccountsResponse o) { |
| 329 buildCounterListHeldAccountsResponse++; | 324 buildCounterListHeldAccountsResponse++; |
| 330 if (buildCounterListHeldAccountsResponse < 3) { | 325 if (buildCounterListHeldAccountsResponse < 3) { |
| 331 checkUnnamed1638(o.accounts); | 326 checkUnnamed1634(o.accounts); |
| 332 } | 327 } |
| 333 buildCounterListHeldAccountsResponse--; | 328 buildCounterListHeldAccountsResponse--; |
| 334 } | 329 } |
| 335 | 330 |
| 336 buildUnnamed1639() { | 331 buildUnnamed1635() { |
| 337 var o = new core.List<api.Hold>(); | 332 var o = new core.List<api.Hold>(); |
| 338 o.add(buildHold()); | 333 o.add(buildHold()); |
| 339 o.add(buildHold()); | 334 o.add(buildHold()); |
| 340 return o; | 335 return o; |
| 341 } | 336 } |
| 342 | 337 |
| 343 checkUnnamed1639(core.List<api.Hold> o) { | 338 checkUnnamed1635(core.List<api.Hold> o) { |
| 344 unittest.expect(o, unittest.hasLength(2)); | 339 unittest.expect(o, unittest.hasLength(2)); |
| 345 checkHold(o[0]); | 340 checkHold(o[0]); |
| 346 checkHold(o[1]); | 341 checkHold(o[1]); |
| 347 } | 342 } |
| 348 | 343 |
| 349 core.int buildCounterListHoldsResponse = 0; | 344 core.int buildCounterListHoldsResponse = 0; |
| 350 buildListHoldsResponse() { | 345 buildListHoldsResponse() { |
| 351 var o = new api.ListHoldsResponse(); | 346 var o = new api.ListHoldsResponse(); |
| 352 buildCounterListHoldsResponse++; | 347 buildCounterListHoldsResponse++; |
| 353 if (buildCounterListHoldsResponse < 3) { | 348 if (buildCounterListHoldsResponse < 3) { |
| 354 o.holds = buildUnnamed1639(); | 349 o.holds = buildUnnamed1635(); |
| 355 o.nextPageToken = "foo"; | 350 o.nextPageToken = "foo"; |
| 356 } | 351 } |
| 357 buildCounterListHoldsResponse--; | 352 buildCounterListHoldsResponse--; |
| 358 return o; | 353 return o; |
| 359 } | 354 } |
| 360 | 355 |
| 361 checkListHoldsResponse(api.ListHoldsResponse o) { | 356 checkListHoldsResponse(api.ListHoldsResponse o) { |
| 362 buildCounterListHoldsResponse++; | 357 buildCounterListHoldsResponse++; |
| 363 if (buildCounterListHoldsResponse < 3) { | 358 if (buildCounterListHoldsResponse < 3) { |
| 364 checkUnnamed1639(o.holds); | 359 checkUnnamed1635(o.holds); |
| 365 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 360 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 366 } | 361 } |
| 367 buildCounterListHoldsResponse--; | 362 buildCounterListHoldsResponse--; |
| 368 } | 363 } |
| 369 | 364 |
| 370 buildUnnamed1640() { | 365 buildUnnamed1636() { |
| 371 var o = new core.List<api.Matter>(); | 366 var o = new core.List<api.Matter>(); |
| 372 o.add(buildMatter()); | 367 o.add(buildMatter()); |
| 373 o.add(buildMatter()); | 368 o.add(buildMatter()); |
| 374 return o; | 369 return o; |
| 375 } | 370 } |
| 376 | 371 |
| 377 checkUnnamed1640(core.List<api.Matter> o) { | 372 checkUnnamed1636(core.List<api.Matter> o) { |
| 378 unittest.expect(o, unittest.hasLength(2)); | 373 unittest.expect(o, unittest.hasLength(2)); |
| 379 checkMatter(o[0]); | 374 checkMatter(o[0]); |
| 380 checkMatter(o[1]); | 375 checkMatter(o[1]); |
| 381 } | 376 } |
| 382 | 377 |
| 383 core.int buildCounterListMattersResponse = 0; | 378 core.int buildCounterListMattersResponse = 0; |
| 384 buildListMattersResponse() { | 379 buildListMattersResponse() { |
| 385 var o = new api.ListMattersResponse(); | 380 var o = new api.ListMattersResponse(); |
| 386 buildCounterListMattersResponse++; | 381 buildCounterListMattersResponse++; |
| 387 if (buildCounterListMattersResponse < 3) { | 382 if (buildCounterListMattersResponse < 3) { |
| 388 o.matters = buildUnnamed1640(); | 383 o.matters = buildUnnamed1636(); |
| 389 o.nextPageToken = "foo"; | 384 o.nextPageToken = "foo"; |
| 390 } | 385 } |
| 391 buildCounterListMattersResponse--; | 386 buildCounterListMattersResponse--; |
| 392 return o; | 387 return o; |
| 393 } | 388 } |
| 394 | 389 |
| 395 checkListMattersResponse(api.ListMattersResponse o) { | 390 checkListMattersResponse(api.ListMattersResponse o) { |
| 396 buildCounterListMattersResponse++; | 391 buildCounterListMattersResponse++; |
| 397 if (buildCounterListMattersResponse < 3) { | 392 if (buildCounterListMattersResponse < 3) { |
| 398 checkUnnamed1640(o.matters); | 393 checkUnnamed1636(o.matters); |
| 399 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 394 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 400 } | 395 } |
| 401 buildCounterListMattersResponse--; | 396 buildCounterListMattersResponse--; |
| 402 } | 397 } |
| 403 | 398 |
| 404 buildUnnamed1641() { | 399 buildUnnamed1637() { |
| 405 var o = new core.List<api.MatterPermission>(); | 400 var o = new core.List<api.MatterPermission>(); |
| 406 o.add(buildMatterPermission()); | 401 o.add(buildMatterPermission()); |
| 407 o.add(buildMatterPermission()); | 402 o.add(buildMatterPermission()); |
| 408 return o; | 403 return o; |
| 409 } | 404 } |
| 410 | 405 |
| 411 checkUnnamed1641(core.List<api.MatterPermission> o) { | 406 checkUnnamed1637(core.List<api.MatterPermission> o) { |
| 412 unittest.expect(o, unittest.hasLength(2)); | 407 unittest.expect(o, unittest.hasLength(2)); |
| 413 checkMatterPermission(o[0]); | 408 checkMatterPermission(o[0]); |
| 414 checkMatterPermission(o[1]); | 409 checkMatterPermission(o[1]); |
| 415 } | 410 } |
| 416 | 411 |
| 417 core.int buildCounterMatter = 0; | 412 core.int buildCounterMatter = 0; |
| 418 buildMatter() { | 413 buildMatter() { |
| 419 var o = new api.Matter(); | 414 var o = new api.Matter(); |
| 420 buildCounterMatter++; | 415 buildCounterMatter++; |
| 421 if (buildCounterMatter < 3) { | 416 if (buildCounterMatter < 3) { |
| 422 o.description = "foo"; | 417 o.description = "foo"; |
| 423 o.matterId = "foo"; | 418 o.matterId = "foo"; |
| 424 o.matterPermissions = buildUnnamed1641(); | 419 o.matterPermissions = buildUnnamed1637(); |
| 425 o.name = "foo"; | 420 o.name = "foo"; |
| 426 o.state = "foo"; | 421 o.state = "foo"; |
| 427 } | 422 } |
| 428 buildCounterMatter--; | 423 buildCounterMatter--; |
| 429 return o; | 424 return o; |
| 430 } | 425 } |
| 431 | 426 |
| 432 checkMatter(api.Matter o) { | 427 checkMatter(api.Matter o) { |
| 433 buildCounterMatter++; | 428 buildCounterMatter++; |
| 434 if (buildCounterMatter < 3) { | 429 if (buildCounterMatter < 3) { |
| 435 unittest.expect(o.description, unittest.equals('foo')); | 430 unittest.expect(o.description, unittest.equals('foo')); |
| 436 unittest.expect(o.matterId, unittest.equals('foo')); | 431 unittest.expect(o.matterId, unittest.equals('foo')); |
| 437 checkUnnamed1641(o.matterPermissions); | 432 checkUnnamed1637(o.matterPermissions); |
| 438 unittest.expect(o.name, unittest.equals('foo')); | 433 unittest.expect(o.name, unittest.equals('foo')); |
| 439 unittest.expect(o.state, unittest.equals('foo')); | 434 unittest.expect(o.state, unittest.equals('foo')); |
| 440 } | 435 } |
| 441 buildCounterMatter--; | 436 buildCounterMatter--; |
| 442 } | 437 } |
| 443 | 438 |
| 444 core.int buildCounterMatterPermission = 0; | 439 core.int buildCounterMatterPermission = 0; |
| 445 buildMatterPermission() { | 440 buildMatterPermission() { |
| 446 var o = new api.MatterPermission(); | 441 var o = new api.MatterPermission(); |
| 447 buildCounterMatterPermission++; | 442 buildCounterMatterPermission++; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 478 if (buildCounterRemoveMatterPermissionsRequest < 3) { | 473 if (buildCounterRemoveMatterPermissionsRequest < 3) { |
| 479 unittest.expect(o.accountId, unittest.equals('foo')); | 474 unittest.expect(o.accountId, unittest.equals('foo')); |
| 480 } | 475 } |
| 481 buildCounterRemoveMatterPermissionsRequest--; | 476 buildCounterRemoveMatterPermissionsRequest--; |
| 482 } | 477 } |
| 483 | 478 |
| 484 core.int buildCounterReopenMatterRequest = 0; | 479 core.int buildCounterReopenMatterRequest = 0; |
| 485 buildReopenMatterRequest() { | 480 buildReopenMatterRequest() { |
| 486 var o = new api.ReopenMatterRequest(); | 481 var o = new api.ReopenMatterRequest(); |
| 487 buildCounterReopenMatterRequest++; | 482 buildCounterReopenMatterRequest++; |
| 488 if (buildCounterReopenMatterRequest < 3) { | 483 if (buildCounterReopenMatterRequest < 3) {} |
| 489 } | |
| 490 buildCounterReopenMatterRequest--; | 484 buildCounterReopenMatterRequest--; |
| 491 return o; | 485 return o; |
| 492 } | 486 } |
| 493 | 487 |
| 494 checkReopenMatterRequest(api.ReopenMatterRequest o) { | 488 checkReopenMatterRequest(api.ReopenMatterRequest o) { |
| 495 buildCounterReopenMatterRequest++; | 489 buildCounterReopenMatterRequest++; |
| 496 if (buildCounterReopenMatterRequest < 3) { | 490 if (buildCounterReopenMatterRequest < 3) {} |
| 497 } | |
| 498 buildCounterReopenMatterRequest--; | 491 buildCounterReopenMatterRequest--; |
| 499 } | 492 } |
| 500 | 493 |
| 501 core.int buildCounterReopenMatterResponse = 0; | 494 core.int buildCounterReopenMatterResponse = 0; |
| 502 buildReopenMatterResponse() { | 495 buildReopenMatterResponse() { |
| 503 var o = new api.ReopenMatterResponse(); | 496 var o = new api.ReopenMatterResponse(); |
| 504 buildCounterReopenMatterResponse++; | 497 buildCounterReopenMatterResponse++; |
| 505 if (buildCounterReopenMatterResponse < 3) { | 498 if (buildCounterReopenMatterResponse < 3) { |
| 506 o.matter = buildMatter(); | 499 o.matter = buildMatter(); |
| 507 } | 500 } |
| 508 buildCounterReopenMatterResponse--; | 501 buildCounterReopenMatterResponse--; |
| 509 return o; | 502 return o; |
| 510 } | 503 } |
| 511 | 504 |
| 512 checkReopenMatterResponse(api.ReopenMatterResponse o) { | 505 checkReopenMatterResponse(api.ReopenMatterResponse o) { |
| 513 buildCounterReopenMatterResponse++; | 506 buildCounterReopenMatterResponse++; |
| 514 if (buildCounterReopenMatterResponse < 3) { | 507 if (buildCounterReopenMatterResponse < 3) { |
| 515 checkMatter(o.matter); | 508 checkMatter(o.matter); |
| 516 } | 509 } |
| 517 buildCounterReopenMatterResponse--; | 510 buildCounterReopenMatterResponse--; |
| 518 } | 511 } |
| 519 | 512 |
| 520 core.int buildCounterUndeleteMatterRequest = 0; | 513 core.int buildCounterUndeleteMatterRequest = 0; |
| 521 buildUndeleteMatterRequest() { | 514 buildUndeleteMatterRequest() { |
| 522 var o = new api.UndeleteMatterRequest(); | 515 var o = new api.UndeleteMatterRequest(); |
| 523 buildCounterUndeleteMatterRequest++; | 516 buildCounterUndeleteMatterRequest++; |
| 524 if (buildCounterUndeleteMatterRequest < 3) { | 517 if (buildCounterUndeleteMatterRequest < 3) {} |
| 525 } | |
| 526 buildCounterUndeleteMatterRequest--; | 518 buildCounterUndeleteMatterRequest--; |
| 527 return o; | 519 return o; |
| 528 } | 520 } |
| 529 | 521 |
| 530 checkUndeleteMatterRequest(api.UndeleteMatterRequest o) { | 522 checkUndeleteMatterRequest(api.UndeleteMatterRequest o) { |
| 531 buildCounterUndeleteMatterRequest++; | 523 buildCounterUndeleteMatterRequest++; |
| 532 if (buildCounterUndeleteMatterRequest < 3) { | 524 if (buildCounterUndeleteMatterRequest < 3) {} |
| 533 } | |
| 534 buildCounterUndeleteMatterRequest--; | 525 buildCounterUndeleteMatterRequest--; |
| 535 } | 526 } |
| 536 | 527 |
| 537 | |
| 538 main() { | 528 main() { |
| 539 unittest.group("obj-schema-AddMatterPermissionsRequest", () { | 529 unittest.group("obj-schema-AddMatterPermissionsRequest", () { |
| 540 unittest.test("to-json--from-json", () { | 530 unittest.test("to-json--from-json", () { |
| 541 var o = buildAddMatterPermissionsRequest(); | 531 var o = buildAddMatterPermissionsRequest(); |
| 542 var od = new api.AddMatterPermissionsRequest.fromJson(o.toJson()); | 532 var od = new api.AddMatterPermissionsRequest.fromJson(o.toJson()); |
| 543 checkAddMatterPermissionsRequest(od); | 533 checkAddMatterPermissionsRequest(od); |
| 544 }); | 534 }); |
| 545 }); | 535 }); |
| 546 | 536 |
| 547 | |
| 548 unittest.group("obj-schema-CloseMatterRequest", () { | 537 unittest.group("obj-schema-CloseMatterRequest", () { |
| 549 unittest.test("to-json--from-json", () { | 538 unittest.test("to-json--from-json", () { |
| 550 var o = buildCloseMatterRequest(); | 539 var o = buildCloseMatterRequest(); |
| 551 var od = new api.CloseMatterRequest.fromJson(o.toJson()); | 540 var od = new api.CloseMatterRequest.fromJson(o.toJson()); |
| 552 checkCloseMatterRequest(od); | 541 checkCloseMatterRequest(od); |
| 553 }); | 542 }); |
| 554 }); | 543 }); |
| 555 | 544 |
| 556 | |
| 557 unittest.group("obj-schema-CloseMatterResponse", () { | 545 unittest.group("obj-schema-CloseMatterResponse", () { |
| 558 unittest.test("to-json--from-json", () { | 546 unittest.test("to-json--from-json", () { |
| 559 var o = buildCloseMatterResponse(); | 547 var o = buildCloseMatterResponse(); |
| 560 var od = new api.CloseMatterResponse.fromJson(o.toJson()); | 548 var od = new api.CloseMatterResponse.fromJson(o.toJson()); |
| 561 checkCloseMatterResponse(od); | 549 checkCloseMatterResponse(od); |
| 562 }); | 550 }); |
| 563 }); | 551 }); |
| 564 | 552 |
| 565 | |
| 566 unittest.group("obj-schema-CorpusQuery", () { | 553 unittest.group("obj-schema-CorpusQuery", () { |
| 567 unittest.test("to-json--from-json", () { | 554 unittest.test("to-json--from-json", () { |
| 568 var o = buildCorpusQuery(); | 555 var o = buildCorpusQuery(); |
| 569 var od = new api.CorpusQuery.fromJson(o.toJson()); | 556 var od = new api.CorpusQuery.fromJson(o.toJson()); |
| 570 checkCorpusQuery(od); | 557 checkCorpusQuery(od); |
| 571 }); | 558 }); |
| 572 }); | 559 }); |
| 573 | 560 |
| 574 | |
| 575 unittest.group("obj-schema-Empty", () { | 561 unittest.group("obj-schema-Empty", () { |
| 576 unittest.test("to-json--from-json", () { | 562 unittest.test("to-json--from-json", () { |
| 577 var o = buildEmpty(); | 563 var o = buildEmpty(); |
| 578 var od = new api.Empty.fromJson(o.toJson()); | 564 var od = new api.Empty.fromJson(o.toJson()); |
| 579 checkEmpty(od); | 565 checkEmpty(od); |
| 580 }); | 566 }); |
| 581 }); | 567 }); |
| 582 | 568 |
| 583 | |
| 584 unittest.group("obj-schema-HeldAccount", () { | 569 unittest.group("obj-schema-HeldAccount", () { |
| 585 unittest.test("to-json--from-json", () { | 570 unittest.test("to-json--from-json", () { |
| 586 var o = buildHeldAccount(); | 571 var o = buildHeldAccount(); |
| 587 var od = new api.HeldAccount.fromJson(o.toJson()); | 572 var od = new api.HeldAccount.fromJson(o.toJson()); |
| 588 checkHeldAccount(od); | 573 checkHeldAccount(od); |
| 589 }); | 574 }); |
| 590 }); | 575 }); |
| 591 | 576 |
| 592 | |
| 593 unittest.group("obj-schema-HeldDriveQuery", () { | 577 unittest.group("obj-schema-HeldDriveQuery", () { |
| 594 unittest.test("to-json--from-json", () { | 578 unittest.test("to-json--from-json", () { |
| 595 var o = buildHeldDriveQuery(); | 579 var o = buildHeldDriveQuery(); |
| 596 var od = new api.HeldDriveQuery.fromJson(o.toJson()); | 580 var od = new api.HeldDriveQuery.fromJson(o.toJson()); |
| 597 checkHeldDriveQuery(od); | 581 checkHeldDriveQuery(od); |
| 598 }); | 582 }); |
| 599 }); | 583 }); |
| 600 | 584 |
| 601 | |
| 602 unittest.group("obj-schema-HeldGroupsQuery", () { | 585 unittest.group("obj-schema-HeldGroupsQuery", () { |
| 603 unittest.test("to-json--from-json", () { | 586 unittest.test("to-json--from-json", () { |
| 604 var o = buildHeldGroupsQuery(); | 587 var o = buildHeldGroupsQuery(); |
| 605 var od = new api.HeldGroupsQuery.fromJson(o.toJson()); | 588 var od = new api.HeldGroupsQuery.fromJson(o.toJson()); |
| 606 checkHeldGroupsQuery(od); | 589 checkHeldGroupsQuery(od); |
| 607 }); | 590 }); |
| 608 }); | 591 }); |
| 609 | 592 |
| 610 | |
| 611 unittest.group("obj-schema-HeldMailQuery", () { | 593 unittest.group("obj-schema-HeldMailQuery", () { |
| 612 unittest.test("to-json--from-json", () { | 594 unittest.test("to-json--from-json", () { |
| 613 var o = buildHeldMailQuery(); | 595 var o = buildHeldMailQuery(); |
| 614 var od = new api.HeldMailQuery.fromJson(o.toJson()); | 596 var od = new api.HeldMailQuery.fromJson(o.toJson()); |
| 615 checkHeldMailQuery(od); | 597 checkHeldMailQuery(od); |
| 616 }); | 598 }); |
| 617 }); | 599 }); |
| 618 | 600 |
| 619 | |
| 620 unittest.group("obj-schema-HeldOrgUnit", () { | 601 unittest.group("obj-schema-HeldOrgUnit", () { |
| 621 unittest.test("to-json--from-json", () { | 602 unittest.test("to-json--from-json", () { |
| 622 var o = buildHeldOrgUnit(); | 603 var o = buildHeldOrgUnit(); |
| 623 var od = new api.HeldOrgUnit.fromJson(o.toJson()); | 604 var od = new api.HeldOrgUnit.fromJson(o.toJson()); |
| 624 checkHeldOrgUnit(od); | 605 checkHeldOrgUnit(od); |
| 625 }); | 606 }); |
| 626 }); | 607 }); |
| 627 | 608 |
| 628 | |
| 629 unittest.group("obj-schema-Hold", () { | 609 unittest.group("obj-schema-Hold", () { |
| 630 unittest.test("to-json--from-json", () { | 610 unittest.test("to-json--from-json", () { |
| 631 var o = buildHold(); | 611 var o = buildHold(); |
| 632 var od = new api.Hold.fromJson(o.toJson()); | 612 var od = new api.Hold.fromJson(o.toJson()); |
| 633 checkHold(od); | 613 checkHold(od); |
| 634 }); | 614 }); |
| 635 }); | 615 }); |
| 636 | 616 |
| 637 | |
| 638 unittest.group("obj-schema-ListHeldAccountsResponse", () { | 617 unittest.group("obj-schema-ListHeldAccountsResponse", () { |
| 639 unittest.test("to-json--from-json", () { | 618 unittest.test("to-json--from-json", () { |
| 640 var o = buildListHeldAccountsResponse(); | 619 var o = buildListHeldAccountsResponse(); |
| 641 var od = new api.ListHeldAccountsResponse.fromJson(o.toJson()); | 620 var od = new api.ListHeldAccountsResponse.fromJson(o.toJson()); |
| 642 checkListHeldAccountsResponse(od); | 621 checkListHeldAccountsResponse(od); |
| 643 }); | 622 }); |
| 644 }); | 623 }); |
| 645 | 624 |
| 646 | |
| 647 unittest.group("obj-schema-ListHoldsResponse", () { | 625 unittest.group("obj-schema-ListHoldsResponse", () { |
| 648 unittest.test("to-json--from-json", () { | 626 unittest.test("to-json--from-json", () { |
| 649 var o = buildListHoldsResponse(); | 627 var o = buildListHoldsResponse(); |
| 650 var od = new api.ListHoldsResponse.fromJson(o.toJson()); | 628 var od = new api.ListHoldsResponse.fromJson(o.toJson()); |
| 651 checkListHoldsResponse(od); | 629 checkListHoldsResponse(od); |
| 652 }); | 630 }); |
| 653 }); | 631 }); |
| 654 | 632 |
| 655 | |
| 656 unittest.group("obj-schema-ListMattersResponse", () { | 633 unittest.group("obj-schema-ListMattersResponse", () { |
| 657 unittest.test("to-json--from-json", () { | 634 unittest.test("to-json--from-json", () { |
| 658 var o = buildListMattersResponse(); | 635 var o = buildListMattersResponse(); |
| 659 var od = new api.ListMattersResponse.fromJson(o.toJson()); | 636 var od = new api.ListMattersResponse.fromJson(o.toJson()); |
| 660 checkListMattersResponse(od); | 637 checkListMattersResponse(od); |
| 661 }); | 638 }); |
| 662 }); | 639 }); |
| 663 | 640 |
| 664 | |
| 665 unittest.group("obj-schema-Matter", () { | 641 unittest.group("obj-schema-Matter", () { |
| 666 unittest.test("to-json--from-json", () { | 642 unittest.test("to-json--from-json", () { |
| 667 var o = buildMatter(); | 643 var o = buildMatter(); |
| 668 var od = new api.Matter.fromJson(o.toJson()); | 644 var od = new api.Matter.fromJson(o.toJson()); |
| 669 checkMatter(od); | 645 checkMatter(od); |
| 670 }); | 646 }); |
| 671 }); | 647 }); |
| 672 | 648 |
| 673 | |
| 674 unittest.group("obj-schema-MatterPermission", () { | 649 unittest.group("obj-schema-MatterPermission", () { |
| 675 unittest.test("to-json--from-json", () { | 650 unittest.test("to-json--from-json", () { |
| 676 var o = buildMatterPermission(); | 651 var o = buildMatterPermission(); |
| 677 var od = new api.MatterPermission.fromJson(o.toJson()); | 652 var od = new api.MatterPermission.fromJson(o.toJson()); |
| 678 checkMatterPermission(od); | 653 checkMatterPermission(od); |
| 679 }); | 654 }); |
| 680 }); | 655 }); |
| 681 | 656 |
| 682 | |
| 683 unittest.group("obj-schema-RemoveMatterPermissionsRequest", () { | 657 unittest.group("obj-schema-RemoveMatterPermissionsRequest", () { |
| 684 unittest.test("to-json--from-json", () { | 658 unittest.test("to-json--from-json", () { |
| 685 var o = buildRemoveMatterPermissionsRequest(); | 659 var o = buildRemoveMatterPermissionsRequest(); |
| 686 var od = new api.RemoveMatterPermissionsRequest.fromJson(o.toJson()); | 660 var od = new api.RemoveMatterPermissionsRequest.fromJson(o.toJson()); |
| 687 checkRemoveMatterPermissionsRequest(od); | 661 checkRemoveMatterPermissionsRequest(od); |
| 688 }); | 662 }); |
| 689 }); | 663 }); |
| 690 | 664 |
| 691 | |
| 692 unittest.group("obj-schema-ReopenMatterRequest", () { | 665 unittest.group("obj-schema-ReopenMatterRequest", () { |
| 693 unittest.test("to-json--from-json", () { | 666 unittest.test("to-json--from-json", () { |
| 694 var o = buildReopenMatterRequest(); | 667 var o = buildReopenMatterRequest(); |
| 695 var od = new api.ReopenMatterRequest.fromJson(o.toJson()); | 668 var od = new api.ReopenMatterRequest.fromJson(o.toJson()); |
| 696 checkReopenMatterRequest(od); | 669 checkReopenMatterRequest(od); |
| 697 }); | 670 }); |
| 698 }); | 671 }); |
| 699 | 672 |
| 700 | |
| 701 unittest.group("obj-schema-ReopenMatterResponse", () { | 673 unittest.group("obj-schema-ReopenMatterResponse", () { |
| 702 unittest.test("to-json--from-json", () { | 674 unittest.test("to-json--from-json", () { |
| 703 var o = buildReopenMatterResponse(); | 675 var o = buildReopenMatterResponse(); |
| 704 var od = new api.ReopenMatterResponse.fromJson(o.toJson()); | 676 var od = new api.ReopenMatterResponse.fromJson(o.toJson()); |
| 705 checkReopenMatterResponse(od); | 677 checkReopenMatterResponse(od); |
| 706 }); | 678 }); |
| 707 }); | 679 }); |
| 708 | 680 |
| 709 | |
| 710 unittest.group("obj-schema-UndeleteMatterRequest", () { | 681 unittest.group("obj-schema-UndeleteMatterRequest", () { |
| 711 unittest.test("to-json--from-json", () { | 682 unittest.test("to-json--from-json", () { |
| 712 var o = buildUndeleteMatterRequest(); | 683 var o = buildUndeleteMatterRequest(); |
| 713 var od = new api.UndeleteMatterRequest.fromJson(o.toJson()); | 684 var od = new api.UndeleteMatterRequest.fromJson(o.toJson()); |
| 714 checkUndeleteMatterRequest(od); | 685 checkUndeleteMatterRequest(od); |
| 715 }); | 686 }); |
| 716 }); | 687 }); |
| 717 | 688 |
| 718 | |
| 719 unittest.group("resource-MattersResourceApi", () { | 689 unittest.group("resource-MattersResourceApi", () { |
| 720 unittest.test("method--addPermissions", () { | 690 unittest.test("method--addPermissions", () { |
| 721 | |
| 722 var mock = new HttpServerMock(); | 691 var mock = new HttpServerMock(); |
| 723 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 692 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 724 var arg_request = buildAddMatterPermissionsRequest(); | 693 var arg_request = buildAddMatterPermissionsRequest(); |
| 725 var arg_matterId = "foo"; | 694 var arg_matterId = "foo"; |
| 726 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 695 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 727 var obj = new api.AddMatterPermissionsRequest.fromJson(json); | 696 var obj = new api.AddMatterPermissionsRequest.fromJson(json); |
| 728 checkAddMatterPermissionsRequest(obj); | 697 checkAddMatterPermissionsRequest(obj); |
| 729 | 698 |
| 730 var path = (req.url).path; | 699 var path = (req.url).path; |
| 731 var pathOffset = 0; | 700 var pathOffset = 0; |
| 732 var index; | 701 var index; |
| 733 var subPart; | 702 var subPart; |
| 734 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 703 unittest.expect( |
| 704 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 735 pathOffset += 1; | 705 pathOffset += 1; |
| 736 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 706 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 707 unittest.equals("v1/matters/")); |
| 737 pathOffset += 11; | 708 pathOffset += 11; |
| 738 index = path.indexOf(":addPermissions", pathOffset); | 709 index = path.indexOf(":addPermissions", pathOffset); |
| 739 unittest.expect(index >= 0, unittest.isTrue); | 710 unittest.expect(index >= 0, unittest.isTrue); |
| 740 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 711 subPart = |
| 712 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 741 pathOffset = index; | 713 pathOffset = index; |
| 742 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 714 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 743 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals(":addPermissions")); | 715 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 716 unittest.equals(":addPermissions")); |
| 744 pathOffset += 15; | 717 pathOffset += 15; |
| 745 | 718 |
| 746 var query = (req.url).query; | 719 var query = (req.url).query; |
| 747 var queryOffset = 0; | 720 var queryOffset = 0; |
| 748 var queryMap = {}; | 721 var queryMap = {}; |
| 749 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 722 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 750 parseBool(n) { | 723 parseBool(n) { |
| 751 if (n == "true") return true; | 724 if (n == "true") return true; |
| 752 if (n == "false") return false; | 725 if (n == "false") return false; |
| 753 if (n == null) return null; | 726 if (n == null) return null; |
| 754 throw new core.ArgumentError("Invalid boolean: $n"); | 727 throw new core.ArgumentError("Invalid boolean: $n"); |
| 755 } | 728 } |
| 729 |
| 756 if (query.length > 0) { | 730 if (query.length > 0) { |
| 757 for (var part in query.split("&")) { | 731 for (var part in query.split("&")) { |
| 758 var keyvalue = part.split("="); | 732 var keyvalue = part.split("="); |
| 759 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 733 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 734 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 760 } | 735 } |
| 761 } | 736 } |
| 762 | 737 |
| 763 | |
| 764 var h = { | 738 var h = { |
| 765 "content-type" : "application/json; charset=utf-8", | 739 "content-type": "application/json; charset=utf-8", |
| 766 }; | 740 }; |
| 767 var resp = convert.JSON.encode(buildMatterPermission()); | 741 var resp = convert.JSON.encode(buildMatterPermission()); |
| 768 return new async.Future.value(stringResponse(200, h, resp)); | 742 return new async.Future.value(stringResponse(200, h, resp)); |
| 769 }), true); | 743 }), true); |
| 770 res.addPermissions(arg_request, arg_matterId).then(unittest.expectAsync1((
(api.MatterPermission response) { | 744 res |
| 745 .addPermissions(arg_request, arg_matterId) |
| 746 .then(unittest.expectAsync1(((api.MatterPermission response) { |
| 771 checkMatterPermission(response); | 747 checkMatterPermission(response); |
| 772 }))); | 748 }))); |
| 773 }); | 749 }); |
| 774 | 750 |
| 775 unittest.test("method--close", () { | 751 unittest.test("method--close", () { |
| 776 | |
| 777 var mock = new HttpServerMock(); | 752 var mock = new HttpServerMock(); |
| 778 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 753 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 779 var arg_request = buildCloseMatterRequest(); | 754 var arg_request = buildCloseMatterRequest(); |
| 780 var arg_matterId = "foo"; | 755 var arg_matterId = "foo"; |
| 781 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 756 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 782 var obj = new api.CloseMatterRequest.fromJson(json); | 757 var obj = new api.CloseMatterRequest.fromJson(json); |
| 783 checkCloseMatterRequest(obj); | 758 checkCloseMatterRequest(obj); |
| 784 | 759 |
| 785 var path = (req.url).path; | 760 var path = (req.url).path; |
| 786 var pathOffset = 0; | 761 var pathOffset = 0; |
| 787 var index; | 762 var index; |
| 788 var subPart; | 763 var subPart; |
| 789 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 764 unittest.expect( |
| 765 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 790 pathOffset += 1; | 766 pathOffset += 1; |
| 791 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 767 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 768 unittest.equals("v1/matters/")); |
| 792 pathOffset += 11; | 769 pathOffset += 11; |
| 793 index = path.indexOf(":close", pathOffset); | 770 index = path.indexOf(":close", pathOffset); |
| 794 unittest.expect(index >= 0, unittest.isTrue); | 771 unittest.expect(index >= 0, unittest.isTrue); |
| 795 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 772 subPart = |
| 773 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 796 pathOffset = index; | 774 pathOffset = index; |
| 797 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 775 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 798 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als(":close")); | 776 unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| 777 unittest.equals(":close")); |
| 799 pathOffset += 6; | 778 pathOffset += 6; |
| 800 | 779 |
| 801 var query = (req.url).query; | 780 var query = (req.url).query; |
| 802 var queryOffset = 0; | 781 var queryOffset = 0; |
| 803 var queryMap = {}; | 782 var queryMap = {}; |
| 804 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 783 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 805 parseBool(n) { | 784 parseBool(n) { |
| 806 if (n == "true") return true; | 785 if (n == "true") return true; |
| 807 if (n == "false") return false; | 786 if (n == "false") return false; |
| 808 if (n == null) return null; | 787 if (n == null) return null; |
| 809 throw new core.ArgumentError("Invalid boolean: $n"); | 788 throw new core.ArgumentError("Invalid boolean: $n"); |
| 810 } | 789 } |
| 790 |
| 811 if (query.length > 0) { | 791 if (query.length > 0) { |
| 812 for (var part in query.split("&")) { | 792 for (var part in query.split("&")) { |
| 813 var keyvalue = part.split("="); | 793 var keyvalue = part.split("="); |
| 814 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 794 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 795 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 815 } | 796 } |
| 816 } | 797 } |
| 817 | 798 |
| 818 | |
| 819 var h = { | 799 var h = { |
| 820 "content-type" : "application/json; charset=utf-8", | 800 "content-type": "application/json; charset=utf-8", |
| 821 }; | 801 }; |
| 822 var resp = convert.JSON.encode(buildCloseMatterResponse()); | 802 var resp = convert.JSON.encode(buildCloseMatterResponse()); |
| 823 return new async.Future.value(stringResponse(200, h, resp)); | 803 return new async.Future.value(stringResponse(200, h, resp)); |
| 824 }), true); | 804 }), true); |
| 825 res.close(arg_request, arg_matterId).then(unittest.expectAsync1(((api.Clos
eMatterResponse response) { | 805 res |
| 806 .close(arg_request, arg_matterId) |
| 807 .then(unittest.expectAsync1(((api.CloseMatterResponse response) { |
| 826 checkCloseMatterResponse(response); | 808 checkCloseMatterResponse(response); |
| 827 }))); | 809 }))); |
| 828 }); | 810 }); |
| 829 | 811 |
| 830 unittest.test("method--create", () { | 812 unittest.test("method--create", () { |
| 831 | |
| 832 var mock = new HttpServerMock(); | 813 var mock = new HttpServerMock(); |
| 833 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 814 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 834 var arg_request = buildMatter(); | 815 var arg_request = buildMatter(); |
| 835 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 816 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 836 var obj = new api.Matter.fromJson(json); | 817 var obj = new api.Matter.fromJson(json); |
| 837 checkMatter(obj); | 818 checkMatter(obj); |
| 838 | 819 |
| 839 var path = (req.url).path; | 820 var path = (req.url).path; |
| 840 var pathOffset = 0; | 821 var pathOffset = 0; |
| 841 var index; | 822 var index; |
| 842 var subPart; | 823 var subPart; |
| 843 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 824 unittest.expect( |
| 825 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 844 pathOffset += 1; | 826 pathOffset += 1; |
| 845 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("v1/matters")); | 827 unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| 828 unittest.equals("v1/matters")); |
| 846 pathOffset += 10; | 829 pathOffset += 10; |
| 847 | 830 |
| 848 var query = (req.url).query; | 831 var query = (req.url).query; |
| 849 var queryOffset = 0; | 832 var queryOffset = 0; |
| 850 var queryMap = {}; | 833 var queryMap = {}; |
| 851 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 834 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 852 parseBool(n) { | 835 parseBool(n) { |
| 853 if (n == "true") return true; | 836 if (n == "true") return true; |
| 854 if (n == "false") return false; | 837 if (n == "false") return false; |
| 855 if (n == null) return null; | 838 if (n == null) return null; |
| 856 throw new core.ArgumentError("Invalid boolean: $n"); | 839 throw new core.ArgumentError("Invalid boolean: $n"); |
| 857 } | 840 } |
| 841 |
| 858 if (query.length > 0) { | 842 if (query.length > 0) { |
| 859 for (var part in query.split("&")) { | 843 for (var part in query.split("&")) { |
| 860 var keyvalue = part.split("="); | 844 var keyvalue = part.split("="); |
| 861 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 845 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 846 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 862 } | 847 } |
| 863 } | 848 } |
| 864 | 849 |
| 865 | |
| 866 var h = { | 850 var h = { |
| 867 "content-type" : "application/json; charset=utf-8", | 851 "content-type": "application/json; charset=utf-8", |
| 868 }; | 852 }; |
| 869 var resp = convert.JSON.encode(buildMatter()); | 853 var resp = convert.JSON.encode(buildMatter()); |
| 870 return new async.Future.value(stringResponse(200, h, resp)); | 854 return new async.Future.value(stringResponse(200, h, resp)); |
| 871 }), true); | 855 }), true); |
| 872 res.create(arg_request).then(unittest.expectAsync1(((api.Matter response)
{ | 856 res |
| 857 .create(arg_request) |
| 858 .then(unittest.expectAsync1(((api.Matter response) { |
| 873 checkMatter(response); | 859 checkMatter(response); |
| 874 }))); | 860 }))); |
| 875 }); | 861 }); |
| 876 | 862 |
| 877 unittest.test("method--delete", () { | 863 unittest.test("method--delete", () { |
| 878 | |
| 879 var mock = new HttpServerMock(); | 864 var mock = new HttpServerMock(); |
| 880 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 865 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 881 var arg_matterId = "foo"; | 866 var arg_matterId = "foo"; |
| 882 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 867 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 883 var path = (req.url).path; | 868 var path = (req.url).path; |
| 884 var pathOffset = 0; | 869 var pathOffset = 0; |
| 885 var index; | 870 var index; |
| 886 var subPart; | 871 var subPart; |
| 887 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 872 unittest.expect( |
| 873 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 888 pathOffset += 1; | 874 pathOffset += 1; |
| 889 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 875 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 876 unittest.equals("v1/matters/")); |
| 890 pathOffset += 11; | 877 pathOffset += 11; |
| 891 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 878 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 892 pathOffset = path.length; | 879 pathOffset = path.length; |
| 893 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 880 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 894 | 881 |
| 895 var query = (req.url).query; | 882 var query = (req.url).query; |
| 896 var queryOffset = 0; | 883 var queryOffset = 0; |
| 897 var queryMap = {}; | 884 var queryMap = {}; |
| 898 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 885 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 899 parseBool(n) { | 886 parseBool(n) { |
| 900 if (n == "true") return true; | 887 if (n == "true") return true; |
| 901 if (n == "false") return false; | 888 if (n == "false") return false; |
| 902 if (n == null) return null; | 889 if (n == null) return null; |
| 903 throw new core.ArgumentError("Invalid boolean: $n"); | 890 throw new core.ArgumentError("Invalid boolean: $n"); |
| 904 } | 891 } |
| 892 |
| 905 if (query.length > 0) { | 893 if (query.length > 0) { |
| 906 for (var part in query.split("&")) { | 894 for (var part in query.split("&")) { |
| 907 var keyvalue = part.split("="); | 895 var keyvalue = part.split("="); |
| 908 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 896 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 897 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 909 } | 898 } |
| 910 } | 899 } |
| 911 | 900 |
| 912 | |
| 913 var h = { | 901 var h = { |
| 914 "content-type" : "application/json; charset=utf-8", | 902 "content-type": "application/json; charset=utf-8", |
| 915 }; | 903 }; |
| 916 var resp = convert.JSON.encode(buildMatter()); | 904 var resp = convert.JSON.encode(buildMatter()); |
| 917 return new async.Future.value(stringResponse(200, h, resp)); | 905 return new async.Future.value(stringResponse(200, h, resp)); |
| 918 }), true); | 906 }), true); |
| 919 res.delete(arg_matterId).then(unittest.expectAsync1(((api.Matter response)
{ | 907 res |
| 908 .delete(arg_matterId) |
| 909 .then(unittest.expectAsync1(((api.Matter response) { |
| 920 checkMatter(response); | 910 checkMatter(response); |
| 921 }))); | 911 }))); |
| 922 }); | 912 }); |
| 923 | 913 |
| 924 unittest.test("method--get", () { | 914 unittest.test("method--get", () { |
| 925 | |
| 926 var mock = new HttpServerMock(); | 915 var mock = new HttpServerMock(); |
| 927 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 916 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 928 var arg_matterId = "foo"; | 917 var arg_matterId = "foo"; |
| 929 var arg_view = "foo"; | 918 var arg_view = "foo"; |
| 930 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 919 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 931 var path = (req.url).path; | 920 var path = (req.url).path; |
| 932 var pathOffset = 0; | 921 var pathOffset = 0; |
| 933 var index; | 922 var index; |
| 934 var subPart; | 923 var subPart; |
| 935 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 924 unittest.expect( |
| 925 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 936 pathOffset += 1; | 926 pathOffset += 1; |
| 937 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 927 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 928 unittest.equals("v1/matters/")); |
| 938 pathOffset += 11; | 929 pathOffset += 11; |
| 939 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 930 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 940 pathOffset = path.length; | 931 pathOffset = path.length; |
| 941 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 932 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 942 | 933 |
| 943 var query = (req.url).query; | 934 var query = (req.url).query; |
| 944 var queryOffset = 0; | 935 var queryOffset = 0; |
| 945 var queryMap = {}; | 936 var queryMap = {}; |
| 946 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 937 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 947 parseBool(n) { | 938 parseBool(n) { |
| 948 if (n == "true") return true; | 939 if (n == "true") return true; |
| 949 if (n == "false") return false; | 940 if (n == "false") return false; |
| 950 if (n == null) return null; | 941 if (n == null) return null; |
| 951 throw new core.ArgumentError("Invalid boolean: $n"); | 942 throw new core.ArgumentError("Invalid boolean: $n"); |
| 952 } | 943 } |
| 944 |
| 953 if (query.length > 0) { | 945 if (query.length > 0) { |
| 954 for (var part in query.split("&")) { | 946 for (var part in query.split("&")) { |
| 955 var keyvalue = part.split("="); | 947 var keyvalue = part.split("="); |
| 956 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 948 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 949 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 957 } | 950 } |
| 958 } | 951 } |
| 959 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); | 952 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
| 960 | 953 |
| 961 | |
| 962 var h = { | 954 var h = { |
| 963 "content-type" : "application/json; charset=utf-8", | 955 "content-type": "application/json; charset=utf-8", |
| 964 }; | 956 }; |
| 965 var resp = convert.JSON.encode(buildMatter()); | 957 var resp = convert.JSON.encode(buildMatter()); |
| 966 return new async.Future.value(stringResponse(200, h, resp)); | 958 return new async.Future.value(stringResponse(200, h, resp)); |
| 967 }), true); | 959 }), true); |
| 968 res.get(arg_matterId, view: arg_view).then(unittest.expectAsync1(((api.Mat
ter response) { | 960 res |
| 961 .get(arg_matterId, view: arg_view) |
| 962 .then(unittest.expectAsync1(((api.Matter response) { |
| 969 checkMatter(response); | 963 checkMatter(response); |
| 970 }))); | 964 }))); |
| 971 }); | 965 }); |
| 972 | 966 |
| 973 unittest.test("method--list", () { | 967 unittest.test("method--list", () { |
| 974 | |
| 975 var mock = new HttpServerMock(); | 968 var mock = new HttpServerMock(); |
| 976 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 969 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 977 var arg_pageToken = "foo"; | 970 var arg_pageToken = "foo"; |
| 978 var arg_pageSize = 42; | 971 var arg_pageSize = 42; |
| 979 var arg_view = "foo"; | 972 var arg_view = "foo"; |
| 980 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 973 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 981 var path = (req.url).path; | 974 var path = (req.url).path; |
| 982 var pathOffset = 0; | 975 var pathOffset = 0; |
| 983 var index; | 976 var index; |
| 984 var subPart; | 977 var subPart; |
| 985 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 978 unittest.expect( |
| 979 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 986 pathOffset += 1; | 980 pathOffset += 1; |
| 987 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("v1/matters")); | 981 unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| 982 unittest.equals("v1/matters")); |
| 988 pathOffset += 10; | 983 pathOffset += 10; |
| 989 | 984 |
| 990 var query = (req.url).query; | 985 var query = (req.url).query; |
| 991 var queryOffset = 0; | 986 var queryOffset = 0; |
| 992 var queryMap = {}; | 987 var queryMap = {}; |
| 993 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 988 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 994 parseBool(n) { | 989 parseBool(n) { |
| 995 if (n == "true") return true; | 990 if (n == "true") return true; |
| 996 if (n == "false") return false; | 991 if (n == "false") return false; |
| 997 if (n == null) return null; | 992 if (n == null) return null; |
| 998 throw new core.ArgumentError("Invalid boolean: $n"); | 993 throw new core.ArgumentError("Invalid boolean: $n"); |
| 999 } | 994 } |
| 995 |
| 1000 if (query.length > 0) { | 996 if (query.length > 0) { |
| 1001 for (var part in query.split("&")) { | 997 for (var part in query.split("&")) { |
| 1002 var keyvalue = part.split("="); | 998 var keyvalue = part.split("="); |
| 1003 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 999 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1000 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1004 } | 1001 } |
| 1005 } | 1002 } |
| 1006 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1003 unittest.expect( |
| 1007 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1004 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 1005 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1006 unittest.equals(arg_pageSize)); |
| 1008 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); | 1007 unittest.expect(queryMap["view"].first, unittest.equals(arg_view)); |
| 1009 | 1008 |
| 1010 | |
| 1011 var h = { | 1009 var h = { |
| 1012 "content-type" : "application/json; charset=utf-8", | 1010 "content-type": "application/json; charset=utf-8", |
| 1013 }; | 1011 }; |
| 1014 var resp = convert.JSON.encode(buildListMattersResponse()); | 1012 var resp = convert.JSON.encode(buildListMattersResponse()); |
| 1015 return new async.Future.value(stringResponse(200, h, resp)); | 1013 return new async.Future.value(stringResponse(200, h, resp)); |
| 1016 }), true); | 1014 }), true); |
| 1017 res.list(pageToken: arg_pageToken, pageSize: arg_pageSize, view: arg_view)
.then(unittest.expectAsync1(((api.ListMattersResponse response) { | 1015 res |
| 1016 .list( |
| 1017 pageToken: arg_pageToken, pageSize: arg_pageSize, view: arg_view) |
| 1018 .then(unittest.expectAsync1(((api.ListMattersResponse response) { |
| 1018 checkListMattersResponse(response); | 1019 checkListMattersResponse(response); |
| 1019 }))); | 1020 }))); |
| 1020 }); | 1021 }); |
| 1021 | 1022 |
| 1022 unittest.test("method--removePermissions", () { | 1023 unittest.test("method--removePermissions", () { |
| 1023 | |
| 1024 var mock = new HttpServerMock(); | 1024 var mock = new HttpServerMock(); |
| 1025 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 1025 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 1026 var arg_request = buildRemoveMatterPermissionsRequest(); | 1026 var arg_request = buildRemoveMatterPermissionsRequest(); |
| 1027 var arg_matterId = "foo"; | 1027 var arg_matterId = "foo"; |
| 1028 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1028 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1029 var obj = new api.RemoveMatterPermissionsRequest.fromJson(json); | 1029 var obj = new api.RemoveMatterPermissionsRequest.fromJson(json); |
| 1030 checkRemoveMatterPermissionsRequest(obj); | 1030 checkRemoveMatterPermissionsRequest(obj); |
| 1031 | 1031 |
| 1032 var path = (req.url).path; | 1032 var path = (req.url).path; |
| 1033 var pathOffset = 0; | 1033 var pathOffset = 0; |
| 1034 var index; | 1034 var index; |
| 1035 var subPart; | 1035 var subPart; |
| 1036 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1036 unittest.expect( |
| 1037 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1037 pathOffset += 1; | 1038 pathOffset += 1; |
| 1038 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1039 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1040 unittest.equals("v1/matters/")); |
| 1039 pathOffset += 11; | 1041 pathOffset += 11; |
| 1040 index = path.indexOf(":removePermissions", pathOffset); | 1042 index = path.indexOf(":removePermissions", pathOffset); |
| 1041 unittest.expect(index >= 0, unittest.isTrue); | 1043 unittest.expect(index >= 0, unittest.isTrue); |
| 1042 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1044 subPart = |
| 1045 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1043 pathOffset = index; | 1046 pathOffset = index; |
| 1044 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1047 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1045 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals(":removePermissions")); | 1048 unittest.expect(path.substring(pathOffset, pathOffset + 18), |
| 1049 unittest.equals(":removePermissions")); |
| 1046 pathOffset += 18; | 1050 pathOffset += 18; |
| 1047 | 1051 |
| 1048 var query = (req.url).query; | 1052 var query = (req.url).query; |
| 1049 var queryOffset = 0; | 1053 var queryOffset = 0; |
| 1050 var queryMap = {}; | 1054 var queryMap = {}; |
| 1051 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1055 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1052 parseBool(n) { | 1056 parseBool(n) { |
| 1053 if (n == "true") return true; | 1057 if (n == "true") return true; |
| 1054 if (n == "false") return false; | 1058 if (n == "false") return false; |
| 1055 if (n == null) return null; | 1059 if (n == null) return null; |
| 1056 throw new core.ArgumentError("Invalid boolean: $n"); | 1060 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1057 } | 1061 } |
| 1062 |
| 1058 if (query.length > 0) { | 1063 if (query.length > 0) { |
| 1059 for (var part in query.split("&")) { | 1064 for (var part in query.split("&")) { |
| 1060 var keyvalue = part.split("="); | 1065 var keyvalue = part.split("="); |
| 1061 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1066 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1067 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1062 } | 1068 } |
| 1063 } | 1069 } |
| 1064 | 1070 |
| 1065 | |
| 1066 var h = { | 1071 var h = { |
| 1067 "content-type" : "application/json; charset=utf-8", | 1072 "content-type": "application/json; charset=utf-8", |
| 1068 }; | 1073 }; |
| 1069 var resp = convert.JSON.encode(buildEmpty()); | 1074 var resp = convert.JSON.encode(buildEmpty()); |
| 1070 return new async.Future.value(stringResponse(200, h, resp)); | 1075 return new async.Future.value(stringResponse(200, h, resp)); |
| 1071 }), true); | 1076 }), true); |
| 1072 res.removePermissions(arg_request, arg_matterId).then(unittest.expectAsync
1(((api.Empty response) { | 1077 res |
| 1078 .removePermissions(arg_request, arg_matterId) |
| 1079 .then(unittest.expectAsync1(((api.Empty response) { |
| 1073 checkEmpty(response); | 1080 checkEmpty(response); |
| 1074 }))); | 1081 }))); |
| 1075 }); | 1082 }); |
| 1076 | 1083 |
| 1077 unittest.test("method--reopen", () { | 1084 unittest.test("method--reopen", () { |
| 1078 | |
| 1079 var mock = new HttpServerMock(); | 1085 var mock = new HttpServerMock(); |
| 1080 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 1086 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 1081 var arg_request = buildReopenMatterRequest(); | 1087 var arg_request = buildReopenMatterRequest(); |
| 1082 var arg_matterId = "foo"; | 1088 var arg_matterId = "foo"; |
| 1083 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1089 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1084 var obj = new api.ReopenMatterRequest.fromJson(json); | 1090 var obj = new api.ReopenMatterRequest.fromJson(json); |
| 1085 checkReopenMatterRequest(obj); | 1091 checkReopenMatterRequest(obj); |
| 1086 | 1092 |
| 1087 var path = (req.url).path; | 1093 var path = (req.url).path; |
| 1088 var pathOffset = 0; | 1094 var pathOffset = 0; |
| 1089 var index; | 1095 var index; |
| 1090 var subPart; | 1096 var subPart; |
| 1091 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1097 unittest.expect( |
| 1098 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1092 pathOffset += 1; | 1099 pathOffset += 1; |
| 1093 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1100 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1101 unittest.equals("v1/matters/")); |
| 1094 pathOffset += 11; | 1102 pathOffset += 11; |
| 1095 index = path.indexOf(":reopen", pathOffset); | 1103 index = path.indexOf(":reopen", pathOffset); |
| 1096 unittest.expect(index >= 0, unittest.isTrue); | 1104 unittest.expect(index >= 0, unittest.isTrue); |
| 1097 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1105 subPart = |
| 1106 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1098 pathOffset = index; | 1107 pathOffset = index; |
| 1099 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1108 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1100 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als(":reopen")); | 1109 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1110 unittest.equals(":reopen")); |
| 1101 pathOffset += 7; | 1111 pathOffset += 7; |
| 1102 | 1112 |
| 1103 var query = (req.url).query; | 1113 var query = (req.url).query; |
| 1104 var queryOffset = 0; | 1114 var queryOffset = 0; |
| 1105 var queryMap = {}; | 1115 var queryMap = {}; |
| 1106 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1116 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1107 parseBool(n) { | 1117 parseBool(n) { |
| 1108 if (n == "true") return true; | 1118 if (n == "true") return true; |
| 1109 if (n == "false") return false; | 1119 if (n == "false") return false; |
| 1110 if (n == null) return null; | 1120 if (n == null) return null; |
| 1111 throw new core.ArgumentError("Invalid boolean: $n"); | 1121 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1112 } | 1122 } |
| 1123 |
| 1113 if (query.length > 0) { | 1124 if (query.length > 0) { |
| 1114 for (var part in query.split("&")) { | 1125 for (var part in query.split("&")) { |
| 1115 var keyvalue = part.split("="); | 1126 var keyvalue = part.split("="); |
| 1116 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1127 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1128 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1117 } | 1129 } |
| 1118 } | 1130 } |
| 1119 | 1131 |
| 1120 | |
| 1121 var h = { | 1132 var h = { |
| 1122 "content-type" : "application/json; charset=utf-8", | 1133 "content-type": "application/json; charset=utf-8", |
| 1123 }; | 1134 }; |
| 1124 var resp = convert.JSON.encode(buildReopenMatterResponse()); | 1135 var resp = convert.JSON.encode(buildReopenMatterResponse()); |
| 1125 return new async.Future.value(stringResponse(200, h, resp)); | 1136 return new async.Future.value(stringResponse(200, h, resp)); |
| 1126 }), true); | 1137 }), true); |
| 1127 res.reopen(arg_request, arg_matterId).then(unittest.expectAsync1(((api.Reo
penMatterResponse response) { | 1138 res |
| 1139 .reopen(arg_request, arg_matterId) |
| 1140 .then(unittest.expectAsync1(((api.ReopenMatterResponse response) { |
| 1128 checkReopenMatterResponse(response); | 1141 checkReopenMatterResponse(response); |
| 1129 }))); | 1142 }))); |
| 1130 }); | 1143 }); |
| 1131 | 1144 |
| 1132 unittest.test("method--undelete", () { | 1145 unittest.test("method--undelete", () { |
| 1133 | |
| 1134 var mock = new HttpServerMock(); | 1146 var mock = new HttpServerMock(); |
| 1135 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 1147 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 1136 var arg_request = buildUndeleteMatterRequest(); | 1148 var arg_request = buildUndeleteMatterRequest(); |
| 1137 var arg_matterId = "foo"; | 1149 var arg_matterId = "foo"; |
| 1138 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1150 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1139 var obj = new api.UndeleteMatterRequest.fromJson(json); | 1151 var obj = new api.UndeleteMatterRequest.fromJson(json); |
| 1140 checkUndeleteMatterRequest(obj); | 1152 checkUndeleteMatterRequest(obj); |
| 1141 | 1153 |
| 1142 var path = (req.url).path; | 1154 var path = (req.url).path; |
| 1143 var pathOffset = 0; | 1155 var pathOffset = 0; |
| 1144 var index; | 1156 var index; |
| 1145 var subPart; | 1157 var subPart; |
| 1146 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1158 unittest.expect( |
| 1159 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1147 pathOffset += 1; | 1160 pathOffset += 1; |
| 1148 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1161 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1162 unittest.equals("v1/matters/")); |
| 1149 pathOffset += 11; | 1163 pathOffset += 11; |
| 1150 index = path.indexOf(":undelete", pathOffset); | 1164 index = path.indexOf(":undelete", pathOffset); |
| 1151 unittest.expect(index >= 0, unittest.isTrue); | 1165 unittest.expect(index >= 0, unittest.isTrue); |
| 1152 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1166 subPart = |
| 1167 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1153 pathOffset = index; | 1168 pathOffset = index; |
| 1154 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1169 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1155 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als(":undelete")); | 1170 unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| 1171 unittest.equals(":undelete")); |
| 1156 pathOffset += 9; | 1172 pathOffset += 9; |
| 1157 | 1173 |
| 1158 var query = (req.url).query; | 1174 var query = (req.url).query; |
| 1159 var queryOffset = 0; | 1175 var queryOffset = 0; |
| 1160 var queryMap = {}; | 1176 var queryMap = {}; |
| 1161 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1177 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1162 parseBool(n) { | 1178 parseBool(n) { |
| 1163 if (n == "true") return true; | 1179 if (n == "true") return true; |
| 1164 if (n == "false") return false; | 1180 if (n == "false") return false; |
| 1165 if (n == null) return null; | 1181 if (n == null) return null; |
| 1166 throw new core.ArgumentError("Invalid boolean: $n"); | 1182 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1167 } | 1183 } |
| 1184 |
| 1168 if (query.length > 0) { | 1185 if (query.length > 0) { |
| 1169 for (var part in query.split("&")) { | 1186 for (var part in query.split("&")) { |
| 1170 var keyvalue = part.split("="); | 1187 var keyvalue = part.split("="); |
| 1171 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1188 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1189 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1172 } | 1190 } |
| 1173 } | 1191 } |
| 1174 | 1192 |
| 1175 | |
| 1176 var h = { | 1193 var h = { |
| 1177 "content-type" : "application/json; charset=utf-8", | 1194 "content-type": "application/json; charset=utf-8", |
| 1178 }; | 1195 }; |
| 1179 var resp = convert.JSON.encode(buildMatter()); | 1196 var resp = convert.JSON.encode(buildMatter()); |
| 1180 return new async.Future.value(stringResponse(200, h, resp)); | 1197 return new async.Future.value(stringResponse(200, h, resp)); |
| 1181 }), true); | 1198 }), true); |
| 1182 res.undelete(arg_request, arg_matterId).then(unittest.expectAsync1(((api.M
atter response) { | 1199 res |
| 1200 .undelete(arg_request, arg_matterId) |
| 1201 .then(unittest.expectAsync1(((api.Matter response) { |
| 1183 checkMatter(response); | 1202 checkMatter(response); |
| 1184 }))); | 1203 }))); |
| 1185 }); | 1204 }); |
| 1186 | 1205 |
| 1187 unittest.test("method--update", () { | 1206 unittest.test("method--update", () { |
| 1188 | |
| 1189 var mock = new HttpServerMock(); | 1207 var mock = new HttpServerMock(); |
| 1190 api.MattersResourceApi res = new api.VaultApi(mock).matters; | 1208 api.MattersResourceApi res = new api.VaultApi(mock).matters; |
| 1191 var arg_request = buildMatter(); | 1209 var arg_request = buildMatter(); |
| 1192 var arg_matterId = "foo"; | 1210 var arg_matterId = "foo"; |
| 1193 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1211 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1194 var obj = new api.Matter.fromJson(json); | 1212 var obj = new api.Matter.fromJson(json); |
| 1195 checkMatter(obj); | 1213 checkMatter(obj); |
| 1196 | 1214 |
| 1197 var path = (req.url).path; | 1215 var path = (req.url).path; |
| 1198 var pathOffset = 0; | 1216 var pathOffset = 0; |
| 1199 var index; | 1217 var index; |
| 1200 var subPart; | 1218 var subPart; |
| 1201 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1219 unittest.expect( |
| 1220 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1202 pathOffset += 1; | 1221 pathOffset += 1; |
| 1203 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1222 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1223 unittest.equals("v1/matters/")); |
| 1204 pathOffset += 11; | 1224 pathOffset += 11; |
| 1205 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1225 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1206 pathOffset = path.length; | 1226 pathOffset = path.length; |
| 1207 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1227 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1208 | 1228 |
| 1209 var query = (req.url).query; | 1229 var query = (req.url).query; |
| 1210 var queryOffset = 0; | 1230 var queryOffset = 0; |
| 1211 var queryMap = {}; | 1231 var queryMap = {}; |
| 1212 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1232 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1213 parseBool(n) { | 1233 parseBool(n) { |
| 1214 if (n == "true") return true; | 1234 if (n == "true") return true; |
| 1215 if (n == "false") return false; | 1235 if (n == "false") return false; |
| 1216 if (n == null) return null; | 1236 if (n == null) return null; |
| 1217 throw new core.ArgumentError("Invalid boolean: $n"); | 1237 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1218 } | 1238 } |
| 1239 |
| 1219 if (query.length > 0) { | 1240 if (query.length > 0) { |
| 1220 for (var part in query.split("&")) { | 1241 for (var part in query.split("&")) { |
| 1221 var keyvalue = part.split("="); | 1242 var keyvalue = part.split("="); |
| 1222 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1243 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1244 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1223 } | 1245 } |
| 1224 } | 1246 } |
| 1225 | 1247 |
| 1226 | |
| 1227 var h = { | 1248 var h = { |
| 1228 "content-type" : "application/json; charset=utf-8", | 1249 "content-type": "application/json; charset=utf-8", |
| 1229 }; | 1250 }; |
| 1230 var resp = convert.JSON.encode(buildMatter()); | 1251 var resp = convert.JSON.encode(buildMatter()); |
| 1231 return new async.Future.value(stringResponse(200, h, resp)); | 1252 return new async.Future.value(stringResponse(200, h, resp)); |
| 1232 }), true); | 1253 }), true); |
| 1233 res.update(arg_request, arg_matterId).then(unittest.expectAsync1(((api.Mat
ter response) { | 1254 res |
| 1255 .update(arg_request, arg_matterId) |
| 1256 .then(unittest.expectAsync1(((api.Matter response) { |
| 1234 checkMatter(response); | 1257 checkMatter(response); |
| 1235 }))); | 1258 }))); |
| 1236 }); | 1259 }); |
| 1237 | |
| 1238 }); | 1260 }); |
| 1239 | 1261 |
| 1240 | |
| 1241 unittest.group("resource-MattersHoldsResourceApi", () { | 1262 unittest.group("resource-MattersHoldsResourceApi", () { |
| 1242 unittest.test("method--create", () { | 1263 unittest.test("method--create", () { |
| 1243 | |
| 1244 var mock = new HttpServerMock(); | 1264 var mock = new HttpServerMock(); |
| 1245 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; | 1265 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; |
| 1246 var arg_request = buildHold(); | 1266 var arg_request = buildHold(); |
| 1247 var arg_matterId = "foo"; | 1267 var arg_matterId = "foo"; |
| 1248 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1268 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1249 var obj = new api.Hold.fromJson(json); | 1269 var obj = new api.Hold.fromJson(json); |
| 1250 checkHold(obj); | 1270 checkHold(obj); |
| 1251 | 1271 |
| 1252 var path = (req.url).path; | 1272 var path = (req.url).path; |
| 1253 var pathOffset = 0; | 1273 var pathOffset = 0; |
| 1254 var index; | 1274 var index; |
| 1255 var subPart; | 1275 var subPart; |
| 1256 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1276 unittest.expect( |
| 1277 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1257 pathOffset += 1; | 1278 pathOffset += 1; |
| 1258 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1279 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1280 unittest.equals("v1/matters/")); |
| 1259 pathOffset += 11; | 1281 pathOffset += 11; |
| 1260 index = path.indexOf("/holds", pathOffset); | 1282 index = path.indexOf("/holds", pathOffset); |
| 1261 unittest.expect(index >= 0, unittest.isTrue); | 1283 unittest.expect(index >= 0, unittest.isTrue); |
| 1262 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1284 subPart = |
| 1285 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1263 pathOffset = index; | 1286 pathOffset = index; |
| 1264 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1287 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1265 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/holds")); | 1288 unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| 1289 unittest.equals("/holds")); |
| 1266 pathOffset += 6; | 1290 pathOffset += 6; |
| 1267 | 1291 |
| 1268 var query = (req.url).query; | 1292 var query = (req.url).query; |
| 1269 var queryOffset = 0; | 1293 var queryOffset = 0; |
| 1270 var queryMap = {}; | 1294 var queryMap = {}; |
| 1271 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1295 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1272 parseBool(n) { | 1296 parseBool(n) { |
| 1273 if (n == "true") return true; | 1297 if (n == "true") return true; |
| 1274 if (n == "false") return false; | 1298 if (n == "false") return false; |
| 1275 if (n == null) return null; | 1299 if (n == null) return null; |
| 1276 throw new core.ArgumentError("Invalid boolean: $n"); | 1300 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1277 } | 1301 } |
| 1302 |
| 1278 if (query.length > 0) { | 1303 if (query.length > 0) { |
| 1279 for (var part in query.split("&")) { | 1304 for (var part in query.split("&")) { |
| 1280 var keyvalue = part.split("="); | 1305 var keyvalue = part.split("="); |
| 1281 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1306 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1307 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1282 } | 1308 } |
| 1283 } | 1309 } |
| 1284 | 1310 |
| 1285 | |
| 1286 var h = { | 1311 var h = { |
| 1287 "content-type" : "application/json; charset=utf-8", | 1312 "content-type": "application/json; charset=utf-8", |
| 1288 }; | 1313 }; |
| 1289 var resp = convert.JSON.encode(buildHold()); | 1314 var resp = convert.JSON.encode(buildHold()); |
| 1290 return new async.Future.value(stringResponse(200, h, resp)); | 1315 return new async.Future.value(stringResponse(200, h, resp)); |
| 1291 }), true); | 1316 }), true); |
| 1292 res.create(arg_request, arg_matterId).then(unittest.expectAsync1(((api.Hol
d response) { | 1317 res |
| 1318 .create(arg_request, arg_matterId) |
| 1319 .then(unittest.expectAsync1(((api.Hold response) { |
| 1293 checkHold(response); | 1320 checkHold(response); |
| 1294 }))); | 1321 }))); |
| 1295 }); | 1322 }); |
| 1296 | 1323 |
| 1297 unittest.test("method--delete", () { | 1324 unittest.test("method--delete", () { |
| 1298 | |
| 1299 var mock = new HttpServerMock(); | 1325 var mock = new HttpServerMock(); |
| 1300 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; | 1326 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; |
| 1301 var arg_matterId = "foo"; | 1327 var arg_matterId = "foo"; |
| 1302 var arg_holdId = "foo"; | 1328 var arg_holdId = "foo"; |
| 1303 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1329 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1304 var path = (req.url).path; | 1330 var path = (req.url).path; |
| 1305 var pathOffset = 0; | 1331 var pathOffset = 0; |
| 1306 var index; | 1332 var index; |
| 1307 var subPart; | 1333 var subPart; |
| 1308 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1334 unittest.expect( |
| 1335 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1309 pathOffset += 1; | 1336 pathOffset += 1; |
| 1310 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1337 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1338 unittest.equals("v1/matters/")); |
| 1311 pathOffset += 11; | 1339 pathOffset += 11; |
| 1312 index = path.indexOf("/holds/", pathOffset); | 1340 index = path.indexOf("/holds/", pathOffset); |
| 1313 unittest.expect(index >= 0, unittest.isTrue); | 1341 unittest.expect(index >= 0, unittest.isTrue); |
| 1314 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1342 subPart = |
| 1343 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1315 pathOffset = index; | 1344 pathOffset = index; |
| 1316 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1345 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1317 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/holds/")); | 1346 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1347 unittest.equals("/holds/")); |
| 1318 pathOffset += 7; | 1348 pathOffset += 7; |
| 1319 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1349 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1320 pathOffset = path.length; | 1350 pathOffset = path.length; |
| 1321 unittest.expect(subPart, unittest.equals("$arg_holdId")); | 1351 unittest.expect(subPart, unittest.equals("$arg_holdId")); |
| 1322 | 1352 |
| 1323 var query = (req.url).query; | 1353 var query = (req.url).query; |
| 1324 var queryOffset = 0; | 1354 var queryOffset = 0; |
| 1325 var queryMap = {}; | 1355 var queryMap = {}; |
| 1326 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1356 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1327 parseBool(n) { | 1357 parseBool(n) { |
| 1328 if (n == "true") return true; | 1358 if (n == "true") return true; |
| 1329 if (n == "false") return false; | 1359 if (n == "false") return false; |
| 1330 if (n == null) return null; | 1360 if (n == null) return null; |
| 1331 throw new core.ArgumentError("Invalid boolean: $n"); | 1361 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1332 } | 1362 } |
| 1363 |
| 1333 if (query.length > 0) { | 1364 if (query.length > 0) { |
| 1334 for (var part in query.split("&")) { | 1365 for (var part in query.split("&")) { |
| 1335 var keyvalue = part.split("="); | 1366 var keyvalue = part.split("="); |
| 1336 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1367 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1368 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1337 } | 1369 } |
| 1338 } | 1370 } |
| 1339 | 1371 |
| 1340 | |
| 1341 var h = { | 1372 var h = { |
| 1342 "content-type" : "application/json; charset=utf-8", | 1373 "content-type": "application/json; charset=utf-8", |
| 1343 }; | 1374 }; |
| 1344 var resp = convert.JSON.encode(buildEmpty()); | 1375 var resp = convert.JSON.encode(buildEmpty()); |
| 1345 return new async.Future.value(stringResponse(200, h, resp)); | 1376 return new async.Future.value(stringResponse(200, h, resp)); |
| 1346 }), true); | 1377 }), true); |
| 1347 res.delete(arg_matterId, arg_holdId).then(unittest.expectAsync1(((api.Empt
y response) { | 1378 res |
| 1379 .delete(arg_matterId, arg_holdId) |
| 1380 .then(unittest.expectAsync1(((api.Empty response) { |
| 1348 checkEmpty(response); | 1381 checkEmpty(response); |
| 1349 }))); | 1382 }))); |
| 1350 }); | 1383 }); |
| 1351 | 1384 |
| 1352 unittest.test("method--get", () { | 1385 unittest.test("method--get", () { |
| 1353 | |
| 1354 var mock = new HttpServerMock(); | 1386 var mock = new HttpServerMock(); |
| 1355 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; | 1387 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; |
| 1356 var arg_matterId = "foo"; | 1388 var arg_matterId = "foo"; |
| 1357 var arg_holdId = "foo"; | 1389 var arg_holdId = "foo"; |
| 1358 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1390 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1359 var path = (req.url).path; | 1391 var path = (req.url).path; |
| 1360 var pathOffset = 0; | 1392 var pathOffset = 0; |
| 1361 var index; | 1393 var index; |
| 1362 var subPart; | 1394 var subPart; |
| 1363 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1395 unittest.expect( |
| 1396 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1364 pathOffset += 1; | 1397 pathOffset += 1; |
| 1365 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1398 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1399 unittest.equals("v1/matters/")); |
| 1366 pathOffset += 11; | 1400 pathOffset += 11; |
| 1367 index = path.indexOf("/holds/", pathOffset); | 1401 index = path.indexOf("/holds/", pathOffset); |
| 1368 unittest.expect(index >= 0, unittest.isTrue); | 1402 unittest.expect(index >= 0, unittest.isTrue); |
| 1369 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1403 subPart = |
| 1404 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1370 pathOffset = index; | 1405 pathOffset = index; |
| 1371 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1406 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1372 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/holds/")); | 1407 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1408 unittest.equals("/holds/")); |
| 1373 pathOffset += 7; | 1409 pathOffset += 7; |
| 1374 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1410 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1375 pathOffset = path.length; | 1411 pathOffset = path.length; |
| 1376 unittest.expect(subPart, unittest.equals("$arg_holdId")); | 1412 unittest.expect(subPart, unittest.equals("$arg_holdId")); |
| 1377 | 1413 |
| 1378 var query = (req.url).query; | 1414 var query = (req.url).query; |
| 1379 var queryOffset = 0; | 1415 var queryOffset = 0; |
| 1380 var queryMap = {}; | 1416 var queryMap = {}; |
| 1381 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1417 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1382 parseBool(n) { | 1418 parseBool(n) { |
| 1383 if (n == "true") return true; | 1419 if (n == "true") return true; |
| 1384 if (n == "false") return false; | 1420 if (n == "false") return false; |
| 1385 if (n == null) return null; | 1421 if (n == null) return null; |
| 1386 throw new core.ArgumentError("Invalid boolean: $n"); | 1422 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1387 } | 1423 } |
| 1424 |
| 1388 if (query.length > 0) { | 1425 if (query.length > 0) { |
| 1389 for (var part in query.split("&")) { | 1426 for (var part in query.split("&")) { |
| 1390 var keyvalue = part.split("="); | 1427 var keyvalue = part.split("="); |
| 1391 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1428 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1429 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1392 } | 1430 } |
| 1393 } | 1431 } |
| 1394 | 1432 |
| 1395 | |
| 1396 var h = { | 1433 var h = { |
| 1397 "content-type" : "application/json; charset=utf-8", | 1434 "content-type": "application/json; charset=utf-8", |
| 1398 }; | 1435 }; |
| 1399 var resp = convert.JSON.encode(buildHold()); | 1436 var resp = convert.JSON.encode(buildHold()); |
| 1400 return new async.Future.value(stringResponse(200, h, resp)); | 1437 return new async.Future.value(stringResponse(200, h, resp)); |
| 1401 }), true); | 1438 }), true); |
| 1402 res.get(arg_matterId, arg_holdId).then(unittest.expectAsync1(((api.Hold re
sponse) { | 1439 res |
| 1440 .get(arg_matterId, arg_holdId) |
| 1441 .then(unittest.expectAsync1(((api.Hold response) { |
| 1403 checkHold(response); | 1442 checkHold(response); |
| 1404 }))); | 1443 }))); |
| 1405 }); | 1444 }); |
| 1406 | 1445 |
| 1407 unittest.test("method--list", () { | 1446 unittest.test("method--list", () { |
| 1408 | |
| 1409 var mock = new HttpServerMock(); | 1447 var mock = new HttpServerMock(); |
| 1410 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; | 1448 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; |
| 1411 var arg_matterId = "foo"; | 1449 var arg_matterId = "foo"; |
| 1412 var arg_pageToken = "foo"; | 1450 var arg_pageToken = "foo"; |
| 1413 var arg_pageSize = 42; | 1451 var arg_pageSize = 42; |
| 1414 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1452 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1415 var path = (req.url).path; | 1453 var path = (req.url).path; |
| 1416 var pathOffset = 0; | 1454 var pathOffset = 0; |
| 1417 var index; | 1455 var index; |
| 1418 var subPart; | 1456 var subPart; |
| 1419 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1457 unittest.expect( |
| 1458 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1420 pathOffset += 1; | 1459 pathOffset += 1; |
| 1421 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1460 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1461 unittest.equals("v1/matters/")); |
| 1422 pathOffset += 11; | 1462 pathOffset += 11; |
| 1423 index = path.indexOf("/holds", pathOffset); | 1463 index = path.indexOf("/holds", pathOffset); |
| 1424 unittest.expect(index >= 0, unittest.isTrue); | 1464 unittest.expect(index >= 0, unittest.isTrue); |
| 1425 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1465 subPart = |
| 1466 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1426 pathOffset = index; | 1467 pathOffset = index; |
| 1427 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1468 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1428 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/holds")); | 1469 unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| 1470 unittest.equals("/holds")); |
| 1429 pathOffset += 6; | 1471 pathOffset += 6; |
| 1430 | 1472 |
| 1431 var query = (req.url).query; | 1473 var query = (req.url).query; |
| 1432 var queryOffset = 0; | 1474 var queryOffset = 0; |
| 1433 var queryMap = {}; | 1475 var queryMap = {}; |
| 1434 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1476 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1435 parseBool(n) { | 1477 parseBool(n) { |
| 1436 if (n == "true") return true; | 1478 if (n == "true") return true; |
| 1437 if (n == "false") return false; | 1479 if (n == "false") return false; |
| 1438 if (n == null) return null; | 1480 if (n == null) return null; |
| 1439 throw new core.ArgumentError("Invalid boolean: $n"); | 1481 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1440 } | 1482 } |
| 1483 |
| 1441 if (query.length > 0) { | 1484 if (query.length > 0) { |
| 1442 for (var part in query.split("&")) { | 1485 for (var part in query.split("&")) { |
| 1443 var keyvalue = part.split("="); | 1486 var keyvalue = part.split("="); |
| 1444 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1487 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1488 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1445 } | 1489 } |
| 1446 } | 1490 } |
| 1447 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1491 unittest.expect( |
| 1448 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1492 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 1449 | 1493 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1494 unittest.equals(arg_pageSize)); |
| 1450 | 1495 |
| 1451 var h = { | 1496 var h = { |
| 1452 "content-type" : "application/json; charset=utf-8", | 1497 "content-type": "application/json; charset=utf-8", |
| 1453 }; | 1498 }; |
| 1454 var resp = convert.JSON.encode(buildListHoldsResponse()); | 1499 var resp = convert.JSON.encode(buildListHoldsResponse()); |
| 1455 return new async.Future.value(stringResponse(200, h, resp)); | 1500 return new async.Future.value(stringResponse(200, h, resp)); |
| 1456 }), true); | 1501 }), true); |
| 1457 res.list(arg_matterId, pageToken: arg_pageToken, pageSize: arg_pageSize).t
hen(unittest.expectAsync1(((api.ListHoldsResponse response) { | 1502 res |
| 1503 .list(arg_matterId, pageToken: arg_pageToken, pageSize: arg_pageSize) |
| 1504 .then(unittest.expectAsync1(((api.ListHoldsResponse response) { |
| 1458 checkListHoldsResponse(response); | 1505 checkListHoldsResponse(response); |
| 1459 }))); | 1506 }))); |
| 1460 }); | 1507 }); |
| 1461 | 1508 |
| 1462 unittest.test("method--update", () { | 1509 unittest.test("method--update", () { |
| 1463 | |
| 1464 var mock = new HttpServerMock(); | 1510 var mock = new HttpServerMock(); |
| 1465 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; | 1511 api.MattersHoldsResourceApi res = new api.VaultApi(mock).matters.holds; |
| 1466 var arg_request = buildHold(); | 1512 var arg_request = buildHold(); |
| 1467 var arg_matterId = "foo"; | 1513 var arg_matterId = "foo"; |
| 1468 var arg_holdId = "foo"; | 1514 var arg_holdId = "foo"; |
| 1469 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1515 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1470 var obj = new api.Hold.fromJson(json); | 1516 var obj = new api.Hold.fromJson(json); |
| 1471 checkHold(obj); | 1517 checkHold(obj); |
| 1472 | 1518 |
| 1473 var path = (req.url).path; | 1519 var path = (req.url).path; |
| 1474 var pathOffset = 0; | 1520 var pathOffset = 0; |
| 1475 var index; | 1521 var index; |
| 1476 var subPart; | 1522 var subPart; |
| 1477 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1523 unittest.expect( |
| 1524 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1478 pathOffset += 1; | 1525 pathOffset += 1; |
| 1479 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1526 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1527 unittest.equals("v1/matters/")); |
| 1480 pathOffset += 11; | 1528 pathOffset += 11; |
| 1481 index = path.indexOf("/holds/", pathOffset); | 1529 index = path.indexOf("/holds/", pathOffset); |
| 1482 unittest.expect(index >= 0, unittest.isTrue); | 1530 unittest.expect(index >= 0, unittest.isTrue); |
| 1483 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1531 subPart = |
| 1532 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1484 pathOffset = index; | 1533 pathOffset = index; |
| 1485 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1534 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1486 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/holds/")); | 1535 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1536 unittest.equals("/holds/")); |
| 1487 pathOffset += 7; | 1537 pathOffset += 7; |
| 1488 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1538 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1489 pathOffset = path.length; | 1539 pathOffset = path.length; |
| 1490 unittest.expect(subPart, unittest.equals("$arg_holdId")); | 1540 unittest.expect(subPart, unittest.equals("$arg_holdId")); |
| 1491 | 1541 |
| 1492 var query = (req.url).query; | 1542 var query = (req.url).query; |
| 1493 var queryOffset = 0; | 1543 var queryOffset = 0; |
| 1494 var queryMap = {}; | 1544 var queryMap = {}; |
| 1495 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1545 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1496 parseBool(n) { | 1546 parseBool(n) { |
| 1497 if (n == "true") return true; | 1547 if (n == "true") return true; |
| 1498 if (n == "false") return false; | 1548 if (n == "false") return false; |
| 1499 if (n == null) return null; | 1549 if (n == null) return null; |
| 1500 throw new core.ArgumentError("Invalid boolean: $n"); | 1550 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1501 } | 1551 } |
| 1552 |
| 1502 if (query.length > 0) { | 1553 if (query.length > 0) { |
| 1503 for (var part in query.split("&")) { | 1554 for (var part in query.split("&")) { |
| 1504 var keyvalue = part.split("="); | 1555 var keyvalue = part.split("="); |
| 1505 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1556 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1557 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1506 } | 1558 } |
| 1507 } | 1559 } |
| 1508 | 1560 |
| 1509 | |
| 1510 var h = { | 1561 var h = { |
| 1511 "content-type" : "application/json; charset=utf-8", | 1562 "content-type": "application/json; charset=utf-8", |
| 1512 }; | 1563 }; |
| 1513 var resp = convert.JSON.encode(buildHold()); | 1564 var resp = convert.JSON.encode(buildHold()); |
| 1514 return new async.Future.value(stringResponse(200, h, resp)); | 1565 return new async.Future.value(stringResponse(200, h, resp)); |
| 1515 }), true); | 1566 }), true); |
| 1516 res.update(arg_request, arg_matterId, arg_holdId).then(unittest.expectAsyn
c1(((api.Hold response) { | 1567 res |
| 1568 .update(arg_request, arg_matterId, arg_holdId) |
| 1569 .then(unittest.expectAsync1(((api.Hold response) { |
| 1517 checkHold(response); | 1570 checkHold(response); |
| 1518 }))); | 1571 }))); |
| 1519 }); | 1572 }); |
| 1520 | |
| 1521 }); | 1573 }); |
| 1522 | 1574 |
| 1523 | |
| 1524 unittest.group("resource-MattersHoldsAccountsResourceApi", () { | 1575 unittest.group("resource-MattersHoldsAccountsResourceApi", () { |
| 1525 unittest.test("method--create", () { | 1576 unittest.test("method--create", () { |
| 1526 | |
| 1527 var mock = new HttpServerMock(); | 1577 var mock = new HttpServerMock(); |
| 1528 api.MattersHoldsAccountsResourceApi res = new api.VaultApi(mock).matters.h
olds.accounts; | 1578 api.MattersHoldsAccountsResourceApi res = |
| 1579 new api.VaultApi(mock).matters.holds.accounts; |
| 1529 var arg_request = buildHeldAccount(); | 1580 var arg_request = buildHeldAccount(); |
| 1530 var arg_matterId = "foo"; | 1581 var arg_matterId = "foo"; |
| 1531 var arg_holdId = "foo"; | 1582 var arg_holdId = "foo"; |
| 1532 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1583 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1533 var obj = new api.HeldAccount.fromJson(json); | 1584 var obj = new api.HeldAccount.fromJson(json); |
| 1534 checkHeldAccount(obj); | 1585 checkHeldAccount(obj); |
| 1535 | 1586 |
| 1536 var path = (req.url).path; | 1587 var path = (req.url).path; |
| 1537 var pathOffset = 0; | 1588 var pathOffset = 0; |
| 1538 var index; | 1589 var index; |
| 1539 var subPart; | 1590 var subPart; |
| 1540 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1591 unittest.expect( |
| 1592 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1541 pathOffset += 1; | 1593 pathOffset += 1; |
| 1542 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1594 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1595 unittest.equals("v1/matters/")); |
| 1543 pathOffset += 11; | 1596 pathOffset += 11; |
| 1544 index = path.indexOf("/holds/", pathOffset); | 1597 index = path.indexOf("/holds/", pathOffset); |
| 1545 unittest.expect(index >= 0, unittest.isTrue); | 1598 unittest.expect(index >= 0, unittest.isTrue); |
| 1546 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1599 subPart = |
| 1600 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1547 pathOffset = index; | 1601 pathOffset = index; |
| 1548 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1602 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1549 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/holds/")); | 1603 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1604 unittest.equals("/holds/")); |
| 1550 pathOffset += 7; | 1605 pathOffset += 7; |
| 1551 index = path.indexOf("/accounts", pathOffset); | 1606 index = path.indexOf("/accounts", pathOffset); |
| 1552 unittest.expect(index >= 0, unittest.isTrue); | 1607 unittest.expect(index >= 0, unittest.isTrue); |
| 1553 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1608 subPart = |
| 1609 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1554 pathOffset = index; | 1610 pathOffset = index; |
| 1555 unittest.expect(subPart, unittest.equals("$arg_holdId")); | 1611 unittest.expect(subPart, unittest.equals("$arg_holdId")); |
| 1556 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/accounts")); | 1612 unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| 1613 unittest.equals("/accounts")); |
| 1557 pathOffset += 9; | 1614 pathOffset += 9; |
| 1558 | 1615 |
| 1559 var query = (req.url).query; | 1616 var query = (req.url).query; |
| 1560 var queryOffset = 0; | 1617 var queryOffset = 0; |
| 1561 var queryMap = {}; | 1618 var queryMap = {}; |
| 1562 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1619 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1563 parseBool(n) { | 1620 parseBool(n) { |
| 1564 if (n == "true") return true; | 1621 if (n == "true") return true; |
| 1565 if (n == "false") return false; | 1622 if (n == "false") return false; |
| 1566 if (n == null) return null; | 1623 if (n == null) return null; |
| 1567 throw new core.ArgumentError("Invalid boolean: $n"); | 1624 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1568 } | 1625 } |
| 1626 |
| 1569 if (query.length > 0) { | 1627 if (query.length > 0) { |
| 1570 for (var part in query.split("&")) { | 1628 for (var part in query.split("&")) { |
| 1571 var keyvalue = part.split("="); | 1629 var keyvalue = part.split("="); |
| 1572 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1630 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1631 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1573 } | 1632 } |
| 1574 } | 1633 } |
| 1575 | 1634 |
| 1576 | |
| 1577 var h = { | 1635 var h = { |
| 1578 "content-type" : "application/json; charset=utf-8", | 1636 "content-type": "application/json; charset=utf-8", |
| 1579 }; | 1637 }; |
| 1580 var resp = convert.JSON.encode(buildHeldAccount()); | 1638 var resp = convert.JSON.encode(buildHeldAccount()); |
| 1581 return new async.Future.value(stringResponse(200, h, resp)); | 1639 return new async.Future.value(stringResponse(200, h, resp)); |
| 1582 }), true); | 1640 }), true); |
| 1583 res.create(arg_request, arg_matterId, arg_holdId).then(unittest.expectAsyn
c1(((api.HeldAccount response) { | 1641 res |
| 1642 .create(arg_request, arg_matterId, arg_holdId) |
| 1643 .then(unittest.expectAsync1(((api.HeldAccount response) { |
| 1584 checkHeldAccount(response); | 1644 checkHeldAccount(response); |
| 1585 }))); | 1645 }))); |
| 1586 }); | 1646 }); |
| 1587 | 1647 |
| 1588 unittest.test("method--delete", () { | 1648 unittest.test("method--delete", () { |
| 1589 | |
| 1590 var mock = new HttpServerMock(); | 1649 var mock = new HttpServerMock(); |
| 1591 api.MattersHoldsAccountsResourceApi res = new api.VaultApi(mock).matters.h
olds.accounts; | 1650 api.MattersHoldsAccountsResourceApi res = |
| 1651 new api.VaultApi(mock).matters.holds.accounts; |
| 1592 var arg_matterId = "foo"; | 1652 var arg_matterId = "foo"; |
| 1593 var arg_holdId = "foo"; | 1653 var arg_holdId = "foo"; |
| 1594 var arg_accountId = "foo"; | 1654 var arg_accountId = "foo"; |
| 1595 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1655 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1596 var path = (req.url).path; | 1656 var path = (req.url).path; |
| 1597 var pathOffset = 0; | 1657 var pathOffset = 0; |
| 1598 var index; | 1658 var index; |
| 1599 var subPart; | 1659 var subPart; |
| 1600 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1660 unittest.expect( |
| 1661 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1601 pathOffset += 1; | 1662 pathOffset += 1; |
| 1602 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1663 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1664 unittest.equals("v1/matters/")); |
| 1603 pathOffset += 11; | 1665 pathOffset += 11; |
| 1604 index = path.indexOf("/holds/", pathOffset); | 1666 index = path.indexOf("/holds/", pathOffset); |
| 1605 unittest.expect(index >= 0, unittest.isTrue); | 1667 unittest.expect(index >= 0, unittest.isTrue); |
| 1606 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1668 subPart = |
| 1669 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1607 pathOffset = index; | 1670 pathOffset = index; |
| 1608 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1671 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1609 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/holds/")); | 1672 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1673 unittest.equals("/holds/")); |
| 1610 pathOffset += 7; | 1674 pathOffset += 7; |
| 1611 index = path.indexOf("/accounts/", pathOffset); | 1675 index = path.indexOf("/accounts/", pathOffset); |
| 1612 unittest.expect(index >= 0, unittest.isTrue); | 1676 unittest.expect(index >= 0, unittest.isTrue); |
| 1613 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1677 subPart = |
| 1678 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1614 pathOffset = index; | 1679 pathOffset = index; |
| 1615 unittest.expect(subPart, unittest.equals("$arg_holdId")); | 1680 unittest.expect(subPart, unittest.equals("$arg_holdId")); |
| 1616 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/accounts/")); | 1681 unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| 1682 unittest.equals("/accounts/")); |
| 1617 pathOffset += 10; | 1683 pathOffset += 10; |
| 1618 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1684 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1619 pathOffset = path.length; | 1685 pathOffset = path.length; |
| 1620 unittest.expect(subPart, unittest.equals("$arg_accountId")); | 1686 unittest.expect(subPart, unittest.equals("$arg_accountId")); |
| 1621 | 1687 |
| 1622 var query = (req.url).query; | 1688 var query = (req.url).query; |
| 1623 var queryOffset = 0; | 1689 var queryOffset = 0; |
| 1624 var queryMap = {}; | 1690 var queryMap = {}; |
| 1625 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1691 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1626 parseBool(n) { | 1692 parseBool(n) { |
| 1627 if (n == "true") return true; | 1693 if (n == "true") return true; |
| 1628 if (n == "false") return false; | 1694 if (n == "false") return false; |
| 1629 if (n == null) return null; | 1695 if (n == null) return null; |
| 1630 throw new core.ArgumentError("Invalid boolean: $n"); | 1696 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1631 } | 1697 } |
| 1698 |
| 1632 if (query.length > 0) { | 1699 if (query.length > 0) { |
| 1633 for (var part in query.split("&")) { | 1700 for (var part in query.split("&")) { |
| 1634 var keyvalue = part.split("="); | 1701 var keyvalue = part.split("="); |
| 1635 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1702 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1703 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1636 } | 1704 } |
| 1637 } | 1705 } |
| 1638 | 1706 |
| 1639 | |
| 1640 var h = { | 1707 var h = { |
| 1641 "content-type" : "application/json; charset=utf-8", | 1708 "content-type": "application/json; charset=utf-8", |
| 1642 }; | 1709 }; |
| 1643 var resp = convert.JSON.encode(buildEmpty()); | 1710 var resp = convert.JSON.encode(buildEmpty()); |
| 1644 return new async.Future.value(stringResponse(200, h, resp)); | 1711 return new async.Future.value(stringResponse(200, h, resp)); |
| 1645 }), true); | 1712 }), true); |
| 1646 res.delete(arg_matterId, arg_holdId, arg_accountId).then(unittest.expectAs
ync1(((api.Empty response) { | 1713 res |
| 1714 .delete(arg_matterId, arg_holdId, arg_accountId) |
| 1715 .then(unittest.expectAsync1(((api.Empty response) { |
| 1647 checkEmpty(response); | 1716 checkEmpty(response); |
| 1648 }))); | 1717 }))); |
| 1649 }); | 1718 }); |
| 1650 | 1719 |
| 1651 unittest.test("method--list", () { | 1720 unittest.test("method--list", () { |
| 1652 | |
| 1653 var mock = new HttpServerMock(); | 1721 var mock = new HttpServerMock(); |
| 1654 api.MattersHoldsAccountsResourceApi res = new api.VaultApi(mock).matters.h
olds.accounts; | 1722 api.MattersHoldsAccountsResourceApi res = |
| 1723 new api.VaultApi(mock).matters.holds.accounts; |
| 1655 var arg_matterId = "foo"; | 1724 var arg_matterId = "foo"; |
| 1656 var arg_holdId = "foo"; | 1725 var arg_holdId = "foo"; |
| 1657 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1726 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1658 var path = (req.url).path; | 1727 var path = (req.url).path; |
| 1659 var pathOffset = 0; | 1728 var pathOffset = 0; |
| 1660 var index; | 1729 var index; |
| 1661 var subPart; | 1730 var subPart; |
| 1662 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1731 unittest.expect( |
| 1732 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1663 pathOffset += 1; | 1733 pathOffset += 1; |
| 1664 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("v1/matters/")); | 1734 unittest.expect(path.substring(pathOffset, pathOffset + 11), |
| 1735 unittest.equals("v1/matters/")); |
| 1665 pathOffset += 11; | 1736 pathOffset += 11; |
| 1666 index = path.indexOf("/holds/", pathOffset); | 1737 index = path.indexOf("/holds/", pathOffset); |
| 1667 unittest.expect(index >= 0, unittest.isTrue); | 1738 unittest.expect(index >= 0, unittest.isTrue); |
| 1668 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1739 subPart = |
| 1740 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1669 pathOffset = index; | 1741 pathOffset = index; |
| 1670 unittest.expect(subPart, unittest.equals("$arg_matterId")); | 1742 unittest.expect(subPart, unittest.equals("$arg_matterId")); |
| 1671 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/holds/")); | 1743 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1744 unittest.equals("/holds/")); |
| 1672 pathOffset += 7; | 1745 pathOffset += 7; |
| 1673 index = path.indexOf("/accounts", pathOffset); | 1746 index = path.indexOf("/accounts", pathOffset); |
| 1674 unittest.expect(index >= 0, unittest.isTrue); | 1747 unittest.expect(index >= 0, unittest.isTrue); |
| 1675 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1748 subPart = |
| 1749 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1676 pathOffset = index; | 1750 pathOffset = index; |
| 1677 unittest.expect(subPart, unittest.equals("$arg_holdId")); | 1751 unittest.expect(subPart, unittest.equals("$arg_holdId")); |
| 1678 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("/accounts")); | 1752 unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| 1753 unittest.equals("/accounts")); |
| 1679 pathOffset += 9; | 1754 pathOffset += 9; |
| 1680 | 1755 |
| 1681 var query = (req.url).query; | 1756 var query = (req.url).query; |
| 1682 var queryOffset = 0; | 1757 var queryOffset = 0; |
| 1683 var queryMap = {}; | 1758 var queryMap = {}; |
| 1684 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1759 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1685 parseBool(n) { | 1760 parseBool(n) { |
| 1686 if (n == "true") return true; | 1761 if (n == "true") return true; |
| 1687 if (n == "false") return false; | 1762 if (n == "false") return false; |
| 1688 if (n == null) return null; | 1763 if (n == null) return null; |
| 1689 throw new core.ArgumentError("Invalid boolean: $n"); | 1764 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1690 } | 1765 } |
| 1766 |
| 1691 if (query.length > 0) { | 1767 if (query.length > 0) { |
| 1692 for (var part in query.split("&")) { | 1768 for (var part in query.split("&")) { |
| 1693 var keyvalue = part.split("="); | 1769 var keyvalue = part.split("="); |
| 1694 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1770 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1771 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1695 } | 1772 } |
| 1696 } | 1773 } |
| 1697 | 1774 |
| 1698 | |
| 1699 var h = { | 1775 var h = { |
| 1700 "content-type" : "application/json; charset=utf-8", | 1776 "content-type": "application/json; charset=utf-8", |
| 1701 }; | 1777 }; |
| 1702 var resp = convert.JSON.encode(buildListHeldAccountsResponse()); | 1778 var resp = convert.JSON.encode(buildListHeldAccountsResponse()); |
| 1703 return new async.Future.value(stringResponse(200, h, resp)); | 1779 return new async.Future.value(stringResponse(200, h, resp)); |
| 1704 }), true); | 1780 }), true); |
| 1705 res.list(arg_matterId, arg_holdId).then(unittest.expectAsync1(((api.ListHe
ldAccountsResponse response) { | 1781 res |
| 1782 .list(arg_matterId, arg_holdId) |
| 1783 .then(unittest.expectAsync1(((api.ListHeldAccountsResponse response) { |
| 1706 checkListHeldAccountsResponse(response); | 1784 checkListHeldAccountsResponse(response); |
| 1707 }))); | 1785 }))); |
| 1708 }); | 1786 }); |
| 1709 | |
| 1710 }); | 1787 }); |
| 1711 | |
| 1712 | |
| 1713 } | 1788 } |
| 1714 | |
| OLD | NEW |