OLD | NEW |
1 library googleapis.runtimeconfig.v1.test; | 1 library googleapis.runtimeconfig.v1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return o; | 78 return o; |
79 } | 79 } |
80 | 80 |
81 checkEmpty(api.Empty o) { | 81 checkEmpty(api.Empty o) { |
82 buildCounterEmpty++; | 82 buildCounterEmpty++; |
83 if (buildCounterEmpty < 3) { | 83 if (buildCounterEmpty < 3) { |
84 } | 84 } |
85 buildCounterEmpty--; | 85 buildCounterEmpty--; |
86 } | 86 } |
87 | 87 |
88 buildUnnamed1782() { | 88 buildUnnamed1876() { |
89 var o = new core.List<api.Operation>(); | 89 var o = new core.List<api.Operation>(); |
90 o.add(buildOperation()); | 90 o.add(buildOperation()); |
91 o.add(buildOperation()); | 91 o.add(buildOperation()); |
92 return o; | 92 return o; |
93 } | 93 } |
94 | 94 |
95 checkUnnamed1782(core.List<api.Operation> o) { | 95 checkUnnamed1876(core.List<api.Operation> o) { |
96 unittest.expect(o, unittest.hasLength(2)); | 96 unittest.expect(o, unittest.hasLength(2)); |
97 checkOperation(o[0]); | 97 checkOperation(o[0]); |
98 checkOperation(o[1]); | 98 checkOperation(o[1]); |
99 } | 99 } |
100 | 100 |
101 core.int buildCounterListOperationsResponse = 0; | 101 core.int buildCounterListOperationsResponse = 0; |
102 buildListOperationsResponse() { | 102 buildListOperationsResponse() { |
103 var o = new api.ListOperationsResponse(); | 103 var o = new api.ListOperationsResponse(); |
104 buildCounterListOperationsResponse++; | 104 buildCounterListOperationsResponse++; |
105 if (buildCounterListOperationsResponse < 3) { | 105 if (buildCounterListOperationsResponse < 3) { |
106 o.nextPageToken = "foo"; | 106 o.nextPageToken = "foo"; |
107 o.operations = buildUnnamed1782(); | 107 o.operations = buildUnnamed1876(); |
108 } | 108 } |
109 buildCounterListOperationsResponse--; | 109 buildCounterListOperationsResponse--; |
110 return o; | 110 return o; |
111 } | 111 } |
112 | 112 |
113 checkListOperationsResponse(api.ListOperationsResponse o) { | 113 checkListOperationsResponse(api.ListOperationsResponse o) { |
114 buildCounterListOperationsResponse++; | 114 buildCounterListOperationsResponse++; |
115 if (buildCounterListOperationsResponse < 3) { | 115 if (buildCounterListOperationsResponse < 3) { |
116 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 116 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
117 checkUnnamed1782(o.operations); | 117 checkUnnamed1876(o.operations); |
118 } | 118 } |
119 buildCounterListOperationsResponse--; | 119 buildCounterListOperationsResponse--; |
120 } | 120 } |
121 | 121 |
122 buildUnnamed1783() { | 122 buildUnnamed1877() { |
123 var o = new core.Map<core.String, core.Object>(); | 123 var o = new core.Map<core.String, core.Object>(); |
124 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 124 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
125 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 125 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
126 return o; | 126 return o; |
127 } | 127 } |
128 | 128 |
129 checkUnnamed1783(core.Map<core.String, core.Object> o) { | 129 checkUnnamed1877(core.Map<core.String, core.Object> o) { |
130 unittest.expect(o, unittest.hasLength(2)); | 130 unittest.expect(o, unittest.hasLength(2)); |
131 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | 131 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); |
132 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | 132 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); |
133 } | 133 } |
134 | 134 |
135 buildUnnamed1784() { | 135 buildUnnamed1878() { |
136 var o = new core.Map<core.String, core.Object>(); | 136 var o = new core.Map<core.String, core.Object>(); |
137 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 137 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
138 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 138 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
139 return o; | 139 return o; |
140 } | 140 } |
141 | 141 |
142 checkUnnamed1784(core.Map<core.String, core.Object> o) { | 142 checkUnnamed1878(core.Map<core.String, core.Object> o) { |
143 unittest.expect(o, unittest.hasLength(2)); | 143 unittest.expect(o, unittest.hasLength(2)); |
144 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); | 144 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); |
145 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); | 145 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); |
146 } | 146 } |
147 | 147 |
148 core.int buildCounterOperation = 0; | 148 core.int buildCounterOperation = 0; |
149 buildOperation() { | 149 buildOperation() { |
150 var o = new api.Operation(); | 150 var o = new api.Operation(); |
151 buildCounterOperation++; | 151 buildCounterOperation++; |
152 if (buildCounterOperation < 3) { | 152 if (buildCounterOperation < 3) { |
153 o.done = true; | 153 o.done = true; |
154 o.error = buildStatus(); | 154 o.error = buildStatus(); |
155 o.metadata = buildUnnamed1783(); | 155 o.metadata = buildUnnamed1877(); |
156 o.name = "foo"; | 156 o.name = "foo"; |
157 o.response = buildUnnamed1784(); | 157 o.response = buildUnnamed1878(); |
158 } | 158 } |
159 buildCounterOperation--; | 159 buildCounterOperation--; |
160 return o; | 160 return o; |
161 } | 161 } |
162 | 162 |
163 checkOperation(api.Operation o) { | 163 checkOperation(api.Operation o) { |
164 buildCounterOperation++; | 164 buildCounterOperation++; |
165 if (buildCounterOperation < 3) { | 165 if (buildCounterOperation < 3) { |
166 unittest.expect(o.done, unittest.isTrue); | 166 unittest.expect(o.done, unittest.isTrue); |
167 checkStatus(o.error); | 167 checkStatus(o.error); |
168 checkUnnamed1783(o.metadata); | 168 checkUnnamed1877(o.metadata); |
169 unittest.expect(o.name, unittest.equals('foo')); | 169 unittest.expect(o.name, unittest.equals('foo')); |
170 checkUnnamed1784(o.response); | 170 checkUnnamed1878(o.response); |
171 } | 171 } |
172 buildCounterOperation--; | 172 buildCounterOperation--; |
173 } | 173 } |
174 | 174 |
175 buildUnnamed1785() { | 175 buildUnnamed1879() { |
176 var o = new core.Map<core.String, core.Object>(); | 176 var o = new core.Map<core.String, core.Object>(); |
177 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 177 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
178 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 178 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
179 return o; | 179 return o; |
180 } | 180 } |
181 | 181 |
182 checkUnnamed1785(core.Map<core.String, core.Object> o) { | 182 checkUnnamed1879(core.Map<core.String, core.Object> o) { |
183 unittest.expect(o, unittest.hasLength(2)); | 183 unittest.expect(o, unittest.hasLength(2)); |
184 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); | 184 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); |
185 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); | 185 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); |
186 } | 186 } |
187 | 187 |
188 buildUnnamed1786() { | 188 buildUnnamed1880() { |
189 var o = new core.List<core.Map<core.String, core.Object>>(); | 189 var o = new core.List<core.Map<core.String, core.Object>>(); |
190 o.add(buildUnnamed1785()); | 190 o.add(buildUnnamed1879()); |
191 o.add(buildUnnamed1785()); | 191 o.add(buildUnnamed1879()); |
192 return o; | 192 return o; |
193 } | 193 } |
194 | 194 |
195 checkUnnamed1786(core.List<core.Map<core.String, core.Object>> o) { | 195 checkUnnamed1880(core.List<core.Map<core.String, core.Object>> o) { |
196 unittest.expect(o, unittest.hasLength(2)); | 196 unittest.expect(o, unittest.hasLength(2)); |
197 checkUnnamed1785(o[0]); | 197 checkUnnamed1879(o[0]); |
198 checkUnnamed1785(o[1]); | 198 checkUnnamed1879(o[1]); |
199 } | 199 } |
200 | 200 |
201 core.int buildCounterStatus = 0; | 201 core.int buildCounterStatus = 0; |
202 buildStatus() { | 202 buildStatus() { |
203 var o = new api.Status(); | 203 var o = new api.Status(); |
204 buildCounterStatus++; | 204 buildCounterStatus++; |
205 if (buildCounterStatus < 3) { | 205 if (buildCounterStatus < 3) { |
206 o.code = 42; | 206 o.code = 42; |
207 o.details = buildUnnamed1786(); | 207 o.details = buildUnnamed1880(); |
208 o.message = "foo"; | 208 o.message = "foo"; |
209 } | 209 } |
210 buildCounterStatus--; | 210 buildCounterStatus--; |
211 return o; | 211 return o; |
212 } | 212 } |
213 | 213 |
214 checkStatus(api.Status o) { | 214 checkStatus(api.Status o) { |
215 buildCounterStatus++; | 215 buildCounterStatus++; |
216 if (buildCounterStatus < 3) { | 216 if (buildCounterStatus < 3) { |
217 unittest.expect(o.code, unittest.equals(42)); | 217 unittest.expect(o.code, unittest.equals(42)); |
218 checkUnnamed1786(o.details); | 218 checkUnnamed1880(o.details); |
219 unittest.expect(o.message, unittest.equals('foo')); | 219 unittest.expect(o.message, unittest.equals('foo')); |
220 } | 220 } |
221 buildCounterStatus--; | 221 buildCounterStatus--; |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 main() { | 225 main() { |
226 unittest.group("obj-schema-CancelOperationRequest", () { | 226 unittest.group("obj-schema-CancelOperationRequest", () { |
227 unittest.test("to-json--from-json", () { | 227 unittest.test("to-json--from-json", () { |
228 var o = buildCancelOperationRequest(); | 228 var o = buildCancelOperationRequest(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 res.delete(arg_name).then(unittest.expectAsync(((api.Empty response) { | 361 res.delete(arg_name).then(unittest.expectAsync(((api.Empty response) { |
362 checkEmpty(response); | 362 checkEmpty(response); |
363 }))); | 363 }))); |
364 }); | 364 }); |
365 | 365 |
366 unittest.test("method--list", () { | 366 unittest.test("method--list", () { |
367 | 367 |
368 var mock = new HttpServerMock(); | 368 var mock = new HttpServerMock(); |
369 api.OperationsResourceApi res = new api.RuntimeconfigApi(mock).operations; | 369 api.OperationsResourceApi res = new api.RuntimeconfigApi(mock).operations; |
370 var arg_name = "foo"; | 370 var arg_name = "foo"; |
| 371 var arg_pageToken = "foo"; |
371 var arg_pageSize = 42; | 372 var arg_pageSize = 42; |
372 var arg_filter = "foo"; | 373 var arg_filter = "foo"; |
373 var arg_pageToken = "foo"; | |
374 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 374 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
375 var path = (req.url).path; | 375 var path = (req.url).path; |
376 var pathOffset = 0; | 376 var pathOffset = 0; |
377 var index; | 377 var index; |
378 var subPart; | 378 var subPart; |
379 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 379 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
380 pathOffset += 1; | 380 pathOffset += 1; |
381 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 381 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
382 pathOffset += 3; | 382 pathOffset += 3; |
383 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 383 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
384 | 384 |
385 var query = (req.url).query; | 385 var query = (req.url).query; |
386 var queryOffset = 0; | 386 var queryOffset = 0; |
387 var queryMap = {}; | 387 var queryMap = {}; |
388 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 388 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
389 parseBool(n) { | 389 parseBool(n) { |
390 if (n == "true") return true; | 390 if (n == "true") return true; |
391 if (n == "false") return false; | 391 if (n == "false") return false; |
392 if (n == null) return null; | 392 if (n == null) return null; |
393 throw new core.ArgumentError("Invalid boolean: $n"); | 393 throw new core.ArgumentError("Invalid boolean: $n"); |
394 } | 394 } |
395 if (query.length > 0) { | 395 if (query.length > 0) { |
396 for (var part in query.split("&")) { | 396 for (var part in query.split("&")) { |
397 var keyvalue = part.split("="); | 397 var keyvalue = part.split("="); |
398 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 398 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
399 } | 399 } |
400 } | 400 } |
| 401 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
401 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 402 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
402 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 403 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
403 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
404 | 404 |
405 | 405 |
406 var h = { | 406 var h = { |
407 "content-type" : "application/json; charset=utf-8", | 407 "content-type" : "application/json; charset=utf-8", |
408 }; | 408 }; |
409 var resp = convert.JSON.encode(buildListOperationsResponse()); | 409 var resp = convert.JSON.encode(buildListOperationsResponse()); |
410 return new async.Future.value(stringResponse(200, h, resp)); | 410 return new async.Future.value(stringResponse(200, h, resp)); |
411 }), true); | 411 }), true); |
412 res.list(arg_name, pageSize: arg_pageSize, filter: arg_filter, pageToken:
arg_pageToken).then(unittest.expectAsync(((api.ListOperationsResponse response)
{ | 412 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize, filte
r: arg_filter).then(unittest.expectAsync(((api.ListOperationsResponse response)
{ |
413 checkListOperationsResponse(response); | 413 checkListOperationsResponse(response); |
414 }))); | 414 }))); |
415 }); | 415 }); |
416 | 416 |
417 }); | 417 }); |
418 | 418 |
419 | 419 |
420 } | 420 } |
421 | 421 |
OLD | NEW |