| OLD | NEW |
| 1 library googleapis.siteVerification.v1.test; | 1 library googleapis.siteVerification.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/siteverification/v1.dart' as api; | 12 import 'package:googleapis/siteverification/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 buildCounterSiteVerificationWebResourceGettokenRequestSite = 0; | 54 core.int buildCounterSiteVerificationWebResourceGettokenRequestSite = 0; |
| 55 buildSiteVerificationWebResourceGettokenRequestSite() { | 55 buildSiteVerificationWebResourceGettokenRequestSite() { |
| 56 var o = new api.SiteVerificationWebResourceGettokenRequestSite(); | 56 var o = new api.SiteVerificationWebResourceGettokenRequestSite(); |
| 57 buildCounterSiteVerificationWebResourceGettokenRequestSite++; | 57 buildCounterSiteVerificationWebResourceGettokenRequestSite++; |
| 58 if (buildCounterSiteVerificationWebResourceGettokenRequestSite < 3) { | 58 if (buildCounterSiteVerificationWebResourceGettokenRequestSite < 3) { |
| 59 o.identifier = "foo"; | 59 o.identifier = "foo"; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 checkSiteVerificationWebResourceGettokenResponse(api.SiteVerificationWebResource
GettokenResponse o) { | 108 checkSiteVerificationWebResourceGettokenResponse(api.SiteVerificationWebResource
GettokenResponse o) { |
| 109 buildCounterSiteVerificationWebResourceGettokenResponse++; | 109 buildCounterSiteVerificationWebResourceGettokenResponse++; |
| 110 if (buildCounterSiteVerificationWebResourceGettokenResponse < 3) { | 110 if (buildCounterSiteVerificationWebResourceGettokenResponse < 3) { |
| 111 unittest.expect(o.method, unittest.equals('foo')); | 111 unittest.expect(o.method, unittest.equals('foo')); |
| 112 unittest.expect(o.token, unittest.equals('foo')); | 112 unittest.expect(o.token, unittest.equals('foo')); |
| 113 } | 113 } |
| 114 buildCounterSiteVerificationWebResourceGettokenResponse--; | 114 buildCounterSiteVerificationWebResourceGettokenResponse--; |
| 115 } | 115 } |
| 116 | 116 |
| 117 buildUnnamed109() { | 117 buildUnnamed111() { |
| 118 var o = new core.List<api.SiteVerificationWebResourceResource>(); | 118 var o = new core.List<api.SiteVerificationWebResourceResource>(); |
| 119 o.add(buildSiteVerificationWebResourceResource()); | 119 o.add(buildSiteVerificationWebResourceResource()); |
| 120 o.add(buildSiteVerificationWebResourceResource()); | 120 o.add(buildSiteVerificationWebResourceResource()); |
| 121 return o; | 121 return o; |
| 122 } | 122 } |
| 123 | 123 |
| 124 checkUnnamed109(core.List<api.SiteVerificationWebResourceResource> o) { | 124 checkUnnamed111(core.List<api.SiteVerificationWebResourceResource> o) { |
| 125 unittest.expect(o, unittest.hasLength(2)); | 125 unittest.expect(o, unittest.hasLength(2)); |
| 126 checkSiteVerificationWebResourceResource(o[0]); | 126 checkSiteVerificationWebResourceResource(o[0]); |
| 127 checkSiteVerificationWebResourceResource(o[1]); | 127 checkSiteVerificationWebResourceResource(o[1]); |
| 128 } | 128 } |
| 129 | 129 |
| 130 core.int buildCounterSiteVerificationWebResourceListResponse = 0; | 130 core.int buildCounterSiteVerificationWebResourceListResponse = 0; |
| 131 buildSiteVerificationWebResourceListResponse() { | 131 buildSiteVerificationWebResourceListResponse() { |
| 132 var o = new api.SiteVerificationWebResourceListResponse(); | 132 var o = new api.SiteVerificationWebResourceListResponse(); |
| 133 buildCounterSiteVerificationWebResourceListResponse++; | 133 buildCounterSiteVerificationWebResourceListResponse++; |
| 134 if (buildCounterSiteVerificationWebResourceListResponse < 3) { | 134 if (buildCounterSiteVerificationWebResourceListResponse < 3) { |
| 135 o.items = buildUnnamed109(); | 135 o.items = buildUnnamed111(); |
| 136 } | 136 } |
| 137 buildCounterSiteVerificationWebResourceListResponse--; | 137 buildCounterSiteVerificationWebResourceListResponse--; |
| 138 return o; | 138 return o; |
| 139 } | 139 } |
| 140 | 140 |
| 141 checkSiteVerificationWebResourceListResponse(api.SiteVerificationWebResourceList
Response o) { | 141 checkSiteVerificationWebResourceListResponse(api.SiteVerificationWebResourceList
Response o) { |
| 142 buildCounterSiteVerificationWebResourceListResponse++; | 142 buildCounterSiteVerificationWebResourceListResponse++; |
| 143 if (buildCounterSiteVerificationWebResourceListResponse < 3) { | 143 if (buildCounterSiteVerificationWebResourceListResponse < 3) { |
| 144 checkUnnamed109(o.items); | 144 checkUnnamed111(o.items); |
| 145 } | 145 } |
| 146 buildCounterSiteVerificationWebResourceListResponse--; | 146 buildCounterSiteVerificationWebResourceListResponse--; |
| 147 } | 147 } |
| 148 | 148 |
| 149 buildUnnamed110() { | 149 buildUnnamed112() { |
| 150 var o = new core.List<core.String>(); | 150 var o = new core.List<core.String>(); |
| 151 o.add("foo"); | 151 o.add("foo"); |
| 152 o.add("foo"); | 152 o.add("foo"); |
| 153 return o; | 153 return o; |
| 154 } | 154 } |
| 155 | 155 |
| 156 checkUnnamed110(core.List<core.String> o) { | 156 checkUnnamed112(core.List<core.String> o) { |
| 157 unittest.expect(o, unittest.hasLength(2)); | 157 unittest.expect(o, unittest.hasLength(2)); |
| 158 unittest.expect(o[0], unittest.equals('foo')); | 158 unittest.expect(o[0], unittest.equals('foo')); |
| 159 unittest.expect(o[1], unittest.equals('foo')); | 159 unittest.expect(o[1], unittest.equals('foo')); |
| 160 } | 160 } |
| 161 | 161 |
| 162 core.int buildCounterSiteVerificationWebResourceResourceSite = 0; | 162 core.int buildCounterSiteVerificationWebResourceResourceSite = 0; |
| 163 buildSiteVerificationWebResourceResourceSite() { | 163 buildSiteVerificationWebResourceResourceSite() { |
| 164 var o = new api.SiteVerificationWebResourceResourceSite(); | 164 var o = new api.SiteVerificationWebResourceResourceSite(); |
| 165 buildCounterSiteVerificationWebResourceResourceSite++; | 165 buildCounterSiteVerificationWebResourceResourceSite++; |
| 166 if (buildCounterSiteVerificationWebResourceResourceSite < 3) { | 166 if (buildCounterSiteVerificationWebResourceResourceSite < 3) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 179 } | 179 } |
| 180 buildCounterSiteVerificationWebResourceResourceSite--; | 180 buildCounterSiteVerificationWebResourceResourceSite--; |
| 181 } | 181 } |
| 182 | 182 |
| 183 core.int buildCounterSiteVerificationWebResourceResource = 0; | 183 core.int buildCounterSiteVerificationWebResourceResource = 0; |
| 184 buildSiteVerificationWebResourceResource() { | 184 buildSiteVerificationWebResourceResource() { |
| 185 var o = new api.SiteVerificationWebResourceResource(); | 185 var o = new api.SiteVerificationWebResourceResource(); |
| 186 buildCounterSiteVerificationWebResourceResource++; | 186 buildCounterSiteVerificationWebResourceResource++; |
| 187 if (buildCounterSiteVerificationWebResourceResource < 3) { | 187 if (buildCounterSiteVerificationWebResourceResource < 3) { |
| 188 o.id = "foo"; | 188 o.id = "foo"; |
| 189 o.owners = buildUnnamed110(); | 189 o.owners = buildUnnamed112(); |
| 190 o.site = buildSiteVerificationWebResourceResourceSite(); | 190 o.site = buildSiteVerificationWebResourceResourceSite(); |
| 191 } | 191 } |
| 192 buildCounterSiteVerificationWebResourceResource--; | 192 buildCounterSiteVerificationWebResourceResource--; |
| 193 return o; | 193 return o; |
| 194 } | 194 } |
| 195 | 195 |
| 196 checkSiteVerificationWebResourceResource(api.SiteVerificationWebResourceResource
o) { | 196 checkSiteVerificationWebResourceResource(api.SiteVerificationWebResourceResource
o) { |
| 197 buildCounterSiteVerificationWebResourceResource++; | 197 buildCounterSiteVerificationWebResourceResource++; |
| 198 if (buildCounterSiteVerificationWebResourceResource < 3) { | 198 if (buildCounterSiteVerificationWebResourceResource < 3) { |
| 199 unittest.expect(o.id, unittest.equals('foo')); | 199 unittest.expect(o.id, unittest.equals('foo')); |
| 200 checkUnnamed110(o.owners); | 200 checkUnnamed112(o.owners); |
| 201 checkSiteVerificationWebResourceResourceSite(o.site); | 201 checkSiteVerificationWebResourceResourceSite(o.site); |
| 202 } | 202 } |
| 203 buildCounterSiteVerificationWebResourceResource--; | 203 buildCounterSiteVerificationWebResourceResource--; |
| 204 } | 204 } |
| 205 | 205 |
| 206 | 206 |
| 207 main() { | 207 main() { |
| 208 unittest.group("obj-schema-SiteVerificationWebResourceGettokenRequestSite", ()
{ | 208 unittest.group("obj-schema-SiteVerificationWebResourceGettokenRequestSite", ()
{ |
| 209 unittest.test("to-json--from-json", () { | 209 unittest.test("to-json--from-json", () { |
| 210 var o = buildSiteVerificationWebResourceGettokenRequestSite(); | 210 var o = buildSiteVerificationWebResourceGettokenRequestSite(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 }); | 258 }); |
| 259 }); | 259 }); |
| 260 | 260 |
| 261 | 261 |
| 262 unittest.group("resource-WebResourceResourceApi", () { | 262 unittest.group("resource-WebResourceResourceApi", () { |
| 263 unittest.test("method--delete", () { | 263 unittest.test("method--delete", () { |
| 264 | 264 |
| 265 var mock = new HttpServerMock(); | 265 var mock = new HttpServerMock(); |
| 266 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; | 266 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; |
| 267 var arg_id = "foo"; | 267 var arg_id = "foo"; |
| 268 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 268 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 269 var path = (req.url).path; | 269 var path = (req.url).path; |
| 270 var pathOffset = 0; | 270 var pathOffset = 0; |
| 271 var index; | 271 var index; |
| 272 var subPart; | 272 var subPart; |
| 273 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 273 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 274 pathOffset += 1; | 274 pathOffset += 1; |
| 275 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); | 275 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); |
| 276 pathOffset += 20; | 276 pathOffset += 20; |
| 277 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("webResource/")); | 277 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("webResource/")); |
| 278 pathOffset += 12; | 278 pathOffset += 12; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 | 300 |
| 301 var h = { | 301 var h = { |
| 302 "content-type" : "application/json; charset=utf-8", | 302 "content-type" : "application/json; charset=utf-8", |
| 303 }; | 303 }; |
| 304 var resp = ""; | 304 var resp = ""; |
| 305 return new async.Future.value(stringResponse(200, h, resp)); | 305 return new async.Future.value(stringResponse(200, h, resp)); |
| 306 }), true); | 306 }), true); |
| 307 res.delete(arg_id).then(unittest.expectAsync((_) {})); | 307 res.delete(arg_id).then(unittest.expectAsync1((_) {})); |
| 308 }); | 308 }); |
| 309 | 309 |
| 310 unittest.test("method--get", () { | 310 unittest.test("method--get", () { |
| 311 | 311 |
| 312 var mock = new HttpServerMock(); | 312 var mock = new HttpServerMock(); |
| 313 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; | 313 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; |
| 314 var arg_id = "foo"; | 314 var arg_id = "foo"; |
| 315 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 315 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 316 var path = (req.url).path; | 316 var path = (req.url).path; |
| 317 var pathOffset = 0; | 317 var pathOffset = 0; |
| 318 var index; | 318 var index; |
| 319 var subPart; | 319 var subPart; |
| 320 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 320 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 321 pathOffset += 1; | 321 pathOffset += 1; |
| 322 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); | 322 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); |
| 323 pathOffset += 20; | 323 pathOffset += 20; |
| 324 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("webResource/")); | 324 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("webResource/")); |
| 325 pathOffset += 12; | 325 pathOffset += 12; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 344 } | 344 } |
| 345 } | 345 } |
| 346 | 346 |
| 347 | 347 |
| 348 var h = { | 348 var h = { |
| 349 "content-type" : "application/json; charset=utf-8", | 349 "content-type" : "application/json; charset=utf-8", |
| 350 }; | 350 }; |
| 351 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); | 351 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); |
| 352 return new async.Future.value(stringResponse(200, h, resp)); | 352 return new async.Future.value(stringResponse(200, h, resp)); |
| 353 }), true); | 353 }), true); |
| 354 res.get(arg_id).then(unittest.expectAsync(((api.SiteVerificationWebResourc
eResource response) { | 354 res.get(arg_id).then(unittest.expectAsync1(((api.SiteVerificationWebResour
ceResource response) { |
| 355 checkSiteVerificationWebResourceResource(response); | 355 checkSiteVerificationWebResourceResource(response); |
| 356 }))); | 356 }))); |
| 357 }); | 357 }); |
| 358 | 358 |
| 359 unittest.test("method--getToken", () { | 359 unittest.test("method--getToken", () { |
| 360 | 360 |
| 361 var mock = new HttpServerMock(); | 361 var mock = new HttpServerMock(); |
| 362 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; | 362 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; |
| 363 var arg_request = buildSiteVerificationWebResourceGettokenRequest(); | 363 var arg_request = buildSiteVerificationWebResourceGettokenRequest(); |
| 364 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 364 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 365 var obj = new api.SiteVerificationWebResourceGettokenRequest.fromJson(js
on); | 365 var obj = new api.SiteVerificationWebResourceGettokenRequest.fromJson(js
on); |
| 366 checkSiteVerificationWebResourceGettokenRequest(obj); | 366 checkSiteVerificationWebResourceGettokenRequest(obj); |
| 367 | 367 |
| 368 var path = (req.url).path; | 368 var path = (req.url).path; |
| 369 var pathOffset = 0; | 369 var pathOffset = 0; |
| 370 var index; | 370 var index; |
| 371 var subPart; | 371 var subPart; |
| 372 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 372 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 373 pathOffset += 1; | 373 pathOffset += 1; |
| 374 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); | 374 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 | 395 |
| 396 | 396 |
| 397 var h = { | 397 var h = { |
| 398 "content-type" : "application/json; charset=utf-8", | 398 "content-type" : "application/json; charset=utf-8", |
| 399 }; | 399 }; |
| 400 var resp = convert.JSON.encode(buildSiteVerificationWebResourceGettokenR
esponse()); | 400 var resp = convert.JSON.encode(buildSiteVerificationWebResourceGettokenR
esponse()); |
| 401 return new async.Future.value(stringResponse(200, h, resp)); | 401 return new async.Future.value(stringResponse(200, h, resp)); |
| 402 }), true); | 402 }), true); |
| 403 res.getToken(arg_request).then(unittest.expectAsync(((api.SiteVerification
WebResourceGettokenResponse response) { | 403 res.getToken(arg_request).then(unittest.expectAsync1(((api.SiteVerificatio
nWebResourceGettokenResponse response) { |
| 404 checkSiteVerificationWebResourceGettokenResponse(response); | 404 checkSiteVerificationWebResourceGettokenResponse(response); |
| 405 }))); | 405 }))); |
| 406 }); | 406 }); |
| 407 | 407 |
| 408 unittest.test("method--insert", () { | 408 unittest.test("method--insert", () { |
| 409 | 409 |
| 410 var mock = new HttpServerMock(); | 410 var mock = new HttpServerMock(); |
| 411 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; | 411 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; |
| 412 var arg_request = buildSiteVerificationWebResourceResource(); | 412 var arg_request = buildSiteVerificationWebResourceResource(); |
| 413 var arg_verificationMethod = "foo"; | 413 var arg_verificationMethod = "foo"; |
| 414 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 414 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 415 var obj = new api.SiteVerificationWebResourceResource.fromJson(json); | 415 var obj = new api.SiteVerificationWebResourceResource.fromJson(json); |
| 416 checkSiteVerificationWebResourceResource(obj); | 416 checkSiteVerificationWebResourceResource(obj); |
| 417 | 417 |
| 418 var path = (req.url).path; | 418 var path = (req.url).path; |
| 419 var pathOffset = 0; | 419 var pathOffset = 0; |
| 420 var index; | 420 var index; |
| 421 var subPart; | 421 var subPart; |
| 422 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 422 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 423 pathOffset += 1; | 423 pathOffset += 1; |
| 424 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); | 424 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 444 } | 444 } |
| 445 unittest.expect(queryMap["verificationMethod"].first, unittest.equals(ar
g_verificationMethod)); | 445 unittest.expect(queryMap["verificationMethod"].first, unittest.equals(ar
g_verificationMethod)); |
| 446 | 446 |
| 447 | 447 |
| 448 var h = { | 448 var h = { |
| 449 "content-type" : "application/json; charset=utf-8", | 449 "content-type" : "application/json; charset=utf-8", |
| 450 }; | 450 }; |
| 451 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); | 451 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); |
| 452 return new async.Future.value(stringResponse(200, h, resp)); | 452 return new async.Future.value(stringResponse(200, h, resp)); |
| 453 }), true); | 453 }), true); |
| 454 res.insert(arg_request, arg_verificationMethod).then(unittest.expectAsync(
((api.SiteVerificationWebResourceResource response) { | 454 res.insert(arg_request, arg_verificationMethod).then(unittest.expectAsync1
(((api.SiteVerificationWebResourceResource response) { |
| 455 checkSiteVerificationWebResourceResource(response); | 455 checkSiteVerificationWebResourceResource(response); |
| 456 }))); | 456 }))); |
| 457 }); | 457 }); |
| 458 | 458 |
| 459 unittest.test("method--list", () { | 459 unittest.test("method--list", () { |
| 460 | 460 |
| 461 var mock = new HttpServerMock(); | 461 var mock = new HttpServerMock(); |
| 462 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; | 462 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; |
| 463 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 463 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 464 var path = (req.url).path; | 464 var path = (req.url).path; |
| 465 var pathOffset = 0; | 465 var pathOffset = 0; |
| 466 var index; | 466 var index; |
| 467 var subPart; | 467 var subPart; |
| 468 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 468 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 469 pathOffset += 1; | 469 pathOffset += 1; |
| 470 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); | 470 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); |
| 471 pathOffset += 20; | 471 pathOffset += 20; |
| 472 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("webResource")); | 472 unittest.expect(path.substring(pathOffset, pathOffset + 11), unittest.eq
uals("webResource")); |
| 473 pathOffset += 11; | 473 pathOffset += 11; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 | 491 |
| 492 | 492 |
| 493 var h = { | 493 var h = { |
| 494 "content-type" : "application/json; charset=utf-8", | 494 "content-type" : "application/json; charset=utf-8", |
| 495 }; | 495 }; |
| 496 var resp = convert.JSON.encode(buildSiteVerificationWebResourceListRespo
nse()); | 496 var resp = convert.JSON.encode(buildSiteVerificationWebResourceListRespo
nse()); |
| 497 return new async.Future.value(stringResponse(200, h, resp)); | 497 return new async.Future.value(stringResponse(200, h, resp)); |
| 498 }), true); | 498 }), true); |
| 499 res.list().then(unittest.expectAsync(((api.SiteVerificationWebResourceList
Response response) { | 499 res.list().then(unittest.expectAsync1(((api.SiteVerificationWebResourceLis
tResponse response) { |
| 500 checkSiteVerificationWebResourceListResponse(response); | 500 checkSiteVerificationWebResourceListResponse(response); |
| 501 }))); | 501 }))); |
| 502 }); | 502 }); |
| 503 | 503 |
| 504 unittest.test("method--patch", () { | 504 unittest.test("method--patch", () { |
| 505 | 505 |
| 506 var mock = new HttpServerMock(); | 506 var mock = new HttpServerMock(); |
| 507 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; | 507 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; |
| 508 var arg_request = buildSiteVerificationWebResourceResource(); | 508 var arg_request = buildSiteVerificationWebResourceResource(); |
| 509 var arg_id = "foo"; | 509 var arg_id = "foo"; |
| 510 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 510 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 511 var obj = new api.SiteVerificationWebResourceResource.fromJson(json); | 511 var obj = new api.SiteVerificationWebResourceResource.fromJson(json); |
| 512 checkSiteVerificationWebResourceResource(obj); | 512 checkSiteVerificationWebResourceResource(obj); |
| 513 | 513 |
| 514 var path = (req.url).path; | 514 var path = (req.url).path; |
| 515 var pathOffset = 0; | 515 var pathOffset = 0; |
| 516 var index; | 516 var index; |
| 517 var subPart; | 517 var subPart; |
| 518 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 518 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 519 pathOffset += 1; | 519 pathOffset += 1; |
| 520 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); | 520 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 542 } | 542 } |
| 543 } | 543 } |
| 544 | 544 |
| 545 | 545 |
| 546 var h = { | 546 var h = { |
| 547 "content-type" : "application/json; charset=utf-8", | 547 "content-type" : "application/json; charset=utf-8", |
| 548 }; | 548 }; |
| 549 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); | 549 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); |
| 550 return new async.Future.value(stringResponse(200, h, resp)); | 550 return new async.Future.value(stringResponse(200, h, resp)); |
| 551 }), true); | 551 }), true); |
| 552 res.patch(arg_request, arg_id).then(unittest.expectAsync(((api.SiteVerific
ationWebResourceResource response) { | 552 res.patch(arg_request, arg_id).then(unittest.expectAsync1(((api.SiteVerifi
cationWebResourceResource response) { |
| 553 checkSiteVerificationWebResourceResource(response); | 553 checkSiteVerificationWebResourceResource(response); |
| 554 }))); | 554 }))); |
| 555 }); | 555 }); |
| 556 | 556 |
| 557 unittest.test("method--update", () { | 557 unittest.test("method--update", () { |
| 558 | 558 |
| 559 var mock = new HttpServerMock(); | 559 var mock = new HttpServerMock(); |
| 560 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; | 560 api.WebResourceResourceApi res = new api.SiteVerificationApi(mock).webReso
urce; |
| 561 var arg_request = buildSiteVerificationWebResourceResource(); | 561 var arg_request = buildSiteVerificationWebResourceResource(); |
| 562 var arg_id = "foo"; | 562 var arg_id = "foo"; |
| 563 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 563 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 564 var obj = new api.SiteVerificationWebResourceResource.fromJson(json); | 564 var obj = new api.SiteVerificationWebResourceResource.fromJson(json); |
| 565 checkSiteVerificationWebResourceResource(obj); | 565 checkSiteVerificationWebResourceResource(obj); |
| 566 | 566 |
| 567 var path = (req.url).path; | 567 var path = (req.url).path; |
| 568 var pathOffset = 0; | 568 var pathOffset = 0; |
| 569 var index; | 569 var index; |
| 570 var subPart; | 570 var subPart; |
| 571 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 571 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 572 pathOffset += 1; | 572 pathOffset += 1; |
| 573 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); | 573 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("siteVerification/v1/")); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 | 597 |
| 598 | 598 |
| 599 var h = { | 599 var h = { |
| 600 "content-type" : "application/json; charset=utf-8", | 600 "content-type" : "application/json; charset=utf-8", |
| 601 }; | 601 }; |
| 602 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); | 602 var resp = convert.JSON.encode(buildSiteVerificationWebResourceResource(
)); |
| 603 return new async.Future.value(stringResponse(200, h, resp)); | 603 return new async.Future.value(stringResponse(200, h, resp)); |
| 604 }), true); | 604 }), true); |
| 605 res.update(arg_request, arg_id).then(unittest.expectAsync(((api.SiteVerifi
cationWebResourceResource response) { | 605 res.update(arg_request, arg_id).then(unittest.expectAsync1(((api.SiteVerif
icationWebResourceResource response) { |
| 606 checkSiteVerificationWebResourceResource(response); | 606 checkSiteVerificationWebResourceResource(response); |
| 607 }))); | 607 }))); |
| 608 }); | 608 }); |
| 609 | 609 |
| 610 }); | 610 }); |
| 611 | 611 |
| 612 | 612 |
| 613 } | 613 } |
| 614 | 614 |
| OLD | NEW |