| OLD | NEW |
| 1 library googleapis.cloudbilling.v1.test; | 1 library googleapis.cloudbilling.v1.test; |
| 2 | 2 |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; | 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
| 7 | 7 |
| 8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
| 10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:test/test.dart' as unittest; |
| 11 | 11 |
| 12 import 'package:googleapis/cloudbilling/v1.dart' as api; | 12 import 'package:googleapis/cloudbilling/v1.dart' as api; |
| 13 | 13 |
| 14 class HttpServerMock extends http.BaseClient { | 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 15 core.Function _callback; |
| 16 core.bool _expectJson; | 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { | 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 19 _callback = callback; |
| 20 _expectJson = expectJson; | 20 _expectJson = expectJson; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 39 } else { | 39 } else { |
| 40 return stream.toBytes().then((data) { | 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 41 return _callback(request, data); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 52 } |
| 53 | 53 |
| 54 core.int buildCounterBillingAccount = 0; | 54 core.int buildCounterBillingAccount = 0; |
| 55 buildBillingAccount() { | 55 buildBillingAccount() { |
| 56 var o = new api.BillingAccount(); | 56 var o = new api.BillingAccount(); |
| 57 buildCounterBillingAccount++; | 57 buildCounterBillingAccount++; |
| 58 if (buildCounterBillingAccount < 3) { | 58 if (buildCounterBillingAccount < 3) { |
| 59 o.displayName = "foo"; | 59 o.displayName = "foo"; |
| 60 o.name = "foo"; | 60 o.name = "foo"; |
| 61 o.open = true; | 61 o.open = true; |
| 62 } | 62 } |
| 63 buildCounterBillingAccount--; | 63 buildCounterBillingAccount--; |
| 64 return o; | 64 return o; |
| 65 } | 65 } |
| 66 | 66 |
| 67 checkBillingAccount(api.BillingAccount o) { | 67 checkBillingAccount(api.BillingAccount o) { |
| 68 buildCounterBillingAccount++; | 68 buildCounterBillingAccount++; |
| 69 if (buildCounterBillingAccount < 3) { | 69 if (buildCounterBillingAccount < 3) { |
| 70 unittest.expect(o.displayName, unittest.equals('foo')); | 70 unittest.expect(o.displayName, unittest.equals('foo')); |
| 71 unittest.expect(o.name, unittest.equals('foo')); | 71 unittest.expect(o.name, unittest.equals('foo')); |
| 72 unittest.expect(o.open, unittest.isTrue); | 72 unittest.expect(o.open, unittest.isTrue); |
| 73 } | 73 } |
| 74 buildCounterBillingAccount--; | 74 buildCounterBillingAccount--; |
| 75 } | 75 } |
| 76 | 76 |
| 77 buildUnnamed37() { | 77 buildUnnamed39() { |
| 78 var o = new core.List<api.BillingAccount>(); | 78 var o = new core.List<api.BillingAccount>(); |
| 79 o.add(buildBillingAccount()); | 79 o.add(buildBillingAccount()); |
| 80 o.add(buildBillingAccount()); | 80 o.add(buildBillingAccount()); |
| 81 return o; | 81 return o; |
| 82 } | 82 } |
| 83 | 83 |
| 84 checkUnnamed37(core.List<api.BillingAccount> o) { | 84 checkUnnamed39(core.List<api.BillingAccount> o) { |
| 85 unittest.expect(o, unittest.hasLength(2)); | 85 unittest.expect(o, unittest.hasLength(2)); |
| 86 checkBillingAccount(o[0]); | 86 checkBillingAccount(o[0]); |
| 87 checkBillingAccount(o[1]); | 87 checkBillingAccount(o[1]); |
| 88 } | 88 } |
| 89 | 89 |
| 90 core.int buildCounterListBillingAccountsResponse = 0; | 90 core.int buildCounterListBillingAccountsResponse = 0; |
| 91 buildListBillingAccountsResponse() { | 91 buildListBillingAccountsResponse() { |
| 92 var o = new api.ListBillingAccountsResponse(); | 92 var o = new api.ListBillingAccountsResponse(); |
| 93 buildCounterListBillingAccountsResponse++; | 93 buildCounterListBillingAccountsResponse++; |
| 94 if (buildCounterListBillingAccountsResponse < 3) { | 94 if (buildCounterListBillingAccountsResponse < 3) { |
| 95 o.billingAccounts = buildUnnamed37(); | 95 o.billingAccounts = buildUnnamed39(); |
| 96 o.nextPageToken = "foo"; | 96 o.nextPageToken = "foo"; |
| 97 } | 97 } |
| 98 buildCounterListBillingAccountsResponse--; | 98 buildCounterListBillingAccountsResponse--; |
| 99 return o; | 99 return o; |
| 100 } | 100 } |
| 101 | 101 |
| 102 checkListBillingAccountsResponse(api.ListBillingAccountsResponse o) { | 102 checkListBillingAccountsResponse(api.ListBillingAccountsResponse o) { |
| 103 buildCounterListBillingAccountsResponse++; | 103 buildCounterListBillingAccountsResponse++; |
| 104 if (buildCounterListBillingAccountsResponse < 3) { | 104 if (buildCounterListBillingAccountsResponse < 3) { |
| 105 checkUnnamed37(o.billingAccounts); | 105 checkUnnamed39(o.billingAccounts); |
| 106 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 106 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 107 } | 107 } |
| 108 buildCounterListBillingAccountsResponse--; | 108 buildCounterListBillingAccountsResponse--; |
| 109 } | 109 } |
| 110 | 110 |
| 111 buildUnnamed38() { | 111 buildUnnamed40() { |
| 112 var o = new core.List<api.ProjectBillingInfo>(); | 112 var o = new core.List<api.ProjectBillingInfo>(); |
| 113 o.add(buildProjectBillingInfo()); | 113 o.add(buildProjectBillingInfo()); |
| 114 o.add(buildProjectBillingInfo()); | 114 o.add(buildProjectBillingInfo()); |
| 115 return o; | 115 return o; |
| 116 } | 116 } |
| 117 | 117 |
| 118 checkUnnamed38(core.List<api.ProjectBillingInfo> o) { | 118 checkUnnamed40(core.List<api.ProjectBillingInfo> o) { |
| 119 unittest.expect(o, unittest.hasLength(2)); | 119 unittest.expect(o, unittest.hasLength(2)); |
| 120 checkProjectBillingInfo(o[0]); | 120 checkProjectBillingInfo(o[0]); |
| 121 checkProjectBillingInfo(o[1]); | 121 checkProjectBillingInfo(o[1]); |
| 122 } | 122 } |
| 123 | 123 |
| 124 core.int buildCounterListProjectBillingInfoResponse = 0; | 124 core.int buildCounterListProjectBillingInfoResponse = 0; |
| 125 buildListProjectBillingInfoResponse() { | 125 buildListProjectBillingInfoResponse() { |
| 126 var o = new api.ListProjectBillingInfoResponse(); | 126 var o = new api.ListProjectBillingInfoResponse(); |
| 127 buildCounterListProjectBillingInfoResponse++; | 127 buildCounterListProjectBillingInfoResponse++; |
| 128 if (buildCounterListProjectBillingInfoResponse < 3) { | 128 if (buildCounterListProjectBillingInfoResponse < 3) { |
| 129 o.nextPageToken = "foo"; | 129 o.nextPageToken = "foo"; |
| 130 o.projectBillingInfo = buildUnnamed38(); | 130 o.projectBillingInfo = buildUnnamed40(); |
| 131 } | 131 } |
| 132 buildCounterListProjectBillingInfoResponse--; | 132 buildCounterListProjectBillingInfoResponse--; |
| 133 return o; | 133 return o; |
| 134 } | 134 } |
| 135 | 135 |
| 136 checkListProjectBillingInfoResponse(api.ListProjectBillingInfoResponse o) { | 136 checkListProjectBillingInfoResponse(api.ListProjectBillingInfoResponse o) { |
| 137 buildCounterListProjectBillingInfoResponse++; | 137 buildCounterListProjectBillingInfoResponse++; |
| 138 if (buildCounterListProjectBillingInfoResponse < 3) { | 138 if (buildCounterListProjectBillingInfoResponse < 3) { |
| 139 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 139 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 140 checkUnnamed38(o.projectBillingInfo); | 140 checkUnnamed40(o.projectBillingInfo); |
| 141 } | 141 } |
| 142 buildCounterListProjectBillingInfoResponse--; | 142 buildCounterListProjectBillingInfoResponse--; |
| 143 } | 143 } |
| 144 | 144 |
| 145 core.int buildCounterProjectBillingInfo = 0; | 145 core.int buildCounterProjectBillingInfo = 0; |
| 146 buildProjectBillingInfo() { | 146 buildProjectBillingInfo() { |
| 147 var o = new api.ProjectBillingInfo(); | 147 var o = new api.ProjectBillingInfo(); |
| 148 buildCounterProjectBillingInfo++; | 148 buildCounterProjectBillingInfo++; |
| 149 if (buildCounterProjectBillingInfo < 3) { | 149 if (buildCounterProjectBillingInfo < 3) { |
| 150 o.billingAccountName = "foo"; | 150 o.billingAccountName = "foo"; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 }); | 204 }); |
| 205 }); | 205 }); |
| 206 | 206 |
| 207 | 207 |
| 208 unittest.group("resource-BillingAccountsResourceApi", () { | 208 unittest.group("resource-BillingAccountsResourceApi", () { |
| 209 unittest.test("method--get", () { | 209 unittest.test("method--get", () { |
| 210 | 210 |
| 211 var mock = new HttpServerMock(); | 211 var mock = new HttpServerMock(); |
| 212 api.BillingAccountsResourceApi res = new api.CloudbillingApi(mock).billing
Accounts; | 212 api.BillingAccountsResourceApi res = new api.CloudbillingApi(mock).billing
Accounts; |
| 213 var arg_name = "foo"; | 213 var arg_name = "foo"; |
| 214 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 214 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 215 var path = (req.url).path; | 215 var path = (req.url).path; |
| 216 var pathOffset = 0; | 216 var pathOffset = 0; |
| 217 var index; | 217 var index; |
| 218 var subPart; | 218 var subPart; |
| 219 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 219 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 220 pathOffset += 1; | 220 pathOffset += 1; |
| 221 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 221 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 222 pathOffset += 3; | 222 pathOffset += 3; |
| 223 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 223 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 224 | 224 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 | 242 |
| 243 var h = { | 243 var h = { |
| 244 "content-type" : "application/json; charset=utf-8", | 244 "content-type" : "application/json; charset=utf-8", |
| 245 }; | 245 }; |
| 246 var resp = convert.JSON.encode(buildBillingAccount()); | 246 var resp = convert.JSON.encode(buildBillingAccount()); |
| 247 return new async.Future.value(stringResponse(200, h, resp)); | 247 return new async.Future.value(stringResponse(200, h, resp)); |
| 248 }), true); | 248 }), true); |
| 249 res.get(arg_name).then(unittest.expectAsync(((api.BillingAccount response)
{ | 249 res.get(arg_name).then(unittest.expectAsync1(((api.BillingAccount response
) { |
| 250 checkBillingAccount(response); | 250 checkBillingAccount(response); |
| 251 }))); | 251 }))); |
| 252 }); | 252 }); |
| 253 | 253 |
| 254 unittest.test("method--list", () { | 254 unittest.test("method--list", () { |
| 255 | 255 |
| 256 var mock = new HttpServerMock(); | 256 var mock = new HttpServerMock(); |
| 257 api.BillingAccountsResourceApi res = new api.CloudbillingApi(mock).billing
Accounts; | 257 api.BillingAccountsResourceApi res = new api.CloudbillingApi(mock).billing
Accounts; |
| 258 var arg_pageSize = 42; | 258 var arg_pageSize = 42; |
| 259 var arg_pageToken = "foo"; | 259 var arg_pageToken = "foo"; |
| 260 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 260 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 261 var path = (req.url).path; | 261 var path = (req.url).path; |
| 262 var pathOffset = 0; | 262 var pathOffset = 0; |
| 263 var index; | 263 var index; |
| 264 var subPart; | 264 var subPart; |
| 265 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 265 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 266 pathOffset += 1; | 266 pathOffset += 1; |
| 267 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v1/billingAccounts")); | 267 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v1/billingAccounts")); |
| 268 pathOffset += 18; | 268 pathOffset += 18; |
| 269 | 269 |
| 270 var query = (req.url).query; | 270 var query = (req.url).query; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 286 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 286 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 287 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 287 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 288 | 288 |
| 289 | 289 |
| 290 var h = { | 290 var h = { |
| 291 "content-type" : "application/json; charset=utf-8", | 291 "content-type" : "application/json; charset=utf-8", |
| 292 }; | 292 }; |
| 293 var resp = convert.JSON.encode(buildListBillingAccountsResponse()); | 293 var resp = convert.JSON.encode(buildListBillingAccountsResponse()); |
| 294 return new async.Future.value(stringResponse(200, h, resp)); | 294 return new async.Future.value(stringResponse(200, h, resp)); |
| 295 }), true); | 295 }), true); |
| 296 res.list(pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.e
xpectAsync(((api.ListBillingAccountsResponse response) { | 296 res.list(pageSize: arg_pageSize, pageToken: arg_pageToken).then(unittest.e
xpectAsync1(((api.ListBillingAccountsResponse response) { |
| 297 checkListBillingAccountsResponse(response); | 297 checkListBillingAccountsResponse(response); |
| 298 }))); | 298 }))); |
| 299 }); | 299 }); |
| 300 | 300 |
| 301 }); | 301 }); |
| 302 | 302 |
| 303 | 303 |
| 304 unittest.group("resource-BillingAccountsProjectsResourceApi", () { | 304 unittest.group("resource-BillingAccountsProjectsResourceApi", () { |
| 305 unittest.test("method--list", () { | 305 unittest.test("method--list", () { |
| 306 | 306 |
| 307 var mock = new HttpServerMock(); | 307 var mock = new HttpServerMock(); |
| 308 api.BillingAccountsProjectsResourceApi res = new api.CloudbillingApi(mock)
.billingAccounts.projects; | 308 api.BillingAccountsProjectsResourceApi res = new api.CloudbillingApi(mock)
.billingAccounts.projects; |
| 309 var arg_name = "foo"; | 309 var arg_name = "foo"; |
| 310 var arg_pageSize = 42; | 310 var arg_pageSize = 42; |
| 311 var arg_pageToken = "foo"; | 311 var arg_pageToken = "foo"; |
| 312 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 312 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 313 var path = (req.url).path; | 313 var path = (req.url).path; |
| 314 var pathOffset = 0; | 314 var pathOffset = 0; |
| 315 var index; | 315 var index; |
| 316 var subPart; | 316 var subPart; |
| 317 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 317 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 318 pathOffset += 1; | 318 pathOffset += 1; |
| 319 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 319 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 320 pathOffset += 3; | 320 pathOffset += 3; |
| 321 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 321 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 322 | 322 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 339 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 339 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 340 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 340 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 341 | 341 |
| 342 | 342 |
| 343 var h = { | 343 var h = { |
| 344 "content-type" : "application/json; charset=utf-8", | 344 "content-type" : "application/json; charset=utf-8", |
| 345 }; | 345 }; |
| 346 var resp = convert.JSON.encode(buildListProjectBillingInfoResponse()); | 346 var resp = convert.JSON.encode(buildListProjectBillingInfoResponse()); |
| 347 return new async.Future.value(stringResponse(200, h, resp)); | 347 return new async.Future.value(stringResponse(200, h, resp)); |
| 348 }), true); | 348 }), true); |
| 349 res.list(arg_name, pageSize: arg_pageSize, pageToken: arg_pageToken).then(
unittest.expectAsync(((api.ListProjectBillingInfoResponse response) { | 349 res.list(arg_name, pageSize: arg_pageSize, pageToken: arg_pageToken).then(
unittest.expectAsync1(((api.ListProjectBillingInfoResponse response) { |
| 350 checkListProjectBillingInfoResponse(response); | 350 checkListProjectBillingInfoResponse(response); |
| 351 }))); | 351 }))); |
| 352 }); | 352 }); |
| 353 | 353 |
| 354 }); | 354 }); |
| 355 | 355 |
| 356 | 356 |
| 357 unittest.group("resource-ProjectsResourceApi", () { | 357 unittest.group("resource-ProjectsResourceApi", () { |
| 358 unittest.test("method--getBillingInfo", () { | 358 unittest.test("method--getBillingInfo", () { |
| 359 | 359 |
| 360 var mock = new HttpServerMock(); | 360 var mock = new HttpServerMock(); |
| 361 api.ProjectsResourceApi res = new api.CloudbillingApi(mock).projects; | 361 api.ProjectsResourceApi res = new api.CloudbillingApi(mock).projects; |
| 362 var arg_name = "foo"; | 362 var arg_name = "foo"; |
| 363 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 363 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 364 var path = (req.url).path; | 364 var path = (req.url).path; |
| 365 var pathOffset = 0; | 365 var pathOffset = 0; |
| 366 var index; | 366 var index; |
| 367 var subPart; | 367 var subPart; |
| 368 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 368 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 369 pathOffset += 1; | 369 pathOffset += 1; |
| 370 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 370 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 371 pathOffset += 3; | 371 pathOffset += 3; |
| 372 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 372 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 373 | 373 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 var h = { | 392 var h = { |
| 393 "content-type" : "application/json; charset=utf-8", | 393 "content-type" : "application/json; charset=utf-8", |
| 394 }; | 394 }; |
| 395 var resp = convert.JSON.encode(buildProjectBillingInfo()); | 395 var resp = convert.JSON.encode(buildProjectBillingInfo()); |
| 396 return new async.Future.value(stringResponse(200, h, resp)); | 396 return new async.Future.value(stringResponse(200, h, resp)); |
| 397 }), true); | 397 }), true); |
| 398 res.getBillingInfo(arg_name).then(unittest.expectAsync(((api.ProjectBillin
gInfo response) { | 398 res.getBillingInfo(arg_name).then(unittest.expectAsync1(((api.ProjectBilli
ngInfo response) { |
| 399 checkProjectBillingInfo(response); | 399 checkProjectBillingInfo(response); |
| 400 }))); | 400 }))); |
| 401 }); | 401 }); |
| 402 | 402 |
| 403 unittest.test("method--updateBillingInfo", () { | 403 unittest.test("method--updateBillingInfo", () { |
| 404 | 404 |
| 405 var mock = new HttpServerMock(); | 405 var mock = new HttpServerMock(); |
| 406 api.ProjectsResourceApi res = new api.CloudbillingApi(mock).projects; | 406 api.ProjectsResourceApi res = new api.CloudbillingApi(mock).projects; |
| 407 var arg_request = buildProjectBillingInfo(); | 407 var arg_request = buildProjectBillingInfo(); |
| 408 var arg_name = "foo"; | 408 var arg_name = "foo"; |
| 409 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 409 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 410 var obj = new api.ProjectBillingInfo.fromJson(json); | 410 var obj = new api.ProjectBillingInfo.fromJson(json); |
| 411 checkProjectBillingInfo(obj); | 411 checkProjectBillingInfo(obj); |
| 412 | 412 |
| 413 var path = (req.url).path; | 413 var path = (req.url).path; |
| 414 var pathOffset = 0; | 414 var pathOffset = 0; |
| 415 var index; | 415 var index; |
| 416 var subPart; | 416 var subPart; |
| 417 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 417 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 418 pathOffset += 1; | 418 pathOffset += 1; |
| 419 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 419 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 | 440 |
| 441 var h = { | 441 var h = { |
| 442 "content-type" : "application/json; charset=utf-8", | 442 "content-type" : "application/json; charset=utf-8", |
| 443 }; | 443 }; |
| 444 var resp = convert.JSON.encode(buildProjectBillingInfo()); | 444 var resp = convert.JSON.encode(buildProjectBillingInfo()); |
| 445 return new async.Future.value(stringResponse(200, h, resp)); | 445 return new async.Future.value(stringResponse(200, h, resp)); |
| 446 }), true); | 446 }), true); |
| 447 res.updateBillingInfo(arg_request, arg_name).then(unittest.expectAsync(((a
pi.ProjectBillingInfo response) { | 447 res.updateBillingInfo(arg_request, arg_name).then(unittest.expectAsync1(((
api.ProjectBillingInfo response) { |
| 448 checkProjectBillingInfo(response); | 448 checkProjectBillingInfo(response); |
| 449 }))); | 449 }))); |
| 450 }); | 450 }); |
| 451 | 451 |
| 452 }); | 452 }); |
| 453 | 453 |
| 454 | 454 |
| 455 } | 455 } |
| 456 | 456 |
| OLD | NEW |