OLD | NEW |
1 library googleapis_beta.dns.v1beta1.test; | 1 library googleapis_beta.dns.v1beta1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
11 import 'package:googleapis_beta/common/common.dart' as common; | |
12 import 'package:googleapis_beta/src/common_internal.dart' as common_internal; | |
13 import '../common/common_internal_test.dart' as common_test; | |
14 | 11 |
15 import 'package:googleapis_beta/dns/v1beta1.dart' as api; | 12 import 'package:googleapis_beta/dns/v1beta1.dart' as api; |
16 | 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
18 | 22 |
19 buildUnnamed1590() { | 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 53 |
| 54 buildUnnamed1585() { |
20 var o = new core.List<api.ResourceRecordSet>(); | 55 var o = new core.List<api.ResourceRecordSet>(); |
21 o.add(buildResourceRecordSet()); | 56 o.add(buildResourceRecordSet()); |
22 o.add(buildResourceRecordSet()); | 57 o.add(buildResourceRecordSet()); |
23 return o; | 58 return o; |
24 } | 59 } |
25 | 60 |
26 checkUnnamed1590(core.List<api.ResourceRecordSet> o) { | 61 checkUnnamed1585(core.List<api.ResourceRecordSet> o) { |
27 unittest.expect(o, unittest.hasLength(2)); | 62 unittest.expect(o, unittest.hasLength(2)); |
28 checkResourceRecordSet(o[0]); | 63 checkResourceRecordSet(o[0]); |
29 checkResourceRecordSet(o[1]); | 64 checkResourceRecordSet(o[1]); |
30 } | 65 } |
31 | 66 |
32 buildUnnamed1591() { | 67 buildUnnamed1586() { |
33 var o = new core.List<api.ResourceRecordSet>(); | 68 var o = new core.List<api.ResourceRecordSet>(); |
34 o.add(buildResourceRecordSet()); | 69 o.add(buildResourceRecordSet()); |
35 o.add(buildResourceRecordSet()); | 70 o.add(buildResourceRecordSet()); |
36 return o; | 71 return o; |
37 } | 72 } |
38 | 73 |
39 checkUnnamed1591(core.List<api.ResourceRecordSet> o) { | 74 checkUnnamed1586(core.List<api.ResourceRecordSet> o) { |
40 unittest.expect(o, unittest.hasLength(2)); | 75 unittest.expect(o, unittest.hasLength(2)); |
41 checkResourceRecordSet(o[0]); | 76 checkResourceRecordSet(o[0]); |
42 checkResourceRecordSet(o[1]); | 77 checkResourceRecordSet(o[1]); |
43 } | 78 } |
44 | 79 |
45 core.int buildCounterChange = 0; | 80 core.int buildCounterChange = 0; |
46 buildChange() { | 81 buildChange() { |
47 var o = new api.Change(); | 82 var o = new api.Change(); |
48 buildCounterChange++; | 83 buildCounterChange++; |
49 if (buildCounterChange < 3) { | 84 if (buildCounterChange < 3) { |
50 o.additions = buildUnnamed1590(); | 85 o.additions = buildUnnamed1585(); |
51 o.deletions = buildUnnamed1591(); | 86 o.deletions = buildUnnamed1586(); |
52 o.id = "foo"; | 87 o.id = "foo"; |
53 o.kind = "foo"; | 88 o.kind = "foo"; |
54 o.startTime = "foo"; | 89 o.startTime = "foo"; |
55 o.status = "foo"; | 90 o.status = "foo"; |
56 } | 91 } |
57 buildCounterChange--; | 92 buildCounterChange--; |
58 return o; | 93 return o; |
59 } | 94 } |
60 | 95 |
61 checkChange(api.Change o) { | 96 checkChange(api.Change o) { |
62 buildCounterChange++; | 97 buildCounterChange++; |
63 if (buildCounterChange < 3) { | 98 if (buildCounterChange < 3) { |
64 checkUnnamed1590(o.additions); | 99 checkUnnamed1585(o.additions); |
65 checkUnnamed1591(o.deletions); | 100 checkUnnamed1586(o.deletions); |
66 unittest.expect(o.id, unittest.equals('foo')); | 101 unittest.expect(o.id, unittest.equals('foo')); |
67 unittest.expect(o.kind, unittest.equals('foo')); | 102 unittest.expect(o.kind, unittest.equals('foo')); |
68 unittest.expect(o.startTime, unittest.equals('foo')); | 103 unittest.expect(o.startTime, unittest.equals('foo')); |
69 unittest.expect(o.status, unittest.equals('foo')); | 104 unittest.expect(o.status, unittest.equals('foo')); |
70 } | 105 } |
71 buildCounterChange--; | 106 buildCounterChange--; |
72 } | 107 } |
73 | 108 |
74 buildUnnamed1592() { | 109 buildUnnamed1587() { |
75 var o = new core.List<api.Change>(); | 110 var o = new core.List<api.Change>(); |
76 o.add(buildChange()); | 111 o.add(buildChange()); |
77 o.add(buildChange()); | 112 o.add(buildChange()); |
78 return o; | 113 return o; |
79 } | 114 } |
80 | 115 |
81 checkUnnamed1592(core.List<api.Change> o) { | 116 checkUnnamed1587(core.List<api.Change> o) { |
82 unittest.expect(o, unittest.hasLength(2)); | 117 unittest.expect(o, unittest.hasLength(2)); |
83 checkChange(o[0]); | 118 checkChange(o[0]); |
84 checkChange(o[1]); | 119 checkChange(o[1]); |
85 } | 120 } |
86 | 121 |
87 core.int buildCounterChangesListResponse = 0; | 122 core.int buildCounterChangesListResponse = 0; |
88 buildChangesListResponse() { | 123 buildChangesListResponse() { |
89 var o = new api.ChangesListResponse(); | 124 var o = new api.ChangesListResponse(); |
90 buildCounterChangesListResponse++; | 125 buildCounterChangesListResponse++; |
91 if (buildCounterChangesListResponse < 3) { | 126 if (buildCounterChangesListResponse < 3) { |
92 o.changes = buildUnnamed1592(); | 127 o.changes = buildUnnamed1587(); |
93 o.kind = "foo"; | 128 o.kind = "foo"; |
94 o.nextPageToken = "foo"; | 129 o.nextPageToken = "foo"; |
95 } | 130 } |
96 buildCounterChangesListResponse--; | 131 buildCounterChangesListResponse--; |
97 return o; | 132 return o; |
98 } | 133 } |
99 | 134 |
100 checkChangesListResponse(api.ChangesListResponse o) { | 135 checkChangesListResponse(api.ChangesListResponse o) { |
101 buildCounterChangesListResponse++; | 136 buildCounterChangesListResponse++; |
102 if (buildCounterChangesListResponse < 3) { | 137 if (buildCounterChangesListResponse < 3) { |
103 checkUnnamed1592(o.changes); | 138 checkUnnamed1587(o.changes); |
104 unittest.expect(o.kind, unittest.equals('foo')); | 139 unittest.expect(o.kind, unittest.equals('foo')); |
105 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 140 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
106 } | 141 } |
107 buildCounterChangesListResponse--; | 142 buildCounterChangesListResponse--; |
108 } | 143 } |
109 | 144 |
110 buildUnnamed1593() { | 145 buildUnnamed1588() { |
111 var o = new core.List<core.String>(); | 146 var o = new core.List<core.String>(); |
112 o.add("foo"); | 147 o.add("foo"); |
113 o.add("foo"); | 148 o.add("foo"); |
114 return o; | 149 return o; |
115 } | 150 } |
116 | 151 |
117 checkUnnamed1593(core.List<core.String> o) { | 152 checkUnnamed1588(core.List<core.String> o) { |
118 unittest.expect(o, unittest.hasLength(2)); | 153 unittest.expect(o, unittest.hasLength(2)); |
119 unittest.expect(o[0], unittest.equals('foo')); | 154 unittest.expect(o[0], unittest.equals('foo')); |
120 unittest.expect(o[1], unittest.equals('foo')); | 155 unittest.expect(o[1], unittest.equals('foo')); |
121 } | 156 } |
122 | 157 |
123 core.int buildCounterManagedZone = 0; | 158 core.int buildCounterManagedZone = 0; |
124 buildManagedZone() { | 159 buildManagedZone() { |
125 var o = new api.ManagedZone(); | 160 var o = new api.ManagedZone(); |
126 buildCounterManagedZone++; | 161 buildCounterManagedZone++; |
127 if (buildCounterManagedZone < 3) { | 162 if (buildCounterManagedZone < 3) { |
128 o.creationTime = "foo"; | 163 o.creationTime = "foo"; |
129 o.description = "foo"; | 164 o.description = "foo"; |
130 o.dnsName = "foo"; | 165 o.dnsName = "foo"; |
131 o.id = "foo"; | 166 o.id = "foo"; |
132 o.kind = "foo"; | 167 o.kind = "foo"; |
133 o.name = "foo"; | 168 o.name = "foo"; |
134 o.nameServerSet = "foo"; | 169 o.nameServerSet = "foo"; |
135 o.nameServers = buildUnnamed1593(); | 170 o.nameServers = buildUnnamed1588(); |
136 } | 171 } |
137 buildCounterManagedZone--; | 172 buildCounterManagedZone--; |
138 return o; | 173 return o; |
139 } | 174 } |
140 | 175 |
141 checkManagedZone(api.ManagedZone o) { | 176 checkManagedZone(api.ManagedZone o) { |
142 buildCounterManagedZone++; | 177 buildCounterManagedZone++; |
143 if (buildCounterManagedZone < 3) { | 178 if (buildCounterManagedZone < 3) { |
144 unittest.expect(o.creationTime, unittest.equals('foo')); | 179 unittest.expect(o.creationTime, unittest.equals('foo')); |
145 unittest.expect(o.description, unittest.equals('foo')); | 180 unittest.expect(o.description, unittest.equals('foo')); |
146 unittest.expect(o.dnsName, unittest.equals('foo')); | 181 unittest.expect(o.dnsName, unittest.equals('foo')); |
147 unittest.expect(o.id, unittest.equals('foo')); | 182 unittest.expect(o.id, unittest.equals('foo')); |
148 unittest.expect(o.kind, unittest.equals('foo')); | 183 unittest.expect(o.kind, unittest.equals('foo')); |
149 unittest.expect(o.name, unittest.equals('foo')); | 184 unittest.expect(o.name, unittest.equals('foo')); |
150 unittest.expect(o.nameServerSet, unittest.equals('foo')); | 185 unittest.expect(o.nameServerSet, unittest.equals('foo')); |
151 checkUnnamed1593(o.nameServers); | 186 checkUnnamed1588(o.nameServers); |
152 } | 187 } |
153 buildCounterManagedZone--; | 188 buildCounterManagedZone--; |
154 } | 189 } |
155 | 190 |
156 buildUnnamed1594() { | 191 buildUnnamed1589() { |
157 var o = new core.List<api.ManagedZone>(); | 192 var o = new core.List<api.ManagedZone>(); |
158 o.add(buildManagedZone()); | 193 o.add(buildManagedZone()); |
159 o.add(buildManagedZone()); | 194 o.add(buildManagedZone()); |
160 return o; | 195 return o; |
161 } | 196 } |
162 | 197 |
163 checkUnnamed1594(core.List<api.ManagedZone> o) { | 198 checkUnnamed1589(core.List<api.ManagedZone> o) { |
164 unittest.expect(o, unittest.hasLength(2)); | 199 unittest.expect(o, unittest.hasLength(2)); |
165 checkManagedZone(o[0]); | 200 checkManagedZone(o[0]); |
166 checkManagedZone(o[1]); | 201 checkManagedZone(o[1]); |
167 } | 202 } |
168 | 203 |
169 core.int buildCounterManagedZonesListResponse = 0; | 204 core.int buildCounterManagedZonesListResponse = 0; |
170 buildManagedZonesListResponse() { | 205 buildManagedZonesListResponse() { |
171 var o = new api.ManagedZonesListResponse(); | 206 var o = new api.ManagedZonesListResponse(); |
172 buildCounterManagedZonesListResponse++; | 207 buildCounterManagedZonesListResponse++; |
173 if (buildCounterManagedZonesListResponse < 3) { | 208 if (buildCounterManagedZonesListResponse < 3) { |
174 o.kind = "foo"; | 209 o.kind = "foo"; |
175 o.managedZones = buildUnnamed1594(); | 210 o.managedZones = buildUnnamed1589(); |
176 o.nextPageToken = "foo"; | 211 o.nextPageToken = "foo"; |
177 } | 212 } |
178 buildCounterManagedZonesListResponse--; | 213 buildCounterManagedZonesListResponse--; |
179 return o; | 214 return o; |
180 } | 215 } |
181 | 216 |
182 checkManagedZonesListResponse(api.ManagedZonesListResponse o) { | 217 checkManagedZonesListResponse(api.ManagedZonesListResponse o) { |
183 buildCounterManagedZonesListResponse++; | 218 buildCounterManagedZonesListResponse++; |
184 if (buildCounterManagedZonesListResponse < 3) { | 219 if (buildCounterManagedZonesListResponse < 3) { |
185 unittest.expect(o.kind, unittest.equals('foo')); | 220 unittest.expect(o.kind, unittest.equals('foo')); |
186 checkUnnamed1594(o.managedZones); | 221 checkUnnamed1589(o.managedZones); |
187 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 222 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
188 } | 223 } |
189 buildCounterManagedZonesListResponse--; | 224 buildCounterManagedZonesListResponse--; |
190 } | 225 } |
191 | 226 |
192 core.int buildCounterProject = 0; | 227 core.int buildCounterProject = 0; |
193 buildProject() { | 228 buildProject() { |
194 var o = new api.Project(); | 229 var o = new api.Project(); |
195 buildCounterProject++; | 230 buildCounterProject++; |
196 if (buildCounterProject < 3) { | 231 if (buildCounterProject < 3) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 unittest.expect(o.managedZones, unittest.equals(42)); | 273 unittest.expect(o.managedZones, unittest.equals(42)); |
239 unittest.expect(o.resourceRecordsPerRrset, unittest.equals(42)); | 274 unittest.expect(o.resourceRecordsPerRrset, unittest.equals(42)); |
240 unittest.expect(o.rrsetAdditionsPerChange, unittest.equals(42)); | 275 unittest.expect(o.rrsetAdditionsPerChange, unittest.equals(42)); |
241 unittest.expect(o.rrsetDeletionsPerChange, unittest.equals(42)); | 276 unittest.expect(o.rrsetDeletionsPerChange, unittest.equals(42)); |
242 unittest.expect(o.rrsetsPerManagedZone, unittest.equals(42)); | 277 unittest.expect(o.rrsetsPerManagedZone, unittest.equals(42)); |
243 unittest.expect(o.totalRrdataSizePerChange, unittest.equals(42)); | 278 unittest.expect(o.totalRrdataSizePerChange, unittest.equals(42)); |
244 } | 279 } |
245 buildCounterQuota--; | 280 buildCounterQuota--; |
246 } | 281 } |
247 | 282 |
248 buildUnnamed1595() { | 283 buildUnnamed1590() { |
249 var o = new core.List<core.String>(); | 284 var o = new core.List<core.String>(); |
250 o.add("foo"); | 285 o.add("foo"); |
251 o.add("foo"); | 286 o.add("foo"); |
252 return o; | 287 return o; |
253 } | 288 } |
254 | 289 |
255 checkUnnamed1595(core.List<core.String> o) { | 290 checkUnnamed1590(core.List<core.String> o) { |
256 unittest.expect(o, unittest.hasLength(2)); | 291 unittest.expect(o, unittest.hasLength(2)); |
257 unittest.expect(o[0], unittest.equals('foo')); | 292 unittest.expect(o[0], unittest.equals('foo')); |
258 unittest.expect(o[1], unittest.equals('foo')); | 293 unittest.expect(o[1], unittest.equals('foo')); |
259 } | 294 } |
260 | 295 |
261 core.int buildCounterResourceRecordSet = 0; | 296 core.int buildCounterResourceRecordSet = 0; |
262 buildResourceRecordSet() { | 297 buildResourceRecordSet() { |
263 var o = new api.ResourceRecordSet(); | 298 var o = new api.ResourceRecordSet(); |
264 buildCounterResourceRecordSet++; | 299 buildCounterResourceRecordSet++; |
265 if (buildCounterResourceRecordSet < 3) { | 300 if (buildCounterResourceRecordSet < 3) { |
266 o.kind = "foo"; | 301 o.kind = "foo"; |
267 o.name = "foo"; | 302 o.name = "foo"; |
268 o.rrdatas = buildUnnamed1595(); | 303 o.rrdatas = buildUnnamed1590(); |
269 o.ttl = 42; | 304 o.ttl = 42; |
270 o.type = "foo"; | 305 o.type = "foo"; |
271 } | 306 } |
272 buildCounterResourceRecordSet--; | 307 buildCounterResourceRecordSet--; |
273 return o; | 308 return o; |
274 } | 309 } |
275 | 310 |
276 checkResourceRecordSet(api.ResourceRecordSet o) { | 311 checkResourceRecordSet(api.ResourceRecordSet o) { |
277 buildCounterResourceRecordSet++; | 312 buildCounterResourceRecordSet++; |
278 if (buildCounterResourceRecordSet < 3) { | 313 if (buildCounterResourceRecordSet < 3) { |
279 unittest.expect(o.kind, unittest.equals('foo')); | 314 unittest.expect(o.kind, unittest.equals('foo')); |
280 unittest.expect(o.name, unittest.equals('foo')); | 315 unittest.expect(o.name, unittest.equals('foo')); |
281 checkUnnamed1595(o.rrdatas); | 316 checkUnnamed1590(o.rrdatas); |
282 unittest.expect(o.ttl, unittest.equals(42)); | 317 unittest.expect(o.ttl, unittest.equals(42)); |
283 unittest.expect(o.type, unittest.equals('foo')); | 318 unittest.expect(o.type, unittest.equals('foo')); |
284 } | 319 } |
285 buildCounterResourceRecordSet--; | 320 buildCounterResourceRecordSet--; |
286 } | 321 } |
287 | 322 |
288 buildUnnamed1596() { | 323 buildUnnamed1591() { |
289 var o = new core.List<api.ResourceRecordSet>(); | 324 var o = new core.List<api.ResourceRecordSet>(); |
290 o.add(buildResourceRecordSet()); | 325 o.add(buildResourceRecordSet()); |
291 o.add(buildResourceRecordSet()); | 326 o.add(buildResourceRecordSet()); |
292 return o; | 327 return o; |
293 } | 328 } |
294 | 329 |
295 checkUnnamed1596(core.List<api.ResourceRecordSet> o) { | 330 checkUnnamed1591(core.List<api.ResourceRecordSet> o) { |
296 unittest.expect(o, unittest.hasLength(2)); | 331 unittest.expect(o, unittest.hasLength(2)); |
297 checkResourceRecordSet(o[0]); | 332 checkResourceRecordSet(o[0]); |
298 checkResourceRecordSet(o[1]); | 333 checkResourceRecordSet(o[1]); |
299 } | 334 } |
300 | 335 |
301 core.int buildCounterResourceRecordSetsListResponse = 0; | 336 core.int buildCounterResourceRecordSetsListResponse = 0; |
302 buildResourceRecordSetsListResponse() { | 337 buildResourceRecordSetsListResponse() { |
303 var o = new api.ResourceRecordSetsListResponse(); | 338 var o = new api.ResourceRecordSetsListResponse(); |
304 buildCounterResourceRecordSetsListResponse++; | 339 buildCounterResourceRecordSetsListResponse++; |
305 if (buildCounterResourceRecordSetsListResponse < 3) { | 340 if (buildCounterResourceRecordSetsListResponse < 3) { |
306 o.kind = "foo"; | 341 o.kind = "foo"; |
307 o.nextPageToken = "foo"; | 342 o.nextPageToken = "foo"; |
308 o.rrsets = buildUnnamed1596(); | 343 o.rrsets = buildUnnamed1591(); |
309 } | 344 } |
310 buildCounterResourceRecordSetsListResponse--; | 345 buildCounterResourceRecordSetsListResponse--; |
311 return o; | 346 return o; |
312 } | 347 } |
313 | 348 |
314 checkResourceRecordSetsListResponse(api.ResourceRecordSetsListResponse o) { | 349 checkResourceRecordSetsListResponse(api.ResourceRecordSetsListResponse o) { |
315 buildCounterResourceRecordSetsListResponse++; | 350 buildCounterResourceRecordSetsListResponse++; |
316 if (buildCounterResourceRecordSetsListResponse < 3) { | 351 if (buildCounterResourceRecordSetsListResponse < 3) { |
317 unittest.expect(o.kind, unittest.equals('foo')); | 352 unittest.expect(o.kind, unittest.equals('foo')); |
318 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 353 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
319 checkUnnamed1596(o.rrsets); | 354 checkUnnamed1591(o.rrsets); |
320 } | 355 } |
321 buildCounterResourceRecordSetsListResponse--; | 356 buildCounterResourceRecordSetsListResponse--; |
322 } | 357 } |
323 | 358 |
324 | 359 |
325 main() { | 360 main() { |
326 unittest.group("obj-schema-Change", () { | 361 unittest.group("obj-schema-Change", () { |
327 unittest.test("to-json--from-json", () { | 362 unittest.test("to-json--from-json", () { |
328 var o = buildChange(); | 363 var o = buildChange(); |
329 var od = new api.Change.fromJson(o.toJson()); | 364 var od = new api.Change.fromJson(o.toJson()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 var o = buildResourceRecordSetsListResponse(); | 426 var o = buildResourceRecordSetsListResponse(); |
392 var od = new api.ResourceRecordSetsListResponse.fromJson(o.toJson()); | 427 var od = new api.ResourceRecordSetsListResponse.fromJson(o.toJson()); |
393 checkResourceRecordSetsListResponse(od); | 428 checkResourceRecordSetsListResponse(od); |
394 }); | 429 }); |
395 }); | 430 }); |
396 | 431 |
397 | 432 |
398 unittest.group("resource-ChangesResourceApi", () { | 433 unittest.group("resource-ChangesResourceApi", () { |
399 unittest.test("method--create", () { | 434 unittest.test("method--create", () { |
400 | 435 |
401 var mock = new common_test.HttpServerMock(); | 436 var mock = new HttpServerMock(); |
402 api.ChangesResourceApi res = new api.DnsApi(mock).changes; | 437 api.ChangesResourceApi res = new api.DnsApi(mock).changes; |
403 var arg_request = buildChange(); | 438 var arg_request = buildChange(); |
404 var arg_project = "foo"; | 439 var arg_project = "foo"; |
405 var arg_managedZone = "foo"; | 440 var arg_managedZone = "foo"; |
406 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 441 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
407 var obj = new api.Change.fromJson(json); | 442 var obj = new api.Change.fromJson(json); |
408 checkChange(obj); | 443 checkChange(obj); |
409 | 444 |
410 var path = (req.url).path; | 445 var path = (req.url).path; |
411 var pathOffset = 0; | 446 var pathOffset = 0; |
(...skipping 17 matching lines...) Expand all Loading... |
429 var keyvalue = part.split("="); | 464 var keyvalue = part.split("="); |
430 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 465 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
431 } | 466 } |
432 } | 467 } |
433 | 468 |
434 | 469 |
435 var h = { | 470 var h = { |
436 "content-type" : "application/json; charset=utf-8", | 471 "content-type" : "application/json; charset=utf-8", |
437 }; | 472 }; |
438 var resp = convert.JSON.encode(buildChange()); | 473 var resp = convert.JSON.encode(buildChange()); |
439 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 474 return new async.Future.value(stringResponse(200, h, resp)); |
440 }), true); | 475 }), true); |
441 res.create(arg_request, arg_project, arg_managedZone).then(unittest.expect
Async(((api.Change response) { | 476 res.create(arg_request, arg_project, arg_managedZone).then(unittest.expect
Async(((api.Change response) { |
442 checkChange(response); | 477 checkChange(response); |
443 }))); | 478 }))); |
444 }); | 479 }); |
445 | 480 |
446 unittest.test("method--get", () { | 481 unittest.test("method--get", () { |
447 | 482 |
448 var mock = new common_test.HttpServerMock(); | 483 var mock = new HttpServerMock(); |
449 api.ChangesResourceApi res = new api.DnsApi(mock).changes; | 484 api.ChangesResourceApi res = new api.DnsApi(mock).changes; |
450 var arg_project = "foo"; | 485 var arg_project = "foo"; |
451 var arg_managedZone = "foo"; | 486 var arg_managedZone = "foo"; |
452 var arg_changeId = "foo"; | 487 var arg_changeId = "foo"; |
453 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 488 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
454 var path = (req.url).path; | 489 var path = (req.url).path; |
455 var pathOffset = 0; | 490 var pathOffset = 0; |
456 var index; | 491 var index; |
457 var subPart; | 492 var subPart; |
458 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 493 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
(...skipping 14 matching lines...) Expand all Loading... |
473 var keyvalue = part.split("="); | 508 var keyvalue = part.split("="); |
474 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 509 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
475 } | 510 } |
476 } | 511 } |
477 | 512 |
478 | 513 |
479 var h = { | 514 var h = { |
480 "content-type" : "application/json; charset=utf-8", | 515 "content-type" : "application/json; charset=utf-8", |
481 }; | 516 }; |
482 var resp = convert.JSON.encode(buildChange()); | 517 var resp = convert.JSON.encode(buildChange()); |
483 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 518 return new async.Future.value(stringResponse(200, h, resp)); |
484 }), true); | 519 }), true); |
485 res.get(arg_project, arg_managedZone, arg_changeId).then(unittest.expectAs
ync(((api.Change response) { | 520 res.get(arg_project, arg_managedZone, arg_changeId).then(unittest.expectAs
ync(((api.Change response) { |
486 checkChange(response); | 521 checkChange(response); |
487 }))); | 522 }))); |
488 }); | 523 }); |
489 | 524 |
490 unittest.test("method--list", () { | 525 unittest.test("method--list", () { |
491 | 526 |
492 var mock = new common_test.HttpServerMock(); | 527 var mock = new HttpServerMock(); |
493 api.ChangesResourceApi res = new api.DnsApi(mock).changes; | 528 api.ChangesResourceApi res = new api.DnsApi(mock).changes; |
494 var arg_project = "foo"; | 529 var arg_project = "foo"; |
495 var arg_managedZone = "foo"; | 530 var arg_managedZone = "foo"; |
496 var arg_maxResults = 42; | 531 var arg_maxResults = 42; |
497 var arg_pageToken = "foo"; | 532 var arg_pageToken = "foo"; |
498 var arg_sortBy = "foo"; | 533 var arg_sortBy = "foo"; |
499 var arg_sortOrder = "foo"; | 534 var arg_sortOrder = "foo"; |
500 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 535 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
501 var path = (req.url).path; | 536 var path = (req.url).path; |
502 var pathOffset = 0; | 537 var pathOffset = 0; |
(...skipping 21 matching lines...) Expand all Loading... |
524 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 559 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
525 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 560 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
526 unittest.expect(queryMap["sortBy"].first, unittest.equals(arg_sortBy)); | 561 unittest.expect(queryMap["sortBy"].first, unittest.equals(arg_sortBy)); |
527 unittest.expect(queryMap["sortOrder"].first, unittest.equals(arg_sortOrd
er)); | 562 unittest.expect(queryMap["sortOrder"].first, unittest.equals(arg_sortOrd
er)); |
528 | 563 |
529 | 564 |
530 var h = { | 565 var h = { |
531 "content-type" : "application/json; charset=utf-8", | 566 "content-type" : "application/json; charset=utf-8", |
532 }; | 567 }; |
533 var resp = convert.JSON.encode(buildChangesListResponse()); | 568 var resp = convert.JSON.encode(buildChangesListResponse()); |
534 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 569 return new async.Future.value(stringResponse(200, h, resp)); |
535 }), true); | 570 }), true); |
536 res.list(arg_project, arg_managedZone, maxResults: arg_maxResults, pageTok
en: arg_pageToken, sortBy: arg_sortBy, sortOrder: arg_sortOrder).then(unittest.e
xpectAsync(((api.ChangesListResponse response) { | 571 res.list(arg_project, arg_managedZone, maxResults: arg_maxResults, pageTok
en: arg_pageToken, sortBy: arg_sortBy, sortOrder: arg_sortOrder).then(unittest.e
xpectAsync(((api.ChangesListResponse response) { |
537 checkChangesListResponse(response); | 572 checkChangesListResponse(response); |
538 }))); | 573 }))); |
539 }); | 574 }); |
540 | 575 |
541 }); | 576 }); |
542 | 577 |
543 | 578 |
544 unittest.group("resource-ManagedZonesResourceApi", () { | 579 unittest.group("resource-ManagedZonesResourceApi", () { |
545 unittest.test("method--create", () { | 580 unittest.test("method--create", () { |
546 | 581 |
547 var mock = new common_test.HttpServerMock(); | 582 var mock = new HttpServerMock(); |
548 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; | 583 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; |
549 var arg_request = buildManagedZone(); | 584 var arg_request = buildManagedZone(); |
550 var arg_project = "foo"; | 585 var arg_project = "foo"; |
551 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 586 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
552 var obj = new api.ManagedZone.fromJson(json); | 587 var obj = new api.ManagedZone.fromJson(json); |
553 checkManagedZone(obj); | 588 checkManagedZone(obj); |
554 | 589 |
555 var path = (req.url).path; | 590 var path = (req.url).path; |
556 var pathOffset = 0; | 591 var pathOffset = 0; |
557 var index; | 592 var index; |
(...skipping 16 matching lines...) Expand all Loading... |
574 var keyvalue = part.split("="); | 609 var keyvalue = part.split("="); |
575 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 610 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
576 } | 611 } |
577 } | 612 } |
578 | 613 |
579 | 614 |
580 var h = { | 615 var h = { |
581 "content-type" : "application/json; charset=utf-8", | 616 "content-type" : "application/json; charset=utf-8", |
582 }; | 617 }; |
583 var resp = convert.JSON.encode(buildManagedZone()); | 618 var resp = convert.JSON.encode(buildManagedZone()); |
584 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 619 return new async.Future.value(stringResponse(200, h, resp)); |
585 }), true); | 620 }), true); |
586 res.create(arg_request, arg_project).then(unittest.expectAsync(((api.Manag
edZone response) { | 621 res.create(arg_request, arg_project).then(unittest.expectAsync(((api.Manag
edZone response) { |
587 checkManagedZone(response); | 622 checkManagedZone(response); |
588 }))); | 623 }))); |
589 }); | 624 }); |
590 | 625 |
591 unittest.test("method--delete", () { | 626 unittest.test("method--delete", () { |
592 | 627 |
593 var mock = new common_test.HttpServerMock(); | 628 var mock = new HttpServerMock(); |
594 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; | 629 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; |
595 var arg_project = "foo"; | 630 var arg_project = "foo"; |
596 var arg_managedZone = "foo"; | 631 var arg_managedZone = "foo"; |
597 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 632 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
598 var path = (req.url).path; | 633 var path = (req.url).path; |
599 var pathOffset = 0; | 634 var pathOffset = 0; |
600 var index; | 635 var index; |
601 var subPart; | 636 var subPart; |
602 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 637 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
603 pathOffset += 1; | 638 pathOffset += 1; |
(...skipping 13 matching lines...) Expand all Loading... |
617 var keyvalue = part.split("="); | 652 var keyvalue = part.split("="); |
618 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 653 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
619 } | 654 } |
620 } | 655 } |
621 | 656 |
622 | 657 |
623 var h = { | 658 var h = { |
624 "content-type" : "application/json; charset=utf-8", | 659 "content-type" : "application/json; charset=utf-8", |
625 }; | 660 }; |
626 var resp = ""; | 661 var resp = ""; |
627 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 662 return new async.Future.value(stringResponse(200, h, resp)); |
628 }), true); | 663 }), true); |
629 res.delete(arg_project, arg_managedZone).then(unittest.expectAsync((_) {})
); | 664 res.delete(arg_project, arg_managedZone).then(unittest.expectAsync((_) {})
); |
630 }); | 665 }); |
631 | 666 |
632 unittest.test("method--get", () { | 667 unittest.test("method--get", () { |
633 | 668 |
634 var mock = new common_test.HttpServerMock(); | 669 var mock = new HttpServerMock(); |
635 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; | 670 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; |
636 var arg_project = "foo"; | 671 var arg_project = "foo"; |
637 var arg_managedZone = "foo"; | 672 var arg_managedZone = "foo"; |
638 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 673 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
639 var path = (req.url).path; | 674 var path = (req.url).path; |
640 var pathOffset = 0; | 675 var pathOffset = 0; |
641 var index; | 676 var index; |
642 var subPart; | 677 var subPart; |
643 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 678 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
644 pathOffset += 1; | 679 pathOffset += 1; |
(...skipping 13 matching lines...) Expand all Loading... |
658 var keyvalue = part.split("="); | 693 var keyvalue = part.split("="); |
659 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 694 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
660 } | 695 } |
661 } | 696 } |
662 | 697 |
663 | 698 |
664 var h = { | 699 var h = { |
665 "content-type" : "application/json; charset=utf-8", | 700 "content-type" : "application/json; charset=utf-8", |
666 }; | 701 }; |
667 var resp = convert.JSON.encode(buildManagedZone()); | 702 var resp = convert.JSON.encode(buildManagedZone()); |
668 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 703 return new async.Future.value(stringResponse(200, h, resp)); |
669 }), true); | 704 }), true); |
670 res.get(arg_project, arg_managedZone).then(unittest.expectAsync(((api.Mana
gedZone response) { | 705 res.get(arg_project, arg_managedZone).then(unittest.expectAsync(((api.Mana
gedZone response) { |
671 checkManagedZone(response); | 706 checkManagedZone(response); |
672 }))); | 707 }))); |
673 }); | 708 }); |
674 | 709 |
675 unittest.test("method--list", () { | 710 unittest.test("method--list", () { |
676 | 711 |
677 var mock = new common_test.HttpServerMock(); | 712 var mock = new HttpServerMock(); |
678 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; | 713 api.ManagedZonesResourceApi res = new api.DnsApi(mock).managedZones; |
679 var arg_project = "foo"; | 714 var arg_project = "foo"; |
680 var arg_maxResults = 42; | 715 var arg_maxResults = 42; |
681 var arg_pageToken = "foo"; | 716 var arg_pageToken = "foo"; |
682 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 717 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
683 var path = (req.url).path; | 718 var path = (req.url).path; |
684 var pathOffset = 0; | 719 var pathOffset = 0; |
685 var index; | 720 var index; |
686 var subPart; | 721 var subPart; |
687 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 722 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
(...skipping 16 matching lines...) Expand all Loading... |
704 } | 739 } |
705 } | 740 } |
706 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 741 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
707 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 742 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
708 | 743 |
709 | 744 |
710 var h = { | 745 var h = { |
711 "content-type" : "application/json; charset=utf-8", | 746 "content-type" : "application/json; charset=utf-8", |
712 }; | 747 }; |
713 var resp = convert.JSON.encode(buildManagedZonesListResponse()); | 748 var resp = convert.JSON.encode(buildManagedZonesListResponse()); |
714 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 749 return new async.Future.value(stringResponse(200, h, resp)); |
715 }), true); | 750 }), true); |
716 res.list(arg_project, maxResults: arg_maxResults, pageToken: arg_pageToken
).then(unittest.expectAsync(((api.ManagedZonesListResponse response) { | 751 res.list(arg_project, maxResults: arg_maxResults, pageToken: arg_pageToken
).then(unittest.expectAsync(((api.ManagedZonesListResponse response) { |
717 checkManagedZonesListResponse(response); | 752 checkManagedZonesListResponse(response); |
718 }))); | 753 }))); |
719 }); | 754 }); |
720 | 755 |
721 }); | 756 }); |
722 | 757 |
723 | 758 |
724 unittest.group("resource-ProjectsResourceApi", () { | 759 unittest.group("resource-ProjectsResourceApi", () { |
725 unittest.test("method--get", () { | 760 unittest.test("method--get", () { |
726 | 761 |
727 var mock = new common_test.HttpServerMock(); | 762 var mock = new HttpServerMock(); |
728 api.ProjectsResourceApi res = new api.DnsApi(mock).projects; | 763 api.ProjectsResourceApi res = new api.DnsApi(mock).projects; |
729 var arg_project = "foo"; | 764 var arg_project = "foo"; |
730 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 765 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
731 var path = (req.url).path; | 766 var path = (req.url).path; |
732 var pathOffset = 0; | 767 var pathOffset = 0; |
733 var index; | 768 var index; |
734 var subPart; | 769 var subPart; |
735 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 770 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
736 pathOffset += 1; | 771 pathOffset += 1; |
737 | 772 |
(...skipping 12 matching lines...) Expand all Loading... |
750 var keyvalue = part.split("="); | 785 var keyvalue = part.split("="); |
751 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 786 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
752 } | 787 } |
753 } | 788 } |
754 | 789 |
755 | 790 |
756 var h = { | 791 var h = { |
757 "content-type" : "application/json; charset=utf-8", | 792 "content-type" : "application/json; charset=utf-8", |
758 }; | 793 }; |
759 var resp = convert.JSON.encode(buildProject()); | 794 var resp = convert.JSON.encode(buildProject()); |
760 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 795 return new async.Future.value(stringResponse(200, h, resp)); |
761 }), true); | 796 }), true); |
762 res.get(arg_project).then(unittest.expectAsync(((api.Project response) { | 797 res.get(arg_project).then(unittest.expectAsync(((api.Project response) { |
763 checkProject(response); | 798 checkProject(response); |
764 }))); | 799 }))); |
765 }); | 800 }); |
766 | 801 |
767 }); | 802 }); |
768 | 803 |
769 | 804 |
770 unittest.group("resource-ResourceRecordSetsResourceApi", () { | 805 unittest.group("resource-ResourceRecordSetsResourceApi", () { |
771 unittest.test("method--list", () { | 806 unittest.test("method--list", () { |
772 | 807 |
773 var mock = new common_test.HttpServerMock(); | 808 var mock = new HttpServerMock(); |
774 api.ResourceRecordSetsResourceApi res = new api.DnsApi(mock).resourceRecor
dSets; | 809 api.ResourceRecordSetsResourceApi res = new api.DnsApi(mock).resourceRecor
dSets; |
775 var arg_project = "foo"; | 810 var arg_project = "foo"; |
776 var arg_managedZone = "foo"; | 811 var arg_managedZone = "foo"; |
777 var arg_maxResults = 42; | 812 var arg_maxResults = 42; |
778 var arg_name = "foo"; | 813 var arg_name = "foo"; |
779 var arg_pageToken = "foo"; | 814 var arg_pageToken = "foo"; |
780 var arg_type = "foo"; | 815 var arg_type = "foo"; |
781 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 816 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
782 var path = (req.url).path; | 817 var path = (req.url).path; |
783 var pathOffset = 0; | 818 var pathOffset = 0; |
(...skipping 21 matching lines...) Expand all Loading... |
805 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 840 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
806 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); | 841 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); |
807 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 842 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
808 unittest.expect(queryMap["type"].first, unittest.equals(arg_type)); | 843 unittest.expect(queryMap["type"].first, unittest.equals(arg_type)); |
809 | 844 |
810 | 845 |
811 var h = { | 846 var h = { |
812 "content-type" : "application/json; charset=utf-8", | 847 "content-type" : "application/json; charset=utf-8", |
813 }; | 848 }; |
814 var resp = convert.JSON.encode(buildResourceRecordSetsListResponse()); | 849 var resp = convert.JSON.encode(buildResourceRecordSetsListResponse()); |
815 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 850 return new async.Future.value(stringResponse(200, h, resp)); |
816 }), true); | 851 }), true); |
817 res.list(arg_project, arg_managedZone, maxResults: arg_maxResults, name: a
rg_name, pageToken: arg_pageToken, type: arg_type).then(unittest.expectAsync(((a
pi.ResourceRecordSetsListResponse response) { | 852 res.list(arg_project, arg_managedZone, maxResults: arg_maxResults, name: a
rg_name, pageToken: arg_pageToken, type: arg_type).then(unittest.expectAsync(((a
pi.ResourceRecordSetsListResponse response) { |
818 checkResourceRecordSetsListResponse(response); | 853 checkResourceRecordSetsListResponse(response); |
819 }))); | 854 }))); |
820 }); | 855 }); |
821 | 856 |
822 }); | 857 }); |
823 | 858 |
824 | 859 |
825 } | 860 } |
826 | 861 |
OLD | NEW |