OLD | NEW |
1 library googleapis_beta.proximitybeacon.v1beta1.test; | 1 library googleapis_beta.proximitybeacon.v1beta1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | 4 import "dart:async" as async; |
6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
7 | 6 |
8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
11 | 9 |
12 import 'package:googleapis_beta/proximitybeacon/v1beta1.dart' as api; | 10 import 'package:googleapis_beta/proximitybeacon/v1beta1.dart' as api; |
13 | 11 |
14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
15 core.Function _callback; | 13 core.Function _callback; |
16 core.bool _expectJson; | 14 core.bool _expectJson; |
17 | 15 |
18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
19 _callback = callback; | 17 _callback = callback; |
20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
21 } | 19 } |
22 | 20 |
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
24 if (_expectJson) { | 22 if (_expectJson) { |
25 return request.finalize() | 23 return request |
| 24 .finalize() |
26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
27 .join('') | 26 .join('') |
28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
30 return _callback(request, null); | 29 return _callback(request, null); |
31 } else { | 30 } else { |
32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
33 } | 32 } |
34 }); | 33 }); |
35 } else { | 34 } else { |
36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
37 if (stream == null) { | 36 if (stream == null) { |
38 return _callback(request, []); | 37 return _callback(request, []); |
39 } else { | 38 } else { |
40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
41 return _callback(request, data); | 40 return _callback(request, data); |
42 }); | 41 }); |
43 } | 42 } |
44 } | 43 } |
45 } | 44 } |
46 } | 45 } |
47 | 46 |
48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 51 } |
53 | 52 |
54 core.int buildCounterAdvertisedId = 0; | 53 core.int buildCounterAdvertisedId = 0; |
55 buildAdvertisedId() { | 54 buildAdvertisedId() { |
56 var o = new api.AdvertisedId(); | 55 var o = new api.AdvertisedId(); |
57 buildCounterAdvertisedId++; | 56 buildCounterAdvertisedId++; |
58 if (buildCounterAdvertisedId < 3) { | 57 if (buildCounterAdvertisedId < 3) { |
59 o.id = "foo"; | 58 o.id = "foo"; |
(...skipping 26 matching lines...) Expand all Loading... |
86 | 85 |
87 checkAttachmentInfo(api.AttachmentInfo o) { | 86 checkAttachmentInfo(api.AttachmentInfo o) { |
88 buildCounterAttachmentInfo++; | 87 buildCounterAttachmentInfo++; |
89 if (buildCounterAttachmentInfo < 3) { | 88 if (buildCounterAttachmentInfo < 3) { |
90 unittest.expect(o.data, unittest.equals('foo')); | 89 unittest.expect(o.data, unittest.equals('foo')); |
91 unittest.expect(o.namespacedType, unittest.equals('foo')); | 90 unittest.expect(o.namespacedType, unittest.equals('foo')); |
92 } | 91 } |
93 buildCounterAttachmentInfo--; | 92 buildCounterAttachmentInfo--; |
94 } | 93 } |
95 | 94 |
96 buildUnnamed3459() { | 95 buildUnnamed3464() { |
97 var o = new core.Map<core.String, core.String>(); | 96 var o = new core.Map<core.String, core.String>(); |
98 o["x"] = "foo"; | 97 o["x"] = "foo"; |
99 o["y"] = "foo"; | 98 o["y"] = "foo"; |
100 return o; | 99 return o; |
101 } | 100 } |
102 | 101 |
103 checkUnnamed3459(core.Map<core.String, core.String> o) { | 102 checkUnnamed3464(core.Map<core.String, core.String> o) { |
104 unittest.expect(o, unittest.hasLength(2)); | 103 unittest.expect(o, unittest.hasLength(2)); |
105 unittest.expect(o["x"], unittest.equals('foo')); | 104 unittest.expect(o["x"], unittest.equals('foo')); |
106 unittest.expect(o["y"], unittest.equals('foo')); | 105 unittest.expect(o["y"], unittest.equals('foo')); |
107 } | 106 } |
108 | 107 |
109 core.int buildCounterBeacon = 0; | 108 core.int buildCounterBeacon = 0; |
110 buildBeacon() { | 109 buildBeacon() { |
111 var o = new api.Beacon(); | 110 var o = new api.Beacon(); |
112 buildCounterBeacon++; | 111 buildCounterBeacon++; |
113 if (buildCounterBeacon < 3) { | 112 if (buildCounterBeacon < 3) { |
114 o.advertisedId = buildAdvertisedId(); | 113 o.advertisedId = buildAdvertisedId(); |
115 o.beaconName = "foo"; | 114 o.beaconName = "foo"; |
116 o.description = "foo"; | 115 o.description = "foo"; |
117 o.ephemeralIdRegistration = buildEphemeralIdRegistration(); | 116 o.ephemeralIdRegistration = buildEphemeralIdRegistration(); |
118 o.expectedStability = "foo"; | 117 o.expectedStability = "foo"; |
119 o.indoorLevel = buildIndoorLevel(); | 118 o.indoorLevel = buildIndoorLevel(); |
120 o.latLng = buildLatLng(); | 119 o.latLng = buildLatLng(); |
121 o.placeId = "foo"; | 120 o.placeId = "foo"; |
122 o.properties = buildUnnamed3459(); | 121 o.properties = buildUnnamed3464(); |
123 o.provisioningKey = "foo"; | 122 o.provisioningKey = "foo"; |
124 o.status = "foo"; | 123 o.status = "foo"; |
125 } | 124 } |
126 buildCounterBeacon--; | 125 buildCounterBeacon--; |
127 return o; | 126 return o; |
128 } | 127 } |
129 | 128 |
130 checkBeacon(api.Beacon o) { | 129 checkBeacon(api.Beacon o) { |
131 buildCounterBeacon++; | 130 buildCounterBeacon++; |
132 if (buildCounterBeacon < 3) { | 131 if (buildCounterBeacon < 3) { |
133 checkAdvertisedId(o.advertisedId); | 132 checkAdvertisedId(o.advertisedId); |
134 unittest.expect(o.beaconName, unittest.equals('foo')); | 133 unittest.expect(o.beaconName, unittest.equals('foo')); |
135 unittest.expect(o.description, unittest.equals('foo')); | 134 unittest.expect(o.description, unittest.equals('foo')); |
136 checkEphemeralIdRegistration(o.ephemeralIdRegistration); | 135 checkEphemeralIdRegistration(o.ephemeralIdRegistration); |
137 unittest.expect(o.expectedStability, unittest.equals('foo')); | 136 unittest.expect(o.expectedStability, unittest.equals('foo')); |
138 checkIndoorLevel(o.indoorLevel); | 137 checkIndoorLevel(o.indoorLevel); |
139 checkLatLng(o.latLng); | 138 checkLatLng(o.latLng); |
140 unittest.expect(o.placeId, unittest.equals('foo')); | 139 unittest.expect(o.placeId, unittest.equals('foo')); |
141 checkUnnamed3459(o.properties); | 140 checkUnnamed3464(o.properties); |
142 unittest.expect(o.provisioningKey, unittest.equals('foo')); | 141 unittest.expect(o.provisioningKey, unittest.equals('foo')); |
143 unittest.expect(o.status, unittest.equals('foo')); | 142 unittest.expect(o.status, unittest.equals('foo')); |
144 } | 143 } |
145 buildCounterBeacon--; | 144 buildCounterBeacon--; |
146 } | 145 } |
147 | 146 |
148 core.int buildCounterBeaconAttachment = 0; | 147 core.int buildCounterBeaconAttachment = 0; |
149 buildBeaconAttachment() { | 148 buildBeaconAttachment() { |
150 var o = new api.BeaconAttachment(); | 149 var o = new api.BeaconAttachment(); |
151 buildCounterBeaconAttachment++; | 150 buildCounterBeaconAttachment++; |
(...skipping 11 matching lines...) Expand all Loading... |
163 buildCounterBeaconAttachment++; | 162 buildCounterBeaconAttachment++; |
164 if (buildCounterBeaconAttachment < 3) { | 163 if (buildCounterBeaconAttachment < 3) { |
165 unittest.expect(o.attachmentName, unittest.equals('foo')); | 164 unittest.expect(o.attachmentName, unittest.equals('foo')); |
166 unittest.expect(o.creationTimeMs, unittest.equals('foo')); | 165 unittest.expect(o.creationTimeMs, unittest.equals('foo')); |
167 unittest.expect(o.data, unittest.equals('foo')); | 166 unittest.expect(o.data, unittest.equals('foo')); |
168 unittest.expect(o.namespacedType, unittest.equals('foo')); | 167 unittest.expect(o.namespacedType, unittest.equals('foo')); |
169 } | 168 } |
170 buildCounterBeaconAttachment--; | 169 buildCounterBeaconAttachment--; |
171 } | 170 } |
172 | 171 |
173 buildUnnamed3460() { | 172 buildUnnamed3465() { |
174 var o = new core.List<api.AttachmentInfo>(); | 173 var o = new core.List<api.AttachmentInfo>(); |
175 o.add(buildAttachmentInfo()); | 174 o.add(buildAttachmentInfo()); |
176 o.add(buildAttachmentInfo()); | 175 o.add(buildAttachmentInfo()); |
177 return o; | 176 return o; |
178 } | 177 } |
179 | 178 |
180 checkUnnamed3460(core.List<api.AttachmentInfo> o) { | 179 checkUnnamed3465(core.List<api.AttachmentInfo> o) { |
181 unittest.expect(o, unittest.hasLength(2)); | 180 unittest.expect(o, unittest.hasLength(2)); |
182 checkAttachmentInfo(o[0]); | 181 checkAttachmentInfo(o[0]); |
183 checkAttachmentInfo(o[1]); | 182 checkAttachmentInfo(o[1]); |
184 } | 183 } |
185 | 184 |
186 core.int buildCounterBeaconInfo = 0; | 185 core.int buildCounterBeaconInfo = 0; |
187 buildBeaconInfo() { | 186 buildBeaconInfo() { |
188 var o = new api.BeaconInfo(); | 187 var o = new api.BeaconInfo(); |
189 buildCounterBeaconInfo++; | 188 buildCounterBeaconInfo++; |
190 if (buildCounterBeaconInfo < 3) { | 189 if (buildCounterBeaconInfo < 3) { |
191 o.advertisedId = buildAdvertisedId(); | 190 o.advertisedId = buildAdvertisedId(); |
192 o.attachments = buildUnnamed3460(); | 191 o.attachments = buildUnnamed3465(); |
193 o.beaconName = "foo"; | 192 o.beaconName = "foo"; |
194 } | 193 } |
195 buildCounterBeaconInfo--; | 194 buildCounterBeaconInfo--; |
196 return o; | 195 return o; |
197 } | 196 } |
198 | 197 |
199 checkBeaconInfo(api.BeaconInfo o) { | 198 checkBeaconInfo(api.BeaconInfo o) { |
200 buildCounterBeaconInfo++; | 199 buildCounterBeaconInfo++; |
201 if (buildCounterBeaconInfo < 3) { | 200 if (buildCounterBeaconInfo < 3) { |
202 checkAdvertisedId(o.advertisedId); | 201 checkAdvertisedId(o.advertisedId); |
203 checkUnnamed3460(o.attachments); | 202 checkUnnamed3465(o.attachments); |
204 unittest.expect(o.beaconName, unittest.equals('foo')); | 203 unittest.expect(o.beaconName, unittest.equals('foo')); |
205 } | 204 } |
206 buildCounterBeaconInfo--; | 205 buildCounterBeaconInfo--; |
207 } | 206 } |
208 | 207 |
209 core.int buildCounterDate = 0; | 208 core.int buildCounterDate = 0; |
210 buildDate() { | 209 buildDate() { |
211 var o = new api.Date(); | 210 var o = new api.Date(); |
212 buildCounterDate++; | 211 buildCounterDate++; |
213 if (buildCounterDate < 3) { | 212 if (buildCounterDate < 3) { |
(...skipping 27 matching lines...) Expand all Loading... |
241 } | 240 } |
242 | 241 |
243 checkDeleteAttachmentsResponse(api.DeleteAttachmentsResponse o) { | 242 checkDeleteAttachmentsResponse(api.DeleteAttachmentsResponse o) { |
244 buildCounterDeleteAttachmentsResponse++; | 243 buildCounterDeleteAttachmentsResponse++; |
245 if (buildCounterDeleteAttachmentsResponse < 3) { | 244 if (buildCounterDeleteAttachmentsResponse < 3) { |
246 unittest.expect(o.numDeleted, unittest.equals(42)); | 245 unittest.expect(o.numDeleted, unittest.equals(42)); |
247 } | 246 } |
248 buildCounterDeleteAttachmentsResponse--; | 247 buildCounterDeleteAttachmentsResponse--; |
249 } | 248 } |
250 | 249 |
251 buildUnnamed3461() { | 250 buildUnnamed3466() { |
252 var o = new core.List<core.String>(); | 251 var o = new core.List<core.String>(); |
253 o.add("foo"); | 252 o.add("foo"); |
254 o.add("foo"); | 253 o.add("foo"); |
255 return o; | 254 return o; |
256 } | 255 } |
257 | 256 |
258 checkUnnamed3461(core.List<core.String> o) { | 257 checkUnnamed3466(core.List<core.String> o) { |
259 unittest.expect(o, unittest.hasLength(2)); | 258 unittest.expect(o, unittest.hasLength(2)); |
260 unittest.expect(o[0], unittest.equals('foo')); | 259 unittest.expect(o[0], unittest.equals('foo')); |
261 unittest.expect(o[1], unittest.equals('foo')); | 260 unittest.expect(o[1], unittest.equals('foo')); |
262 } | 261 } |
263 | 262 |
264 core.int buildCounterDiagnostics = 0; | 263 core.int buildCounterDiagnostics = 0; |
265 buildDiagnostics() { | 264 buildDiagnostics() { |
266 var o = new api.Diagnostics(); | 265 var o = new api.Diagnostics(); |
267 buildCounterDiagnostics++; | 266 buildCounterDiagnostics++; |
268 if (buildCounterDiagnostics < 3) { | 267 if (buildCounterDiagnostics < 3) { |
269 o.alerts = buildUnnamed3461(); | 268 o.alerts = buildUnnamed3466(); |
270 o.beaconName = "foo"; | 269 o.beaconName = "foo"; |
271 o.estimatedLowBatteryDate = buildDate(); | 270 o.estimatedLowBatteryDate = buildDate(); |
272 } | 271 } |
273 buildCounterDiagnostics--; | 272 buildCounterDiagnostics--; |
274 return o; | 273 return o; |
275 } | 274 } |
276 | 275 |
277 checkDiagnostics(api.Diagnostics o) { | 276 checkDiagnostics(api.Diagnostics o) { |
278 buildCounterDiagnostics++; | 277 buildCounterDiagnostics++; |
279 if (buildCounterDiagnostics < 3) { | 278 if (buildCounterDiagnostics < 3) { |
280 checkUnnamed3461(o.alerts); | 279 checkUnnamed3466(o.alerts); |
281 unittest.expect(o.beaconName, unittest.equals('foo')); | 280 unittest.expect(o.beaconName, unittest.equals('foo')); |
282 checkDate(o.estimatedLowBatteryDate); | 281 checkDate(o.estimatedLowBatteryDate); |
283 } | 282 } |
284 buildCounterDiagnostics--; | 283 buildCounterDiagnostics--; |
285 } | 284 } |
286 | 285 |
287 core.int buildCounterEmpty = 0; | 286 core.int buildCounterEmpty = 0; |
288 buildEmpty() { | 287 buildEmpty() { |
289 var o = new api.Empty(); | 288 var o = new api.Empty(); |
290 buildCounterEmpty++; | 289 buildCounterEmpty++; |
291 if (buildCounterEmpty < 3) { | 290 if (buildCounterEmpty < 3) {} |
292 } | |
293 buildCounterEmpty--; | 291 buildCounterEmpty--; |
294 return o; | 292 return o; |
295 } | 293 } |
296 | 294 |
297 checkEmpty(api.Empty o) { | 295 checkEmpty(api.Empty o) { |
298 buildCounterEmpty++; | 296 buildCounterEmpty++; |
299 if (buildCounterEmpty < 3) { | 297 if (buildCounterEmpty < 3) {} |
300 } | |
301 buildCounterEmpty--; | 298 buildCounterEmpty--; |
302 } | 299 } |
303 | 300 |
304 core.int buildCounterEphemeralIdRegistration = 0; | 301 core.int buildCounterEphemeralIdRegistration = 0; |
305 buildEphemeralIdRegistration() { | 302 buildEphemeralIdRegistration() { |
306 var o = new api.EphemeralIdRegistration(); | 303 var o = new api.EphemeralIdRegistration(); |
307 buildCounterEphemeralIdRegistration++; | 304 buildCounterEphemeralIdRegistration++; |
308 if (buildCounterEphemeralIdRegistration < 3) { | 305 if (buildCounterEphemeralIdRegistration < 3) { |
309 o.beaconEcdhPublicKey = "foo"; | 306 o.beaconEcdhPublicKey = "foo"; |
310 o.beaconIdentityKey = "foo"; | 307 o.beaconIdentityKey = "foo"; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 checkEphemeralIdRegistrationParams(api.EphemeralIdRegistrationParams o) { | 343 checkEphemeralIdRegistrationParams(api.EphemeralIdRegistrationParams o) { |
347 buildCounterEphemeralIdRegistrationParams++; | 344 buildCounterEphemeralIdRegistrationParams++; |
348 if (buildCounterEphemeralIdRegistrationParams < 3) { | 345 if (buildCounterEphemeralIdRegistrationParams < 3) { |
349 unittest.expect(o.maxRotationPeriodExponent, unittest.equals(42)); | 346 unittest.expect(o.maxRotationPeriodExponent, unittest.equals(42)); |
350 unittest.expect(o.minRotationPeriodExponent, unittest.equals(42)); | 347 unittest.expect(o.minRotationPeriodExponent, unittest.equals(42)); |
351 unittest.expect(o.serviceEcdhPublicKey, unittest.equals('foo')); | 348 unittest.expect(o.serviceEcdhPublicKey, unittest.equals('foo')); |
352 } | 349 } |
353 buildCounterEphemeralIdRegistrationParams--; | 350 buildCounterEphemeralIdRegistrationParams--; |
354 } | 351 } |
355 | 352 |
356 buildUnnamed3462() { | 353 buildUnnamed3467() { |
357 var o = new core.List<core.String>(); | 354 var o = new core.List<core.String>(); |
358 o.add("foo"); | 355 o.add("foo"); |
359 o.add("foo"); | 356 o.add("foo"); |
360 return o; | 357 return o; |
361 } | 358 } |
362 | 359 |
363 checkUnnamed3462(core.List<core.String> o) { | 360 checkUnnamed3467(core.List<core.String> o) { |
364 unittest.expect(o, unittest.hasLength(2)); | 361 unittest.expect(o, unittest.hasLength(2)); |
365 unittest.expect(o[0], unittest.equals('foo')); | 362 unittest.expect(o[0], unittest.equals('foo')); |
366 unittest.expect(o[1], unittest.equals('foo')); | 363 unittest.expect(o[1], unittest.equals('foo')); |
367 } | 364 } |
368 | 365 |
369 buildUnnamed3463() { | 366 buildUnnamed3468() { |
370 var o = new core.List<api.Observation>(); | 367 var o = new core.List<api.Observation>(); |
371 o.add(buildObservation()); | 368 o.add(buildObservation()); |
372 o.add(buildObservation()); | 369 o.add(buildObservation()); |
373 return o; | 370 return o; |
374 } | 371 } |
375 | 372 |
376 checkUnnamed3463(core.List<api.Observation> o) { | 373 checkUnnamed3468(core.List<api.Observation> o) { |
377 unittest.expect(o, unittest.hasLength(2)); | 374 unittest.expect(o, unittest.hasLength(2)); |
378 checkObservation(o[0]); | 375 checkObservation(o[0]); |
379 checkObservation(o[1]); | 376 checkObservation(o[1]); |
380 } | 377 } |
381 | 378 |
382 core.int buildCounterGetInfoForObservedBeaconsRequest = 0; | 379 core.int buildCounterGetInfoForObservedBeaconsRequest = 0; |
383 buildGetInfoForObservedBeaconsRequest() { | 380 buildGetInfoForObservedBeaconsRequest() { |
384 var o = new api.GetInfoForObservedBeaconsRequest(); | 381 var o = new api.GetInfoForObservedBeaconsRequest(); |
385 buildCounterGetInfoForObservedBeaconsRequest++; | 382 buildCounterGetInfoForObservedBeaconsRequest++; |
386 if (buildCounterGetInfoForObservedBeaconsRequest < 3) { | 383 if (buildCounterGetInfoForObservedBeaconsRequest < 3) { |
387 o.namespacedTypes = buildUnnamed3462(); | 384 o.namespacedTypes = buildUnnamed3467(); |
388 o.observations = buildUnnamed3463(); | 385 o.observations = buildUnnamed3468(); |
389 } | 386 } |
390 buildCounterGetInfoForObservedBeaconsRequest--; | 387 buildCounterGetInfoForObservedBeaconsRequest--; |
391 return o; | 388 return o; |
392 } | 389 } |
393 | 390 |
394 checkGetInfoForObservedBeaconsRequest(api.GetInfoForObservedBeaconsRequest o) { | 391 checkGetInfoForObservedBeaconsRequest(api.GetInfoForObservedBeaconsRequest o) { |
395 buildCounterGetInfoForObservedBeaconsRequest++; | 392 buildCounterGetInfoForObservedBeaconsRequest++; |
396 if (buildCounterGetInfoForObservedBeaconsRequest < 3) { | 393 if (buildCounterGetInfoForObservedBeaconsRequest < 3) { |
397 checkUnnamed3462(o.namespacedTypes); | 394 checkUnnamed3467(o.namespacedTypes); |
398 checkUnnamed3463(o.observations); | 395 checkUnnamed3468(o.observations); |
399 } | 396 } |
400 buildCounterGetInfoForObservedBeaconsRequest--; | 397 buildCounterGetInfoForObservedBeaconsRequest--; |
401 } | 398 } |
402 | 399 |
403 buildUnnamed3464() { | 400 buildUnnamed3469() { |
404 var o = new core.List<api.BeaconInfo>(); | 401 var o = new core.List<api.BeaconInfo>(); |
405 o.add(buildBeaconInfo()); | 402 o.add(buildBeaconInfo()); |
406 o.add(buildBeaconInfo()); | 403 o.add(buildBeaconInfo()); |
407 return o; | 404 return o; |
408 } | 405 } |
409 | 406 |
410 checkUnnamed3464(core.List<api.BeaconInfo> o) { | 407 checkUnnamed3469(core.List<api.BeaconInfo> o) { |
411 unittest.expect(o, unittest.hasLength(2)); | 408 unittest.expect(o, unittest.hasLength(2)); |
412 checkBeaconInfo(o[0]); | 409 checkBeaconInfo(o[0]); |
413 checkBeaconInfo(o[1]); | 410 checkBeaconInfo(o[1]); |
414 } | 411 } |
415 | 412 |
416 core.int buildCounterGetInfoForObservedBeaconsResponse = 0; | 413 core.int buildCounterGetInfoForObservedBeaconsResponse = 0; |
417 buildGetInfoForObservedBeaconsResponse() { | 414 buildGetInfoForObservedBeaconsResponse() { |
418 var o = new api.GetInfoForObservedBeaconsResponse(); | 415 var o = new api.GetInfoForObservedBeaconsResponse(); |
419 buildCounterGetInfoForObservedBeaconsResponse++; | 416 buildCounterGetInfoForObservedBeaconsResponse++; |
420 if (buildCounterGetInfoForObservedBeaconsResponse < 3) { | 417 if (buildCounterGetInfoForObservedBeaconsResponse < 3) { |
421 o.beacons = buildUnnamed3464(); | 418 o.beacons = buildUnnamed3469(); |
422 } | 419 } |
423 buildCounterGetInfoForObservedBeaconsResponse--; | 420 buildCounterGetInfoForObservedBeaconsResponse--; |
424 return o; | 421 return o; |
425 } | 422 } |
426 | 423 |
427 checkGetInfoForObservedBeaconsResponse(api.GetInfoForObservedBeaconsResponse o)
{ | 424 checkGetInfoForObservedBeaconsResponse( |
| 425 api.GetInfoForObservedBeaconsResponse o) { |
428 buildCounterGetInfoForObservedBeaconsResponse++; | 426 buildCounterGetInfoForObservedBeaconsResponse++; |
429 if (buildCounterGetInfoForObservedBeaconsResponse < 3) { | 427 if (buildCounterGetInfoForObservedBeaconsResponse < 3) { |
430 checkUnnamed3464(o.beacons); | 428 checkUnnamed3469(o.beacons); |
431 } | 429 } |
432 buildCounterGetInfoForObservedBeaconsResponse--; | 430 buildCounterGetInfoForObservedBeaconsResponse--; |
433 } | 431 } |
434 | 432 |
435 core.int buildCounterIndoorLevel = 0; | 433 core.int buildCounterIndoorLevel = 0; |
436 buildIndoorLevel() { | 434 buildIndoorLevel() { |
437 var o = new api.IndoorLevel(); | 435 var o = new api.IndoorLevel(); |
438 buildCounterIndoorLevel++; | 436 buildCounterIndoorLevel++; |
439 if (buildCounterIndoorLevel < 3) { | 437 if (buildCounterIndoorLevel < 3) { |
440 o.name = "foo"; | 438 o.name = "foo"; |
(...skipping 24 matching lines...) Expand all Loading... |
465 | 463 |
466 checkLatLng(api.LatLng o) { | 464 checkLatLng(api.LatLng o) { |
467 buildCounterLatLng++; | 465 buildCounterLatLng++; |
468 if (buildCounterLatLng < 3) { | 466 if (buildCounterLatLng < 3) { |
469 unittest.expect(o.latitude, unittest.equals(42.0)); | 467 unittest.expect(o.latitude, unittest.equals(42.0)); |
470 unittest.expect(o.longitude, unittest.equals(42.0)); | 468 unittest.expect(o.longitude, unittest.equals(42.0)); |
471 } | 469 } |
472 buildCounterLatLng--; | 470 buildCounterLatLng--; |
473 } | 471 } |
474 | 472 |
475 buildUnnamed3465() { | 473 buildUnnamed3470() { |
476 var o = new core.List<api.BeaconAttachment>(); | 474 var o = new core.List<api.BeaconAttachment>(); |
477 o.add(buildBeaconAttachment()); | 475 o.add(buildBeaconAttachment()); |
478 o.add(buildBeaconAttachment()); | 476 o.add(buildBeaconAttachment()); |
479 return o; | 477 return o; |
480 } | 478 } |
481 | 479 |
482 checkUnnamed3465(core.List<api.BeaconAttachment> o) { | 480 checkUnnamed3470(core.List<api.BeaconAttachment> o) { |
483 unittest.expect(o, unittest.hasLength(2)); | 481 unittest.expect(o, unittest.hasLength(2)); |
484 checkBeaconAttachment(o[0]); | 482 checkBeaconAttachment(o[0]); |
485 checkBeaconAttachment(o[1]); | 483 checkBeaconAttachment(o[1]); |
486 } | 484 } |
487 | 485 |
488 core.int buildCounterListBeaconAttachmentsResponse = 0; | 486 core.int buildCounterListBeaconAttachmentsResponse = 0; |
489 buildListBeaconAttachmentsResponse() { | 487 buildListBeaconAttachmentsResponse() { |
490 var o = new api.ListBeaconAttachmentsResponse(); | 488 var o = new api.ListBeaconAttachmentsResponse(); |
491 buildCounterListBeaconAttachmentsResponse++; | 489 buildCounterListBeaconAttachmentsResponse++; |
492 if (buildCounterListBeaconAttachmentsResponse < 3) { | 490 if (buildCounterListBeaconAttachmentsResponse < 3) { |
493 o.attachments = buildUnnamed3465(); | 491 o.attachments = buildUnnamed3470(); |
494 } | 492 } |
495 buildCounterListBeaconAttachmentsResponse--; | 493 buildCounterListBeaconAttachmentsResponse--; |
496 return o; | 494 return o; |
497 } | 495 } |
498 | 496 |
499 checkListBeaconAttachmentsResponse(api.ListBeaconAttachmentsResponse o) { | 497 checkListBeaconAttachmentsResponse(api.ListBeaconAttachmentsResponse o) { |
500 buildCounterListBeaconAttachmentsResponse++; | 498 buildCounterListBeaconAttachmentsResponse++; |
501 if (buildCounterListBeaconAttachmentsResponse < 3) { | 499 if (buildCounterListBeaconAttachmentsResponse < 3) { |
502 checkUnnamed3465(o.attachments); | 500 checkUnnamed3470(o.attachments); |
503 } | 501 } |
504 buildCounterListBeaconAttachmentsResponse--; | 502 buildCounterListBeaconAttachmentsResponse--; |
505 } | 503 } |
506 | 504 |
507 buildUnnamed3466() { | 505 buildUnnamed3471() { |
508 var o = new core.List<api.Beacon>(); | 506 var o = new core.List<api.Beacon>(); |
509 o.add(buildBeacon()); | 507 o.add(buildBeacon()); |
510 o.add(buildBeacon()); | 508 o.add(buildBeacon()); |
511 return o; | 509 return o; |
512 } | 510 } |
513 | 511 |
514 checkUnnamed3466(core.List<api.Beacon> o) { | 512 checkUnnamed3471(core.List<api.Beacon> o) { |
515 unittest.expect(o, unittest.hasLength(2)); | 513 unittest.expect(o, unittest.hasLength(2)); |
516 checkBeacon(o[0]); | 514 checkBeacon(o[0]); |
517 checkBeacon(o[1]); | 515 checkBeacon(o[1]); |
518 } | 516 } |
519 | 517 |
520 core.int buildCounterListBeaconsResponse = 0; | 518 core.int buildCounterListBeaconsResponse = 0; |
521 buildListBeaconsResponse() { | 519 buildListBeaconsResponse() { |
522 var o = new api.ListBeaconsResponse(); | 520 var o = new api.ListBeaconsResponse(); |
523 buildCounterListBeaconsResponse++; | 521 buildCounterListBeaconsResponse++; |
524 if (buildCounterListBeaconsResponse < 3) { | 522 if (buildCounterListBeaconsResponse < 3) { |
525 o.beacons = buildUnnamed3466(); | 523 o.beacons = buildUnnamed3471(); |
526 o.nextPageToken = "foo"; | 524 o.nextPageToken = "foo"; |
527 o.totalCount = "foo"; | 525 o.totalCount = "foo"; |
528 } | 526 } |
529 buildCounterListBeaconsResponse--; | 527 buildCounterListBeaconsResponse--; |
530 return o; | 528 return o; |
531 } | 529 } |
532 | 530 |
533 checkListBeaconsResponse(api.ListBeaconsResponse o) { | 531 checkListBeaconsResponse(api.ListBeaconsResponse o) { |
534 buildCounterListBeaconsResponse++; | 532 buildCounterListBeaconsResponse++; |
535 if (buildCounterListBeaconsResponse < 3) { | 533 if (buildCounterListBeaconsResponse < 3) { |
536 checkUnnamed3466(o.beacons); | 534 checkUnnamed3471(o.beacons); |
537 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 535 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
538 unittest.expect(o.totalCount, unittest.equals('foo')); | 536 unittest.expect(o.totalCount, unittest.equals('foo')); |
539 } | 537 } |
540 buildCounterListBeaconsResponse--; | 538 buildCounterListBeaconsResponse--; |
541 } | 539 } |
542 | 540 |
543 buildUnnamed3467() { | 541 buildUnnamed3472() { |
544 var o = new core.List<api.Diagnostics>(); | 542 var o = new core.List<api.Diagnostics>(); |
545 o.add(buildDiagnostics()); | 543 o.add(buildDiagnostics()); |
546 o.add(buildDiagnostics()); | 544 o.add(buildDiagnostics()); |
547 return o; | 545 return o; |
548 } | 546 } |
549 | 547 |
550 checkUnnamed3467(core.List<api.Diagnostics> o) { | 548 checkUnnamed3472(core.List<api.Diagnostics> o) { |
551 unittest.expect(o, unittest.hasLength(2)); | 549 unittest.expect(o, unittest.hasLength(2)); |
552 checkDiagnostics(o[0]); | 550 checkDiagnostics(o[0]); |
553 checkDiagnostics(o[1]); | 551 checkDiagnostics(o[1]); |
554 } | 552 } |
555 | 553 |
556 core.int buildCounterListDiagnosticsResponse = 0; | 554 core.int buildCounterListDiagnosticsResponse = 0; |
557 buildListDiagnosticsResponse() { | 555 buildListDiagnosticsResponse() { |
558 var o = new api.ListDiagnosticsResponse(); | 556 var o = new api.ListDiagnosticsResponse(); |
559 buildCounterListDiagnosticsResponse++; | 557 buildCounterListDiagnosticsResponse++; |
560 if (buildCounterListDiagnosticsResponse < 3) { | 558 if (buildCounterListDiagnosticsResponse < 3) { |
561 o.diagnostics = buildUnnamed3467(); | 559 o.diagnostics = buildUnnamed3472(); |
562 o.nextPageToken = "foo"; | 560 o.nextPageToken = "foo"; |
563 } | 561 } |
564 buildCounterListDiagnosticsResponse--; | 562 buildCounterListDiagnosticsResponse--; |
565 return o; | 563 return o; |
566 } | 564 } |
567 | 565 |
568 checkListDiagnosticsResponse(api.ListDiagnosticsResponse o) { | 566 checkListDiagnosticsResponse(api.ListDiagnosticsResponse o) { |
569 buildCounterListDiagnosticsResponse++; | 567 buildCounterListDiagnosticsResponse++; |
570 if (buildCounterListDiagnosticsResponse < 3) { | 568 if (buildCounterListDiagnosticsResponse < 3) { |
571 checkUnnamed3467(o.diagnostics); | 569 checkUnnamed3472(o.diagnostics); |
572 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 570 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
573 } | 571 } |
574 buildCounterListDiagnosticsResponse--; | 572 buildCounterListDiagnosticsResponse--; |
575 } | 573 } |
576 | 574 |
577 buildUnnamed3468() { | 575 buildUnnamed3473() { |
578 var o = new core.List<api.Namespace>(); | 576 var o = new core.List<api.Namespace>(); |
579 o.add(buildNamespace()); | 577 o.add(buildNamespace()); |
580 o.add(buildNamespace()); | 578 o.add(buildNamespace()); |
581 return o; | 579 return o; |
582 } | 580 } |
583 | 581 |
584 checkUnnamed3468(core.List<api.Namespace> o) { | 582 checkUnnamed3473(core.List<api.Namespace> o) { |
585 unittest.expect(o, unittest.hasLength(2)); | 583 unittest.expect(o, unittest.hasLength(2)); |
586 checkNamespace(o[0]); | 584 checkNamespace(o[0]); |
587 checkNamespace(o[1]); | 585 checkNamespace(o[1]); |
588 } | 586 } |
589 | 587 |
590 core.int buildCounterListNamespacesResponse = 0; | 588 core.int buildCounterListNamespacesResponse = 0; |
591 buildListNamespacesResponse() { | 589 buildListNamespacesResponse() { |
592 var o = new api.ListNamespacesResponse(); | 590 var o = new api.ListNamespacesResponse(); |
593 buildCounterListNamespacesResponse++; | 591 buildCounterListNamespacesResponse++; |
594 if (buildCounterListNamespacesResponse < 3) { | 592 if (buildCounterListNamespacesResponse < 3) { |
595 o.namespaces = buildUnnamed3468(); | 593 o.namespaces = buildUnnamed3473(); |
596 } | 594 } |
597 buildCounterListNamespacesResponse--; | 595 buildCounterListNamespacesResponse--; |
598 return o; | 596 return o; |
599 } | 597 } |
600 | 598 |
601 checkListNamespacesResponse(api.ListNamespacesResponse o) { | 599 checkListNamespacesResponse(api.ListNamespacesResponse o) { |
602 buildCounterListNamespacesResponse++; | 600 buildCounterListNamespacesResponse++; |
603 if (buildCounterListNamespacesResponse < 3) { | 601 if (buildCounterListNamespacesResponse < 3) { |
604 checkUnnamed3468(o.namespaces); | 602 checkUnnamed3473(o.namespaces); |
605 } | 603 } |
606 buildCounterListNamespacesResponse--; | 604 buildCounterListNamespacesResponse--; |
607 } | 605 } |
608 | 606 |
609 core.int buildCounterNamespace = 0; | 607 core.int buildCounterNamespace = 0; |
610 buildNamespace() { | 608 buildNamespace() { |
611 var o = new api.Namespace(); | 609 var o = new api.Namespace(); |
612 buildCounterNamespace++; | 610 buildCounterNamespace++; |
613 if (buildCounterNamespace < 3) { | 611 if (buildCounterNamespace < 3) { |
614 o.namespaceName = "foo"; | 612 o.namespaceName = "foo"; |
(...skipping 28 matching lines...) Expand all Loading... |
643 checkObservation(api.Observation o) { | 641 checkObservation(api.Observation o) { |
644 buildCounterObservation++; | 642 buildCounterObservation++; |
645 if (buildCounterObservation < 3) { | 643 if (buildCounterObservation < 3) { |
646 checkAdvertisedId(o.advertisedId); | 644 checkAdvertisedId(o.advertisedId); |
647 unittest.expect(o.telemetry, unittest.equals('foo')); | 645 unittest.expect(o.telemetry, unittest.equals('foo')); |
648 unittest.expect(o.timestampMs, unittest.equals('foo')); | 646 unittest.expect(o.timestampMs, unittest.equals('foo')); |
649 } | 647 } |
650 buildCounterObservation--; | 648 buildCounterObservation--; |
651 } | 649 } |
652 | 650 |
653 | |
654 main() { | 651 main() { |
655 unittest.group("obj-schema-AdvertisedId", () { | 652 unittest.group("obj-schema-AdvertisedId", () { |
656 unittest.test("to-json--from-json", () { | 653 unittest.test("to-json--from-json", () { |
657 var o = buildAdvertisedId(); | 654 var o = buildAdvertisedId(); |
658 var od = new api.AdvertisedId.fromJson(o.toJson()); | 655 var od = new api.AdvertisedId.fromJson(o.toJson()); |
659 checkAdvertisedId(od); | 656 checkAdvertisedId(od); |
660 }); | 657 }); |
661 }); | 658 }); |
662 | 659 |
663 | |
664 unittest.group("obj-schema-AttachmentInfo", () { | 660 unittest.group("obj-schema-AttachmentInfo", () { |
665 unittest.test("to-json--from-json", () { | 661 unittest.test("to-json--from-json", () { |
666 var o = buildAttachmentInfo(); | 662 var o = buildAttachmentInfo(); |
667 var od = new api.AttachmentInfo.fromJson(o.toJson()); | 663 var od = new api.AttachmentInfo.fromJson(o.toJson()); |
668 checkAttachmentInfo(od); | 664 checkAttachmentInfo(od); |
669 }); | 665 }); |
670 }); | 666 }); |
671 | 667 |
672 | |
673 unittest.group("obj-schema-Beacon", () { | 668 unittest.group("obj-schema-Beacon", () { |
674 unittest.test("to-json--from-json", () { | 669 unittest.test("to-json--from-json", () { |
675 var o = buildBeacon(); | 670 var o = buildBeacon(); |
676 var od = new api.Beacon.fromJson(o.toJson()); | 671 var od = new api.Beacon.fromJson(o.toJson()); |
677 checkBeacon(od); | 672 checkBeacon(od); |
678 }); | 673 }); |
679 }); | 674 }); |
680 | 675 |
681 | |
682 unittest.group("obj-schema-BeaconAttachment", () { | 676 unittest.group("obj-schema-BeaconAttachment", () { |
683 unittest.test("to-json--from-json", () { | 677 unittest.test("to-json--from-json", () { |
684 var o = buildBeaconAttachment(); | 678 var o = buildBeaconAttachment(); |
685 var od = new api.BeaconAttachment.fromJson(o.toJson()); | 679 var od = new api.BeaconAttachment.fromJson(o.toJson()); |
686 checkBeaconAttachment(od); | 680 checkBeaconAttachment(od); |
687 }); | 681 }); |
688 }); | 682 }); |
689 | 683 |
690 | |
691 unittest.group("obj-schema-BeaconInfo", () { | 684 unittest.group("obj-schema-BeaconInfo", () { |
692 unittest.test("to-json--from-json", () { | 685 unittest.test("to-json--from-json", () { |
693 var o = buildBeaconInfo(); | 686 var o = buildBeaconInfo(); |
694 var od = new api.BeaconInfo.fromJson(o.toJson()); | 687 var od = new api.BeaconInfo.fromJson(o.toJson()); |
695 checkBeaconInfo(od); | 688 checkBeaconInfo(od); |
696 }); | 689 }); |
697 }); | 690 }); |
698 | 691 |
699 | |
700 unittest.group("obj-schema-Date", () { | 692 unittest.group("obj-schema-Date", () { |
701 unittest.test("to-json--from-json", () { | 693 unittest.test("to-json--from-json", () { |
702 var o = buildDate(); | 694 var o = buildDate(); |
703 var od = new api.Date.fromJson(o.toJson()); | 695 var od = new api.Date.fromJson(o.toJson()); |
704 checkDate(od); | 696 checkDate(od); |
705 }); | 697 }); |
706 }); | 698 }); |
707 | 699 |
708 | |
709 unittest.group("obj-schema-DeleteAttachmentsResponse", () { | 700 unittest.group("obj-schema-DeleteAttachmentsResponse", () { |
710 unittest.test("to-json--from-json", () { | 701 unittest.test("to-json--from-json", () { |
711 var o = buildDeleteAttachmentsResponse(); | 702 var o = buildDeleteAttachmentsResponse(); |
712 var od = new api.DeleteAttachmentsResponse.fromJson(o.toJson()); | 703 var od = new api.DeleteAttachmentsResponse.fromJson(o.toJson()); |
713 checkDeleteAttachmentsResponse(od); | 704 checkDeleteAttachmentsResponse(od); |
714 }); | 705 }); |
715 }); | 706 }); |
716 | 707 |
717 | |
718 unittest.group("obj-schema-Diagnostics", () { | 708 unittest.group("obj-schema-Diagnostics", () { |
719 unittest.test("to-json--from-json", () { | 709 unittest.test("to-json--from-json", () { |
720 var o = buildDiagnostics(); | 710 var o = buildDiagnostics(); |
721 var od = new api.Diagnostics.fromJson(o.toJson()); | 711 var od = new api.Diagnostics.fromJson(o.toJson()); |
722 checkDiagnostics(od); | 712 checkDiagnostics(od); |
723 }); | 713 }); |
724 }); | 714 }); |
725 | 715 |
726 | |
727 unittest.group("obj-schema-Empty", () { | 716 unittest.group("obj-schema-Empty", () { |
728 unittest.test("to-json--from-json", () { | 717 unittest.test("to-json--from-json", () { |
729 var o = buildEmpty(); | 718 var o = buildEmpty(); |
730 var od = new api.Empty.fromJson(o.toJson()); | 719 var od = new api.Empty.fromJson(o.toJson()); |
731 checkEmpty(od); | 720 checkEmpty(od); |
732 }); | 721 }); |
733 }); | 722 }); |
734 | 723 |
735 | |
736 unittest.group("obj-schema-EphemeralIdRegistration", () { | 724 unittest.group("obj-schema-EphemeralIdRegistration", () { |
737 unittest.test("to-json--from-json", () { | 725 unittest.test("to-json--from-json", () { |
738 var o = buildEphemeralIdRegistration(); | 726 var o = buildEphemeralIdRegistration(); |
739 var od = new api.EphemeralIdRegistration.fromJson(o.toJson()); | 727 var od = new api.EphemeralIdRegistration.fromJson(o.toJson()); |
740 checkEphemeralIdRegistration(od); | 728 checkEphemeralIdRegistration(od); |
741 }); | 729 }); |
742 }); | 730 }); |
743 | 731 |
744 | |
745 unittest.group("obj-schema-EphemeralIdRegistrationParams", () { | 732 unittest.group("obj-schema-EphemeralIdRegistrationParams", () { |
746 unittest.test("to-json--from-json", () { | 733 unittest.test("to-json--from-json", () { |
747 var o = buildEphemeralIdRegistrationParams(); | 734 var o = buildEphemeralIdRegistrationParams(); |
748 var od = new api.EphemeralIdRegistrationParams.fromJson(o.toJson()); | 735 var od = new api.EphemeralIdRegistrationParams.fromJson(o.toJson()); |
749 checkEphemeralIdRegistrationParams(od); | 736 checkEphemeralIdRegistrationParams(od); |
750 }); | 737 }); |
751 }); | 738 }); |
752 | 739 |
753 | |
754 unittest.group("obj-schema-GetInfoForObservedBeaconsRequest", () { | 740 unittest.group("obj-schema-GetInfoForObservedBeaconsRequest", () { |
755 unittest.test("to-json--from-json", () { | 741 unittest.test("to-json--from-json", () { |
756 var o = buildGetInfoForObservedBeaconsRequest(); | 742 var o = buildGetInfoForObservedBeaconsRequest(); |
757 var od = new api.GetInfoForObservedBeaconsRequest.fromJson(o.toJson()); | 743 var od = new api.GetInfoForObservedBeaconsRequest.fromJson(o.toJson()); |
758 checkGetInfoForObservedBeaconsRequest(od); | 744 checkGetInfoForObservedBeaconsRequest(od); |
759 }); | 745 }); |
760 }); | 746 }); |
761 | 747 |
762 | |
763 unittest.group("obj-schema-GetInfoForObservedBeaconsResponse", () { | 748 unittest.group("obj-schema-GetInfoForObservedBeaconsResponse", () { |
764 unittest.test("to-json--from-json", () { | 749 unittest.test("to-json--from-json", () { |
765 var o = buildGetInfoForObservedBeaconsResponse(); | 750 var o = buildGetInfoForObservedBeaconsResponse(); |
766 var od = new api.GetInfoForObservedBeaconsResponse.fromJson(o.toJson()); | 751 var od = new api.GetInfoForObservedBeaconsResponse.fromJson(o.toJson()); |
767 checkGetInfoForObservedBeaconsResponse(od); | 752 checkGetInfoForObservedBeaconsResponse(od); |
768 }); | 753 }); |
769 }); | 754 }); |
770 | 755 |
771 | |
772 unittest.group("obj-schema-IndoorLevel", () { | 756 unittest.group("obj-schema-IndoorLevel", () { |
773 unittest.test("to-json--from-json", () { | 757 unittest.test("to-json--from-json", () { |
774 var o = buildIndoorLevel(); | 758 var o = buildIndoorLevel(); |
775 var od = new api.IndoorLevel.fromJson(o.toJson()); | 759 var od = new api.IndoorLevel.fromJson(o.toJson()); |
776 checkIndoorLevel(od); | 760 checkIndoorLevel(od); |
777 }); | 761 }); |
778 }); | 762 }); |
779 | 763 |
780 | |
781 unittest.group("obj-schema-LatLng", () { | 764 unittest.group("obj-schema-LatLng", () { |
782 unittest.test("to-json--from-json", () { | 765 unittest.test("to-json--from-json", () { |
783 var o = buildLatLng(); | 766 var o = buildLatLng(); |
784 var od = new api.LatLng.fromJson(o.toJson()); | 767 var od = new api.LatLng.fromJson(o.toJson()); |
785 checkLatLng(od); | 768 checkLatLng(od); |
786 }); | 769 }); |
787 }); | 770 }); |
788 | 771 |
789 | |
790 unittest.group("obj-schema-ListBeaconAttachmentsResponse", () { | 772 unittest.group("obj-schema-ListBeaconAttachmentsResponse", () { |
791 unittest.test("to-json--from-json", () { | 773 unittest.test("to-json--from-json", () { |
792 var o = buildListBeaconAttachmentsResponse(); | 774 var o = buildListBeaconAttachmentsResponse(); |
793 var od = new api.ListBeaconAttachmentsResponse.fromJson(o.toJson()); | 775 var od = new api.ListBeaconAttachmentsResponse.fromJson(o.toJson()); |
794 checkListBeaconAttachmentsResponse(od); | 776 checkListBeaconAttachmentsResponse(od); |
795 }); | 777 }); |
796 }); | 778 }); |
797 | 779 |
798 | |
799 unittest.group("obj-schema-ListBeaconsResponse", () { | 780 unittest.group("obj-schema-ListBeaconsResponse", () { |
800 unittest.test("to-json--from-json", () { | 781 unittest.test("to-json--from-json", () { |
801 var o = buildListBeaconsResponse(); | 782 var o = buildListBeaconsResponse(); |
802 var od = new api.ListBeaconsResponse.fromJson(o.toJson()); | 783 var od = new api.ListBeaconsResponse.fromJson(o.toJson()); |
803 checkListBeaconsResponse(od); | 784 checkListBeaconsResponse(od); |
804 }); | 785 }); |
805 }); | 786 }); |
806 | 787 |
807 | |
808 unittest.group("obj-schema-ListDiagnosticsResponse", () { | 788 unittest.group("obj-schema-ListDiagnosticsResponse", () { |
809 unittest.test("to-json--from-json", () { | 789 unittest.test("to-json--from-json", () { |
810 var o = buildListDiagnosticsResponse(); | 790 var o = buildListDiagnosticsResponse(); |
811 var od = new api.ListDiagnosticsResponse.fromJson(o.toJson()); | 791 var od = new api.ListDiagnosticsResponse.fromJson(o.toJson()); |
812 checkListDiagnosticsResponse(od); | 792 checkListDiagnosticsResponse(od); |
813 }); | 793 }); |
814 }); | 794 }); |
815 | 795 |
816 | |
817 unittest.group("obj-schema-ListNamespacesResponse", () { | 796 unittest.group("obj-schema-ListNamespacesResponse", () { |
818 unittest.test("to-json--from-json", () { | 797 unittest.test("to-json--from-json", () { |
819 var o = buildListNamespacesResponse(); | 798 var o = buildListNamespacesResponse(); |
820 var od = new api.ListNamespacesResponse.fromJson(o.toJson()); | 799 var od = new api.ListNamespacesResponse.fromJson(o.toJson()); |
821 checkListNamespacesResponse(od); | 800 checkListNamespacesResponse(od); |
822 }); | 801 }); |
823 }); | 802 }); |
824 | 803 |
825 | |
826 unittest.group("obj-schema-Namespace", () { | 804 unittest.group("obj-schema-Namespace", () { |
827 unittest.test("to-json--from-json", () { | 805 unittest.test("to-json--from-json", () { |
828 var o = buildNamespace(); | 806 var o = buildNamespace(); |
829 var od = new api.Namespace.fromJson(o.toJson()); | 807 var od = new api.Namespace.fromJson(o.toJson()); |
830 checkNamespace(od); | 808 checkNamespace(od); |
831 }); | 809 }); |
832 }); | 810 }); |
833 | 811 |
834 | |
835 unittest.group("obj-schema-Observation", () { | 812 unittest.group("obj-schema-Observation", () { |
836 unittest.test("to-json--from-json", () { | 813 unittest.test("to-json--from-json", () { |
837 var o = buildObservation(); | 814 var o = buildObservation(); |
838 var od = new api.Observation.fromJson(o.toJson()); | 815 var od = new api.Observation.fromJson(o.toJson()); |
839 checkObservation(od); | 816 checkObservation(od); |
840 }); | 817 }); |
841 }); | 818 }); |
842 | 819 |
843 | |
844 unittest.group("resource-BeaconinfoResourceApi", () { | 820 unittest.group("resource-BeaconinfoResourceApi", () { |
845 unittest.test("method--getforobserved", () { | 821 unittest.test("method--getforobserved", () { |
846 | |
847 var mock = new HttpServerMock(); | 822 var mock = new HttpServerMock(); |
848 api.BeaconinfoResourceApi res = new api.ProximitybeaconApi(mock).beaconinf
o; | 823 api.BeaconinfoResourceApi res = |
| 824 new api.ProximitybeaconApi(mock).beaconinfo; |
849 var arg_request = buildGetInfoForObservedBeaconsRequest(); | 825 var arg_request = buildGetInfoForObservedBeaconsRequest(); |
850 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 826 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
851 var obj = new api.GetInfoForObservedBeaconsRequest.fromJson(json); | 827 var obj = new api.GetInfoForObservedBeaconsRequest.fromJson(json); |
852 checkGetInfoForObservedBeaconsRequest(obj); | 828 checkGetInfoForObservedBeaconsRequest(obj); |
853 | 829 |
854 var path = (req.url).path; | 830 var path = (req.url).path; |
855 var pathOffset = 0; | 831 var pathOffset = 0; |
856 var index; | 832 var index; |
857 var subPart; | 833 var subPart; |
858 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 834 unittest.expect( |
| 835 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
859 pathOffset += 1; | 836 pathOffset += 1; |
860 unittest.expect(path.substring(pathOffset, pathOffset + 33), unittest.eq
uals("v1beta1/beaconinfo:getforobserved")); | 837 unittest.expect(path.substring(pathOffset, pathOffset + 33), |
| 838 unittest.equals("v1beta1/beaconinfo:getforobserved")); |
861 pathOffset += 33; | 839 pathOffset += 33; |
862 | 840 |
863 var query = (req.url).query; | 841 var query = (req.url).query; |
864 var queryOffset = 0; | 842 var queryOffset = 0; |
865 var queryMap = {}; | 843 var queryMap = {}; |
866 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 844 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
867 parseBool(n) { | 845 parseBool(n) { |
868 if (n == "true") return true; | 846 if (n == "true") return true; |
869 if (n == "false") return false; | 847 if (n == "false") return false; |
870 if (n == null) return null; | 848 if (n == null) return null; |
871 throw new core.ArgumentError("Invalid boolean: $n"); | 849 throw new core.ArgumentError("Invalid boolean: $n"); |
872 } | 850 } |
| 851 |
873 if (query.length > 0) { | 852 if (query.length > 0) { |
874 for (var part in query.split("&")) { | 853 for (var part in query.split("&")) { |
875 var keyvalue = part.split("="); | 854 var keyvalue = part.split("="); |
876 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 855 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 856 core.Uri.decodeQueryComponent(keyvalue[1])); |
877 } | 857 } |
878 } | 858 } |
879 | 859 |
880 | |
881 var h = { | 860 var h = { |
882 "content-type" : "application/json; charset=utf-8", | 861 "content-type": "application/json; charset=utf-8", |
883 }; | 862 }; |
884 var resp = convert.JSON.encode(buildGetInfoForObservedBeaconsResponse())
; | 863 var resp = |
| 864 convert.JSON.encode(buildGetInfoForObservedBeaconsResponse()); |
885 return new async.Future.value(stringResponse(200, h, resp)); | 865 return new async.Future.value(stringResponse(200, h, resp)); |
886 }), true); | 866 }), true); |
887 res.getforobserved(arg_request).then(unittest.expectAsync1(((api.GetInfoFo
rObservedBeaconsResponse response) { | 867 res.getforobserved(arg_request).then(unittest |
| 868 .expectAsync1(((api.GetInfoForObservedBeaconsResponse response) { |
888 checkGetInfoForObservedBeaconsResponse(response); | 869 checkGetInfoForObservedBeaconsResponse(response); |
889 }))); | 870 }))); |
890 }); | 871 }); |
891 | |
892 }); | 872 }); |
893 | 873 |
894 | |
895 unittest.group("resource-BeaconsResourceApi", () { | 874 unittest.group("resource-BeaconsResourceApi", () { |
896 unittest.test("method--activate", () { | 875 unittest.test("method--activate", () { |
897 | |
898 var mock = new HttpServerMock(); | 876 var mock = new HttpServerMock(); |
899 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 877 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
900 var arg_beaconName = "foo"; | 878 var arg_beaconName = "foo"; |
901 var arg_projectId = "foo"; | 879 var arg_projectId = "foo"; |
902 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 880 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
903 var path = (req.url).path; | 881 var path = (req.url).path; |
904 var pathOffset = 0; | 882 var pathOffset = 0; |
905 var index; | 883 var index; |
906 var subPart; | 884 var subPart; |
907 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 885 unittest.expect( |
| 886 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
908 pathOffset += 1; | 887 pathOffset += 1; |
909 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 888 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 889 unittest.equals("v1beta1/")); |
910 pathOffset += 8; | 890 pathOffset += 8; |
911 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 891 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
912 | 892 |
913 var query = (req.url).query; | 893 var query = (req.url).query; |
914 var queryOffset = 0; | 894 var queryOffset = 0; |
915 var queryMap = {}; | 895 var queryMap = {}; |
916 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 896 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
917 parseBool(n) { | 897 parseBool(n) { |
918 if (n == "true") return true; | 898 if (n == "true") return true; |
919 if (n == "false") return false; | 899 if (n == "false") return false; |
920 if (n == null) return null; | 900 if (n == null) return null; |
921 throw new core.ArgumentError("Invalid boolean: $n"); | 901 throw new core.ArgumentError("Invalid boolean: $n"); |
922 } | 902 } |
| 903 |
923 if (query.length > 0) { | 904 if (query.length > 0) { |
924 for (var part in query.split("&")) { | 905 for (var part in query.split("&")) { |
925 var keyvalue = part.split("="); | 906 var keyvalue = part.split("="); |
926 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 907 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 908 core.Uri.decodeQueryComponent(keyvalue[1])); |
927 } | 909 } |
928 } | 910 } |
929 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 911 unittest.expect( |
930 | 912 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
931 | 913 |
932 var h = { | 914 var h = { |
933 "content-type" : "application/json; charset=utf-8", | 915 "content-type": "application/json; charset=utf-8", |
934 }; | 916 }; |
935 var resp = convert.JSON.encode(buildEmpty()); | 917 var resp = convert.JSON.encode(buildEmpty()); |
936 return new async.Future.value(stringResponse(200, h, resp)); | 918 return new async.Future.value(stringResponse(200, h, resp)); |
937 }), true); | 919 }), true); |
938 res.activate(arg_beaconName, projectId: arg_projectId).then(unittest.expec
tAsync1(((api.Empty response) { | 920 res |
| 921 .activate(arg_beaconName, projectId: arg_projectId) |
| 922 .then(unittest.expectAsync1(((api.Empty response) { |
939 checkEmpty(response); | 923 checkEmpty(response); |
940 }))); | 924 }))); |
941 }); | 925 }); |
942 | 926 |
943 unittest.test("method--deactivate", () { | 927 unittest.test("method--deactivate", () { |
944 | |
945 var mock = new HttpServerMock(); | 928 var mock = new HttpServerMock(); |
946 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 929 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
947 var arg_beaconName = "foo"; | 930 var arg_beaconName = "foo"; |
948 var arg_projectId = "foo"; | 931 var arg_projectId = "foo"; |
949 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 932 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
950 var path = (req.url).path; | 933 var path = (req.url).path; |
951 var pathOffset = 0; | 934 var pathOffset = 0; |
952 var index; | 935 var index; |
953 var subPart; | 936 var subPart; |
954 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 937 unittest.expect( |
| 938 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
955 pathOffset += 1; | 939 pathOffset += 1; |
956 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 940 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 941 unittest.equals("v1beta1/")); |
957 pathOffset += 8; | 942 pathOffset += 8; |
958 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 943 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
959 | 944 |
960 var query = (req.url).query; | 945 var query = (req.url).query; |
961 var queryOffset = 0; | 946 var queryOffset = 0; |
962 var queryMap = {}; | 947 var queryMap = {}; |
963 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 948 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
964 parseBool(n) { | 949 parseBool(n) { |
965 if (n == "true") return true; | 950 if (n == "true") return true; |
966 if (n == "false") return false; | 951 if (n == "false") return false; |
967 if (n == null) return null; | 952 if (n == null) return null; |
968 throw new core.ArgumentError("Invalid boolean: $n"); | 953 throw new core.ArgumentError("Invalid boolean: $n"); |
969 } | 954 } |
| 955 |
970 if (query.length > 0) { | 956 if (query.length > 0) { |
971 for (var part in query.split("&")) { | 957 for (var part in query.split("&")) { |
972 var keyvalue = part.split("="); | 958 var keyvalue = part.split("="); |
973 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 959 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 960 core.Uri.decodeQueryComponent(keyvalue[1])); |
974 } | 961 } |
975 } | 962 } |
976 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 963 unittest.expect( |
977 | 964 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
978 | 965 |
979 var h = { | 966 var h = { |
980 "content-type" : "application/json; charset=utf-8", | 967 "content-type": "application/json; charset=utf-8", |
981 }; | 968 }; |
982 var resp = convert.JSON.encode(buildEmpty()); | 969 var resp = convert.JSON.encode(buildEmpty()); |
983 return new async.Future.value(stringResponse(200, h, resp)); | 970 return new async.Future.value(stringResponse(200, h, resp)); |
984 }), true); | 971 }), true); |
985 res.deactivate(arg_beaconName, projectId: arg_projectId).then(unittest.exp
ectAsync1(((api.Empty response) { | 972 res |
| 973 .deactivate(arg_beaconName, projectId: arg_projectId) |
| 974 .then(unittest.expectAsync1(((api.Empty response) { |
986 checkEmpty(response); | 975 checkEmpty(response); |
987 }))); | 976 }))); |
988 }); | 977 }); |
989 | 978 |
990 unittest.test("method--decommission", () { | 979 unittest.test("method--decommission", () { |
991 | |
992 var mock = new HttpServerMock(); | 980 var mock = new HttpServerMock(); |
993 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 981 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
994 var arg_beaconName = "foo"; | 982 var arg_beaconName = "foo"; |
995 var arg_projectId = "foo"; | 983 var arg_projectId = "foo"; |
996 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 984 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
997 var path = (req.url).path; | 985 var path = (req.url).path; |
998 var pathOffset = 0; | 986 var pathOffset = 0; |
999 var index; | 987 var index; |
1000 var subPart; | 988 var subPart; |
1001 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 989 unittest.expect( |
| 990 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1002 pathOffset += 1; | 991 pathOffset += 1; |
1003 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 992 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 993 unittest.equals("v1beta1/")); |
1004 pathOffset += 8; | 994 pathOffset += 8; |
1005 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 995 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1006 | 996 |
1007 var query = (req.url).query; | 997 var query = (req.url).query; |
1008 var queryOffset = 0; | 998 var queryOffset = 0; |
1009 var queryMap = {}; | 999 var queryMap = {}; |
1010 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1000 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1011 parseBool(n) { | 1001 parseBool(n) { |
1012 if (n == "true") return true; | 1002 if (n == "true") return true; |
1013 if (n == "false") return false; | 1003 if (n == "false") return false; |
1014 if (n == null) return null; | 1004 if (n == null) return null; |
1015 throw new core.ArgumentError("Invalid boolean: $n"); | 1005 throw new core.ArgumentError("Invalid boolean: $n"); |
1016 } | 1006 } |
| 1007 |
1017 if (query.length > 0) { | 1008 if (query.length > 0) { |
1018 for (var part in query.split("&")) { | 1009 for (var part in query.split("&")) { |
1019 var keyvalue = part.split("="); | 1010 var keyvalue = part.split("="); |
1020 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1011 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1012 core.Uri.decodeQueryComponent(keyvalue[1])); |
1021 } | 1013 } |
1022 } | 1014 } |
1023 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1015 unittest.expect( |
1024 | 1016 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1025 | 1017 |
1026 var h = { | 1018 var h = { |
1027 "content-type" : "application/json; charset=utf-8", | 1019 "content-type": "application/json; charset=utf-8", |
1028 }; | 1020 }; |
1029 var resp = convert.JSON.encode(buildEmpty()); | 1021 var resp = convert.JSON.encode(buildEmpty()); |
1030 return new async.Future.value(stringResponse(200, h, resp)); | 1022 return new async.Future.value(stringResponse(200, h, resp)); |
1031 }), true); | 1023 }), true); |
1032 res.decommission(arg_beaconName, projectId: arg_projectId).then(unittest.e
xpectAsync1(((api.Empty response) { | 1024 res |
| 1025 .decommission(arg_beaconName, projectId: arg_projectId) |
| 1026 .then(unittest.expectAsync1(((api.Empty response) { |
1033 checkEmpty(response); | 1027 checkEmpty(response); |
1034 }))); | 1028 }))); |
1035 }); | 1029 }); |
1036 | 1030 |
1037 unittest.test("method--delete", () { | 1031 unittest.test("method--delete", () { |
1038 | |
1039 var mock = new HttpServerMock(); | 1032 var mock = new HttpServerMock(); |
1040 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 1033 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
1041 var arg_beaconName = "foo"; | 1034 var arg_beaconName = "foo"; |
1042 var arg_projectId = "foo"; | 1035 var arg_projectId = "foo"; |
1043 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1036 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1044 var path = (req.url).path; | 1037 var path = (req.url).path; |
1045 var pathOffset = 0; | 1038 var pathOffset = 0; |
1046 var index; | 1039 var index; |
1047 var subPart; | 1040 var subPart; |
1048 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1041 unittest.expect( |
| 1042 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1049 pathOffset += 1; | 1043 pathOffset += 1; |
1050 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1044 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1045 unittest.equals("v1beta1/")); |
1051 pathOffset += 8; | 1046 pathOffset += 8; |
1052 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1047 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1053 | 1048 |
1054 var query = (req.url).query; | 1049 var query = (req.url).query; |
1055 var queryOffset = 0; | 1050 var queryOffset = 0; |
1056 var queryMap = {}; | 1051 var queryMap = {}; |
1057 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1052 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1058 parseBool(n) { | 1053 parseBool(n) { |
1059 if (n == "true") return true; | 1054 if (n == "true") return true; |
1060 if (n == "false") return false; | 1055 if (n == "false") return false; |
1061 if (n == null) return null; | 1056 if (n == null) return null; |
1062 throw new core.ArgumentError("Invalid boolean: $n"); | 1057 throw new core.ArgumentError("Invalid boolean: $n"); |
1063 } | 1058 } |
| 1059 |
1064 if (query.length > 0) { | 1060 if (query.length > 0) { |
1065 for (var part in query.split("&")) { | 1061 for (var part in query.split("&")) { |
1066 var keyvalue = part.split("="); | 1062 var keyvalue = part.split("="); |
1067 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1063 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1064 core.Uri.decodeQueryComponent(keyvalue[1])); |
1068 } | 1065 } |
1069 } | 1066 } |
1070 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1067 unittest.expect( |
1071 | 1068 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1072 | 1069 |
1073 var h = { | 1070 var h = { |
1074 "content-type" : "application/json; charset=utf-8", | 1071 "content-type": "application/json; charset=utf-8", |
1075 }; | 1072 }; |
1076 var resp = convert.JSON.encode(buildEmpty()); | 1073 var resp = convert.JSON.encode(buildEmpty()); |
1077 return new async.Future.value(stringResponse(200, h, resp)); | 1074 return new async.Future.value(stringResponse(200, h, resp)); |
1078 }), true); | 1075 }), true); |
1079 res.delete(arg_beaconName, projectId: arg_projectId).then(unittest.expectA
sync1(((api.Empty response) { | 1076 res |
| 1077 .delete(arg_beaconName, projectId: arg_projectId) |
| 1078 .then(unittest.expectAsync1(((api.Empty response) { |
1080 checkEmpty(response); | 1079 checkEmpty(response); |
1081 }))); | 1080 }))); |
1082 }); | 1081 }); |
1083 | 1082 |
1084 unittest.test("method--get", () { | 1083 unittest.test("method--get", () { |
1085 | |
1086 var mock = new HttpServerMock(); | 1084 var mock = new HttpServerMock(); |
1087 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 1085 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
1088 var arg_beaconName = "foo"; | 1086 var arg_beaconName = "foo"; |
1089 var arg_projectId = "foo"; | 1087 var arg_projectId = "foo"; |
1090 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1088 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1091 var path = (req.url).path; | 1089 var path = (req.url).path; |
1092 var pathOffset = 0; | 1090 var pathOffset = 0; |
1093 var index; | 1091 var index; |
1094 var subPart; | 1092 var subPart; |
1095 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1093 unittest.expect( |
| 1094 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1096 pathOffset += 1; | 1095 pathOffset += 1; |
1097 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1096 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1097 unittest.equals("v1beta1/")); |
1098 pathOffset += 8; | 1098 pathOffset += 8; |
1099 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1099 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1100 | 1100 |
1101 var query = (req.url).query; | 1101 var query = (req.url).query; |
1102 var queryOffset = 0; | 1102 var queryOffset = 0; |
1103 var queryMap = {}; | 1103 var queryMap = {}; |
1104 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1104 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1105 parseBool(n) { | 1105 parseBool(n) { |
1106 if (n == "true") return true; | 1106 if (n == "true") return true; |
1107 if (n == "false") return false; | 1107 if (n == "false") return false; |
1108 if (n == null) return null; | 1108 if (n == null) return null; |
1109 throw new core.ArgumentError("Invalid boolean: $n"); | 1109 throw new core.ArgumentError("Invalid boolean: $n"); |
1110 } | 1110 } |
| 1111 |
1111 if (query.length > 0) { | 1112 if (query.length > 0) { |
1112 for (var part in query.split("&")) { | 1113 for (var part in query.split("&")) { |
1113 var keyvalue = part.split("="); | 1114 var keyvalue = part.split("="); |
1114 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1115 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1116 core.Uri.decodeQueryComponent(keyvalue[1])); |
1115 } | 1117 } |
1116 } | 1118 } |
1117 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1119 unittest.expect( |
1118 | 1120 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1119 | 1121 |
1120 var h = { | 1122 var h = { |
1121 "content-type" : "application/json; charset=utf-8", | 1123 "content-type": "application/json; charset=utf-8", |
1122 }; | 1124 }; |
1123 var resp = convert.JSON.encode(buildBeacon()); | 1125 var resp = convert.JSON.encode(buildBeacon()); |
1124 return new async.Future.value(stringResponse(200, h, resp)); | 1126 return new async.Future.value(stringResponse(200, h, resp)); |
1125 }), true); | 1127 }), true); |
1126 res.get(arg_beaconName, projectId: arg_projectId).then(unittest.expectAsyn
c1(((api.Beacon response) { | 1128 res |
| 1129 .get(arg_beaconName, projectId: arg_projectId) |
| 1130 .then(unittest.expectAsync1(((api.Beacon response) { |
1127 checkBeacon(response); | 1131 checkBeacon(response); |
1128 }))); | 1132 }))); |
1129 }); | 1133 }); |
1130 | 1134 |
1131 unittest.test("method--list", () { | 1135 unittest.test("method--list", () { |
1132 | |
1133 var mock = new HttpServerMock(); | 1136 var mock = new HttpServerMock(); |
1134 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 1137 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
1135 var arg_projectId = "foo"; | |
1136 var arg_pageToken = "foo"; | 1138 var arg_pageToken = "foo"; |
1137 var arg_pageSize = 42; | 1139 var arg_pageSize = 42; |
1138 var arg_q = "foo"; | 1140 var arg_q = "foo"; |
| 1141 var arg_projectId = "foo"; |
1139 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1142 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1140 var path = (req.url).path; | 1143 var path = (req.url).path; |
1141 var pathOffset = 0; | 1144 var pathOffset = 0; |
1142 var index; | 1145 var index; |
1143 var subPart; | 1146 var subPart; |
1144 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1147 unittest.expect( |
| 1148 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1145 pathOffset += 1; | 1149 pathOffset += 1; |
1146 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("v1beta1/beacons")); | 1150 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 1151 unittest.equals("v1beta1/beacons")); |
1147 pathOffset += 15; | 1152 pathOffset += 15; |
1148 | 1153 |
1149 var query = (req.url).query; | 1154 var query = (req.url).query; |
1150 var queryOffset = 0; | 1155 var queryOffset = 0; |
1151 var queryMap = {}; | 1156 var queryMap = {}; |
1152 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1157 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1153 parseBool(n) { | 1158 parseBool(n) { |
1154 if (n == "true") return true; | 1159 if (n == "true") return true; |
1155 if (n == "false") return false; | 1160 if (n == "false") return false; |
1156 if (n == null) return null; | 1161 if (n == null) return null; |
1157 throw new core.ArgumentError("Invalid boolean: $n"); | 1162 throw new core.ArgumentError("Invalid boolean: $n"); |
1158 } | 1163 } |
| 1164 |
1159 if (query.length > 0) { | 1165 if (query.length > 0) { |
1160 for (var part in query.split("&")) { | 1166 for (var part in query.split("&")) { |
1161 var keyvalue = part.split("="); | 1167 var keyvalue = part.split("="); |
1162 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1168 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1169 core.Uri.decodeQueryComponent(keyvalue[1])); |
1163 } | 1170 } |
1164 } | 1171 } |
1165 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1172 unittest.expect( |
1166 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1173 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1167 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1174 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1175 unittest.equals(arg_pageSize)); |
1168 unittest.expect(queryMap["q"].first, unittest.equals(arg_q)); | 1176 unittest.expect(queryMap["q"].first, unittest.equals(arg_q)); |
1169 | 1177 unittest.expect( |
| 1178 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1170 | 1179 |
1171 var h = { | 1180 var h = { |
1172 "content-type" : "application/json; charset=utf-8", | 1181 "content-type": "application/json; charset=utf-8", |
1173 }; | 1182 }; |
1174 var resp = convert.JSON.encode(buildListBeaconsResponse()); | 1183 var resp = convert.JSON.encode(buildListBeaconsResponse()); |
1175 return new async.Future.value(stringResponse(200, h, resp)); | 1184 return new async.Future.value(stringResponse(200, h, resp)); |
1176 }), true); | 1185 }), true); |
1177 res.list(projectId: arg_projectId, pageToken: arg_pageToken, pageSize: arg
_pageSize, q: arg_q).then(unittest.expectAsync1(((api.ListBeaconsResponse respon
se) { | 1186 res |
| 1187 .list( |
| 1188 pageToken: arg_pageToken, |
| 1189 pageSize: arg_pageSize, |
| 1190 q: arg_q, |
| 1191 projectId: arg_projectId) |
| 1192 .then(unittest.expectAsync1(((api.ListBeaconsResponse response) { |
1178 checkListBeaconsResponse(response); | 1193 checkListBeaconsResponse(response); |
1179 }))); | 1194 }))); |
1180 }); | 1195 }); |
1181 | 1196 |
1182 unittest.test("method--register", () { | 1197 unittest.test("method--register", () { |
1183 | |
1184 var mock = new HttpServerMock(); | 1198 var mock = new HttpServerMock(); |
1185 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 1199 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
1186 var arg_request = buildBeacon(); | 1200 var arg_request = buildBeacon(); |
1187 var arg_projectId = "foo"; | 1201 var arg_projectId = "foo"; |
1188 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1202 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1189 var obj = new api.Beacon.fromJson(json); | 1203 var obj = new api.Beacon.fromJson(json); |
1190 checkBeacon(obj); | 1204 checkBeacon(obj); |
1191 | 1205 |
1192 var path = (req.url).path; | 1206 var path = (req.url).path; |
1193 var pathOffset = 0; | 1207 var pathOffset = 0; |
1194 var index; | 1208 var index; |
1195 var subPart; | 1209 var subPart; |
1196 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1210 unittest.expect( |
| 1211 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1197 pathOffset += 1; | 1212 pathOffset += 1; |
1198 unittest.expect(path.substring(pathOffset, pathOffset + 24), unittest.eq
uals("v1beta1/beacons:register")); | 1213 unittest.expect(path.substring(pathOffset, pathOffset + 24), |
| 1214 unittest.equals("v1beta1/beacons:register")); |
1199 pathOffset += 24; | 1215 pathOffset += 24; |
1200 | 1216 |
1201 var query = (req.url).query; | 1217 var query = (req.url).query; |
1202 var queryOffset = 0; | 1218 var queryOffset = 0; |
1203 var queryMap = {}; | 1219 var queryMap = {}; |
1204 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1220 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1205 parseBool(n) { | 1221 parseBool(n) { |
1206 if (n == "true") return true; | 1222 if (n == "true") return true; |
1207 if (n == "false") return false; | 1223 if (n == "false") return false; |
1208 if (n == null) return null; | 1224 if (n == null) return null; |
1209 throw new core.ArgumentError("Invalid boolean: $n"); | 1225 throw new core.ArgumentError("Invalid boolean: $n"); |
1210 } | 1226 } |
| 1227 |
1211 if (query.length > 0) { | 1228 if (query.length > 0) { |
1212 for (var part in query.split("&")) { | 1229 for (var part in query.split("&")) { |
1213 var keyvalue = part.split("="); | 1230 var keyvalue = part.split("="); |
1214 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1231 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1232 core.Uri.decodeQueryComponent(keyvalue[1])); |
1215 } | 1233 } |
1216 } | 1234 } |
1217 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1235 unittest.expect( |
1218 | 1236 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1219 | 1237 |
1220 var h = { | 1238 var h = { |
1221 "content-type" : "application/json; charset=utf-8", | 1239 "content-type": "application/json; charset=utf-8", |
1222 }; | 1240 }; |
1223 var resp = convert.JSON.encode(buildBeacon()); | 1241 var resp = convert.JSON.encode(buildBeacon()); |
1224 return new async.Future.value(stringResponse(200, h, resp)); | 1242 return new async.Future.value(stringResponse(200, h, resp)); |
1225 }), true); | 1243 }), true); |
1226 res.register(arg_request, projectId: arg_projectId).then(unittest.expectAs
ync1(((api.Beacon response) { | 1244 res |
| 1245 .register(arg_request, projectId: arg_projectId) |
| 1246 .then(unittest.expectAsync1(((api.Beacon response) { |
1227 checkBeacon(response); | 1247 checkBeacon(response); |
1228 }))); | 1248 }))); |
1229 }); | 1249 }); |
1230 | 1250 |
1231 unittest.test("method--update", () { | 1251 unittest.test("method--update", () { |
1232 | |
1233 var mock = new HttpServerMock(); | 1252 var mock = new HttpServerMock(); |
1234 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; | 1253 api.BeaconsResourceApi res = new api.ProximitybeaconApi(mock).beacons; |
1235 var arg_request = buildBeacon(); | 1254 var arg_request = buildBeacon(); |
1236 var arg_beaconName = "foo"; | 1255 var arg_beaconName = "foo"; |
1237 var arg_projectId = "foo"; | 1256 var arg_projectId = "foo"; |
1238 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1257 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1239 var obj = new api.Beacon.fromJson(json); | 1258 var obj = new api.Beacon.fromJson(json); |
1240 checkBeacon(obj); | 1259 checkBeacon(obj); |
1241 | 1260 |
1242 var path = (req.url).path; | 1261 var path = (req.url).path; |
1243 var pathOffset = 0; | 1262 var pathOffset = 0; |
1244 var index; | 1263 var index; |
1245 var subPart; | 1264 var subPart; |
1246 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1265 unittest.expect( |
| 1266 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1247 pathOffset += 1; | 1267 pathOffset += 1; |
1248 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1268 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1269 unittest.equals("v1beta1/")); |
1249 pathOffset += 8; | 1270 pathOffset += 8; |
1250 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1271 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1251 | 1272 |
1252 var query = (req.url).query; | 1273 var query = (req.url).query; |
1253 var queryOffset = 0; | 1274 var queryOffset = 0; |
1254 var queryMap = {}; | 1275 var queryMap = {}; |
1255 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1276 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1256 parseBool(n) { | 1277 parseBool(n) { |
1257 if (n == "true") return true; | 1278 if (n == "true") return true; |
1258 if (n == "false") return false; | 1279 if (n == "false") return false; |
1259 if (n == null) return null; | 1280 if (n == null) return null; |
1260 throw new core.ArgumentError("Invalid boolean: $n"); | 1281 throw new core.ArgumentError("Invalid boolean: $n"); |
1261 } | 1282 } |
| 1283 |
1262 if (query.length > 0) { | 1284 if (query.length > 0) { |
1263 for (var part in query.split("&")) { | 1285 for (var part in query.split("&")) { |
1264 var keyvalue = part.split("="); | 1286 var keyvalue = part.split("="); |
1265 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1287 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1288 core.Uri.decodeQueryComponent(keyvalue[1])); |
1266 } | 1289 } |
1267 } | 1290 } |
1268 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1291 unittest.expect( |
1269 | 1292 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1270 | 1293 |
1271 var h = { | 1294 var h = { |
1272 "content-type" : "application/json; charset=utf-8", | 1295 "content-type": "application/json; charset=utf-8", |
1273 }; | 1296 }; |
1274 var resp = convert.JSON.encode(buildBeacon()); | 1297 var resp = convert.JSON.encode(buildBeacon()); |
1275 return new async.Future.value(stringResponse(200, h, resp)); | 1298 return new async.Future.value(stringResponse(200, h, resp)); |
1276 }), true); | 1299 }), true); |
1277 res.update(arg_request, arg_beaconName, projectId: arg_projectId).then(uni
ttest.expectAsync1(((api.Beacon response) { | 1300 res |
| 1301 .update(arg_request, arg_beaconName, projectId: arg_projectId) |
| 1302 .then(unittest.expectAsync1(((api.Beacon response) { |
1278 checkBeacon(response); | 1303 checkBeacon(response); |
1279 }))); | 1304 }))); |
1280 }); | 1305 }); |
1281 | |
1282 }); | 1306 }); |
1283 | 1307 |
1284 | |
1285 unittest.group("resource-BeaconsAttachmentsResourceApi", () { | 1308 unittest.group("resource-BeaconsAttachmentsResourceApi", () { |
1286 unittest.test("method--batchDelete", () { | 1309 unittest.test("method--batchDelete", () { |
1287 | |
1288 var mock = new HttpServerMock(); | 1310 var mock = new HttpServerMock(); |
1289 api.BeaconsAttachmentsResourceApi res = new api.ProximitybeaconApi(mock).b
eacons.attachments; | 1311 api.BeaconsAttachmentsResourceApi res = |
| 1312 new api.ProximitybeaconApi(mock).beacons.attachments; |
1290 var arg_beaconName = "foo"; | 1313 var arg_beaconName = "foo"; |
1291 var arg_projectId = "foo"; | 1314 var arg_projectId = "foo"; |
1292 var arg_namespacedType = "foo"; | 1315 var arg_namespacedType = "foo"; |
1293 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1316 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1294 var path = (req.url).path; | 1317 var path = (req.url).path; |
1295 var pathOffset = 0; | 1318 var pathOffset = 0; |
1296 var index; | 1319 var index; |
1297 var subPart; | 1320 var subPart; |
1298 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1321 unittest.expect( |
| 1322 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1299 pathOffset += 1; | 1323 pathOffset += 1; |
1300 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1324 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1325 unittest.equals("v1beta1/")); |
1301 pathOffset += 8; | 1326 pathOffset += 8; |
1302 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1327 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1303 | 1328 |
1304 var query = (req.url).query; | 1329 var query = (req.url).query; |
1305 var queryOffset = 0; | 1330 var queryOffset = 0; |
1306 var queryMap = {}; | 1331 var queryMap = {}; |
1307 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1332 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1308 parseBool(n) { | 1333 parseBool(n) { |
1309 if (n == "true") return true; | 1334 if (n == "true") return true; |
1310 if (n == "false") return false; | 1335 if (n == "false") return false; |
1311 if (n == null) return null; | 1336 if (n == null) return null; |
1312 throw new core.ArgumentError("Invalid boolean: $n"); | 1337 throw new core.ArgumentError("Invalid boolean: $n"); |
1313 } | 1338 } |
| 1339 |
1314 if (query.length > 0) { | 1340 if (query.length > 0) { |
1315 for (var part in query.split("&")) { | 1341 for (var part in query.split("&")) { |
1316 var keyvalue = part.split("="); | 1342 var keyvalue = part.split("="); |
1317 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1343 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1344 core.Uri.decodeQueryComponent(keyvalue[1])); |
1318 } | 1345 } |
1319 } | 1346 } |
1320 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1347 unittest.expect( |
1321 unittest.expect(queryMap["namespacedType"].first, unittest.equals(arg_na
mespacedType)); | 1348 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1322 | 1349 unittest.expect(queryMap["namespacedType"].first, |
| 1350 unittest.equals(arg_namespacedType)); |
1323 | 1351 |
1324 var h = { | 1352 var h = { |
1325 "content-type" : "application/json; charset=utf-8", | 1353 "content-type": "application/json; charset=utf-8", |
1326 }; | 1354 }; |
1327 var resp = convert.JSON.encode(buildDeleteAttachmentsResponse()); | 1355 var resp = convert.JSON.encode(buildDeleteAttachmentsResponse()); |
1328 return new async.Future.value(stringResponse(200, h, resp)); | 1356 return new async.Future.value(stringResponse(200, h, resp)); |
1329 }), true); | 1357 }), true); |
1330 res.batchDelete(arg_beaconName, projectId: arg_projectId, namespacedType:
arg_namespacedType).then(unittest.expectAsync1(((api.DeleteAttachmentsResponse r
esponse) { | 1358 res |
| 1359 .batchDelete(arg_beaconName, |
| 1360 projectId: arg_projectId, namespacedType: arg_namespacedType) |
| 1361 .then( |
| 1362 unittest.expectAsync1(((api.DeleteAttachmentsResponse response) { |
1331 checkDeleteAttachmentsResponse(response); | 1363 checkDeleteAttachmentsResponse(response); |
1332 }))); | 1364 }))); |
1333 }); | 1365 }); |
1334 | 1366 |
1335 unittest.test("method--create", () { | 1367 unittest.test("method--create", () { |
1336 | |
1337 var mock = new HttpServerMock(); | 1368 var mock = new HttpServerMock(); |
1338 api.BeaconsAttachmentsResourceApi res = new api.ProximitybeaconApi(mock).b
eacons.attachments; | 1369 api.BeaconsAttachmentsResourceApi res = |
| 1370 new api.ProximitybeaconApi(mock).beacons.attachments; |
1339 var arg_request = buildBeaconAttachment(); | 1371 var arg_request = buildBeaconAttachment(); |
1340 var arg_beaconName = "foo"; | 1372 var arg_beaconName = "foo"; |
1341 var arg_projectId = "foo"; | 1373 var arg_projectId = "foo"; |
1342 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1374 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1343 var obj = new api.BeaconAttachment.fromJson(json); | 1375 var obj = new api.BeaconAttachment.fromJson(json); |
1344 checkBeaconAttachment(obj); | 1376 checkBeaconAttachment(obj); |
1345 | 1377 |
1346 var path = (req.url).path; | 1378 var path = (req.url).path; |
1347 var pathOffset = 0; | 1379 var pathOffset = 0; |
1348 var index; | 1380 var index; |
1349 var subPart; | 1381 var subPart; |
1350 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1382 unittest.expect( |
| 1383 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1351 pathOffset += 1; | 1384 pathOffset += 1; |
1352 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1385 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1386 unittest.equals("v1beta1/")); |
1353 pathOffset += 8; | 1387 pathOffset += 8; |
1354 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1388 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1355 | 1389 |
1356 var query = (req.url).query; | 1390 var query = (req.url).query; |
1357 var queryOffset = 0; | 1391 var queryOffset = 0; |
1358 var queryMap = {}; | 1392 var queryMap = {}; |
1359 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1393 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1360 parseBool(n) { | 1394 parseBool(n) { |
1361 if (n == "true") return true; | 1395 if (n == "true") return true; |
1362 if (n == "false") return false; | 1396 if (n == "false") return false; |
1363 if (n == null) return null; | 1397 if (n == null) return null; |
1364 throw new core.ArgumentError("Invalid boolean: $n"); | 1398 throw new core.ArgumentError("Invalid boolean: $n"); |
1365 } | 1399 } |
| 1400 |
1366 if (query.length > 0) { | 1401 if (query.length > 0) { |
1367 for (var part in query.split("&")) { | 1402 for (var part in query.split("&")) { |
1368 var keyvalue = part.split("="); | 1403 var keyvalue = part.split("="); |
1369 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1404 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1405 core.Uri.decodeQueryComponent(keyvalue[1])); |
1370 } | 1406 } |
1371 } | 1407 } |
1372 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1408 unittest.expect( |
1373 | 1409 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1374 | 1410 |
1375 var h = { | 1411 var h = { |
1376 "content-type" : "application/json; charset=utf-8", | 1412 "content-type": "application/json; charset=utf-8", |
1377 }; | 1413 }; |
1378 var resp = convert.JSON.encode(buildBeaconAttachment()); | 1414 var resp = convert.JSON.encode(buildBeaconAttachment()); |
1379 return new async.Future.value(stringResponse(200, h, resp)); | 1415 return new async.Future.value(stringResponse(200, h, resp)); |
1380 }), true); | 1416 }), true); |
1381 res.create(arg_request, arg_beaconName, projectId: arg_projectId).then(uni
ttest.expectAsync1(((api.BeaconAttachment response) { | 1417 res |
| 1418 .create(arg_request, arg_beaconName, projectId: arg_projectId) |
| 1419 .then(unittest.expectAsync1(((api.BeaconAttachment response) { |
1382 checkBeaconAttachment(response); | 1420 checkBeaconAttachment(response); |
1383 }))); | 1421 }))); |
1384 }); | 1422 }); |
1385 | 1423 |
1386 unittest.test("method--delete", () { | 1424 unittest.test("method--delete", () { |
1387 | |
1388 var mock = new HttpServerMock(); | 1425 var mock = new HttpServerMock(); |
1389 api.BeaconsAttachmentsResourceApi res = new api.ProximitybeaconApi(mock).b
eacons.attachments; | 1426 api.BeaconsAttachmentsResourceApi res = |
| 1427 new api.ProximitybeaconApi(mock).beacons.attachments; |
1390 var arg_attachmentName = "foo"; | 1428 var arg_attachmentName = "foo"; |
1391 var arg_projectId = "foo"; | 1429 var arg_projectId = "foo"; |
1392 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1430 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1393 var path = (req.url).path; | 1431 var path = (req.url).path; |
1394 var pathOffset = 0; | 1432 var pathOffset = 0; |
1395 var index; | 1433 var index; |
1396 var subPart; | 1434 var subPart; |
1397 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1435 unittest.expect( |
| 1436 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1398 pathOffset += 1; | 1437 pathOffset += 1; |
1399 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1438 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1439 unittest.equals("v1beta1/")); |
1400 pathOffset += 8; | 1440 pathOffset += 8; |
1401 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1441 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1402 | 1442 |
1403 var query = (req.url).query; | 1443 var query = (req.url).query; |
1404 var queryOffset = 0; | 1444 var queryOffset = 0; |
1405 var queryMap = {}; | 1445 var queryMap = {}; |
1406 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1446 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1407 parseBool(n) { | 1447 parseBool(n) { |
1408 if (n == "true") return true; | 1448 if (n == "true") return true; |
1409 if (n == "false") return false; | 1449 if (n == "false") return false; |
1410 if (n == null) return null; | 1450 if (n == null) return null; |
1411 throw new core.ArgumentError("Invalid boolean: $n"); | 1451 throw new core.ArgumentError("Invalid boolean: $n"); |
1412 } | 1452 } |
| 1453 |
1413 if (query.length > 0) { | 1454 if (query.length > 0) { |
1414 for (var part in query.split("&")) { | 1455 for (var part in query.split("&")) { |
1415 var keyvalue = part.split("="); | 1456 var keyvalue = part.split("="); |
1416 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1457 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1458 core.Uri.decodeQueryComponent(keyvalue[1])); |
1417 } | 1459 } |
1418 } | 1460 } |
1419 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1461 unittest.expect( |
1420 | 1462 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1421 | 1463 |
1422 var h = { | 1464 var h = { |
1423 "content-type" : "application/json; charset=utf-8", | 1465 "content-type": "application/json; charset=utf-8", |
1424 }; | 1466 }; |
1425 var resp = convert.JSON.encode(buildEmpty()); | 1467 var resp = convert.JSON.encode(buildEmpty()); |
1426 return new async.Future.value(stringResponse(200, h, resp)); | 1468 return new async.Future.value(stringResponse(200, h, resp)); |
1427 }), true); | 1469 }), true); |
1428 res.delete(arg_attachmentName, projectId: arg_projectId).then(unittest.exp
ectAsync1(((api.Empty response) { | 1470 res |
| 1471 .delete(arg_attachmentName, projectId: arg_projectId) |
| 1472 .then(unittest.expectAsync1(((api.Empty response) { |
1429 checkEmpty(response); | 1473 checkEmpty(response); |
1430 }))); | 1474 }))); |
1431 }); | 1475 }); |
1432 | 1476 |
1433 unittest.test("method--list", () { | 1477 unittest.test("method--list", () { |
1434 | |
1435 var mock = new HttpServerMock(); | 1478 var mock = new HttpServerMock(); |
1436 api.BeaconsAttachmentsResourceApi res = new api.ProximitybeaconApi(mock).b
eacons.attachments; | 1479 api.BeaconsAttachmentsResourceApi res = |
| 1480 new api.ProximitybeaconApi(mock).beacons.attachments; |
1437 var arg_beaconName = "foo"; | 1481 var arg_beaconName = "foo"; |
| 1482 var arg_namespacedType = "foo"; |
1438 var arg_projectId = "foo"; | 1483 var arg_projectId = "foo"; |
1439 var arg_namespacedType = "foo"; | |
1440 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1484 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1441 var path = (req.url).path; | 1485 var path = (req.url).path; |
1442 var pathOffset = 0; | 1486 var pathOffset = 0; |
1443 var index; | 1487 var index; |
1444 var subPart; | 1488 var subPart; |
1445 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1489 unittest.expect( |
| 1490 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1446 pathOffset += 1; | 1491 pathOffset += 1; |
1447 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1492 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1493 unittest.equals("v1beta1/")); |
1448 pathOffset += 8; | 1494 pathOffset += 8; |
1449 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1495 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1450 | 1496 |
1451 var query = (req.url).query; | 1497 var query = (req.url).query; |
1452 var queryOffset = 0; | 1498 var queryOffset = 0; |
1453 var queryMap = {}; | 1499 var queryMap = {}; |
1454 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1500 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1455 parseBool(n) { | 1501 parseBool(n) { |
1456 if (n == "true") return true; | 1502 if (n == "true") return true; |
1457 if (n == "false") return false; | 1503 if (n == "false") return false; |
1458 if (n == null) return null; | 1504 if (n == null) return null; |
1459 throw new core.ArgumentError("Invalid boolean: $n"); | 1505 throw new core.ArgumentError("Invalid boolean: $n"); |
1460 } | 1506 } |
| 1507 |
1461 if (query.length > 0) { | 1508 if (query.length > 0) { |
1462 for (var part in query.split("&")) { | 1509 for (var part in query.split("&")) { |
1463 var keyvalue = part.split("="); | 1510 var keyvalue = part.split("="); |
1464 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1511 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1512 core.Uri.decodeQueryComponent(keyvalue[1])); |
1465 } | 1513 } |
1466 } | 1514 } |
1467 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1515 unittest.expect(queryMap["namespacedType"].first, |
1468 unittest.expect(queryMap["namespacedType"].first, unittest.equals(arg_na
mespacedType)); | 1516 unittest.equals(arg_namespacedType)); |
1469 | 1517 unittest.expect( |
| 1518 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1470 | 1519 |
1471 var h = { | 1520 var h = { |
1472 "content-type" : "application/json; charset=utf-8", | 1521 "content-type": "application/json; charset=utf-8", |
1473 }; | 1522 }; |
1474 var resp = convert.JSON.encode(buildListBeaconAttachmentsResponse()); | 1523 var resp = convert.JSON.encode(buildListBeaconAttachmentsResponse()); |
1475 return new async.Future.value(stringResponse(200, h, resp)); | 1524 return new async.Future.value(stringResponse(200, h, resp)); |
1476 }), true); | 1525 }), true); |
1477 res.list(arg_beaconName, projectId: arg_projectId, namespacedType: arg_nam
espacedType).then(unittest.expectAsync1(((api.ListBeaconAttachmentsResponse resp
onse) { | 1526 res |
| 1527 .list(arg_beaconName, |
| 1528 namespacedType: arg_namespacedType, projectId: arg_projectId) |
| 1529 .then(unittest |
| 1530 .expectAsync1(((api.ListBeaconAttachmentsResponse response) { |
1478 checkListBeaconAttachmentsResponse(response); | 1531 checkListBeaconAttachmentsResponse(response); |
1479 }))); | 1532 }))); |
1480 }); | 1533 }); |
1481 | |
1482 }); | 1534 }); |
1483 | 1535 |
1484 | |
1485 unittest.group("resource-BeaconsDiagnosticsResourceApi", () { | 1536 unittest.group("resource-BeaconsDiagnosticsResourceApi", () { |
1486 unittest.test("method--list", () { | 1537 unittest.test("method--list", () { |
1487 | |
1488 var mock = new HttpServerMock(); | 1538 var mock = new HttpServerMock(); |
1489 api.BeaconsDiagnosticsResourceApi res = new api.ProximitybeaconApi(mock).b
eacons.diagnostics; | 1539 api.BeaconsDiagnosticsResourceApi res = |
| 1540 new api.ProximitybeaconApi(mock).beacons.diagnostics; |
1490 var arg_beaconName = "foo"; | 1541 var arg_beaconName = "foo"; |
| 1542 var arg_pageToken = "foo"; |
1491 var arg_alertFilter = "foo"; | 1543 var arg_alertFilter = "foo"; |
1492 var arg_pageSize = 42; | 1544 var arg_pageSize = 42; |
1493 var arg_projectId = "foo"; | 1545 var arg_projectId = "foo"; |
1494 var arg_pageToken = "foo"; | |
1495 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1546 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1496 var path = (req.url).path; | 1547 var path = (req.url).path; |
1497 var pathOffset = 0; | 1548 var pathOffset = 0; |
1498 var index; | 1549 var index; |
1499 var subPart; | 1550 var subPart; |
1500 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1551 unittest.expect( |
| 1552 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1501 pathOffset += 1; | 1553 pathOffset += 1; |
1502 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1554 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1555 unittest.equals("v1beta1/")); |
1503 pathOffset += 8; | 1556 pathOffset += 8; |
1504 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1557 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1505 | 1558 |
1506 var query = (req.url).query; | 1559 var query = (req.url).query; |
1507 var queryOffset = 0; | 1560 var queryOffset = 0; |
1508 var queryMap = {}; | 1561 var queryMap = {}; |
1509 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1562 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1510 parseBool(n) { | 1563 parseBool(n) { |
1511 if (n == "true") return true; | 1564 if (n == "true") return true; |
1512 if (n == "false") return false; | 1565 if (n == "false") return false; |
1513 if (n == null) return null; | 1566 if (n == null) return null; |
1514 throw new core.ArgumentError("Invalid boolean: $n"); | 1567 throw new core.ArgumentError("Invalid boolean: $n"); |
1515 } | 1568 } |
| 1569 |
1516 if (query.length > 0) { | 1570 if (query.length > 0) { |
1517 for (var part in query.split("&")) { | 1571 for (var part in query.split("&")) { |
1518 var keyvalue = part.split("="); | 1572 var keyvalue = part.split("="); |
1519 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1573 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1574 core.Uri.decodeQueryComponent(keyvalue[1])); |
1520 } | 1575 } |
1521 } | 1576 } |
1522 unittest.expect(queryMap["alertFilter"].first, unittest.equals(arg_alert
Filter)); | 1577 unittest.expect( |
1523 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1578 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1524 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1579 unittest.expect( |
1525 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1580 queryMap["alertFilter"].first, unittest.equals(arg_alertFilter)); |
1526 | 1581 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1582 unittest.equals(arg_pageSize)); |
| 1583 unittest.expect( |
| 1584 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1527 | 1585 |
1528 var h = { | 1586 var h = { |
1529 "content-type" : "application/json; charset=utf-8", | 1587 "content-type": "application/json; charset=utf-8", |
1530 }; | 1588 }; |
1531 var resp = convert.JSON.encode(buildListDiagnosticsResponse()); | 1589 var resp = convert.JSON.encode(buildListDiagnosticsResponse()); |
1532 return new async.Future.value(stringResponse(200, h, resp)); | 1590 return new async.Future.value(stringResponse(200, h, resp)); |
1533 }), true); | 1591 }), true); |
1534 res.list(arg_beaconName, alertFilter: arg_alertFilter, pageSize: arg_pageS
ize, projectId: arg_projectId, pageToken: arg_pageToken).then(unittest.expectAsy
nc1(((api.ListDiagnosticsResponse response) { | 1592 res |
| 1593 .list(arg_beaconName, |
| 1594 pageToken: arg_pageToken, |
| 1595 alertFilter: arg_alertFilter, |
| 1596 pageSize: arg_pageSize, |
| 1597 projectId: arg_projectId) |
| 1598 .then(unittest.expectAsync1(((api.ListDiagnosticsResponse response) { |
1535 checkListDiagnosticsResponse(response); | 1599 checkListDiagnosticsResponse(response); |
1536 }))); | 1600 }))); |
1537 }); | 1601 }); |
1538 | |
1539 }); | 1602 }); |
1540 | 1603 |
1541 | |
1542 unittest.group("resource-NamespacesResourceApi", () { | 1604 unittest.group("resource-NamespacesResourceApi", () { |
1543 unittest.test("method--list", () { | 1605 unittest.test("method--list", () { |
1544 | |
1545 var mock = new HttpServerMock(); | 1606 var mock = new HttpServerMock(); |
1546 api.NamespacesResourceApi res = new api.ProximitybeaconApi(mock).namespace
s; | 1607 api.NamespacesResourceApi res = |
| 1608 new api.ProximitybeaconApi(mock).namespaces; |
1547 var arg_projectId = "foo"; | 1609 var arg_projectId = "foo"; |
1548 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1610 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1549 var path = (req.url).path; | 1611 var path = (req.url).path; |
1550 var pathOffset = 0; | 1612 var pathOffset = 0; |
1551 var index; | 1613 var index; |
1552 var subPart; | 1614 var subPart; |
1553 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1615 unittest.expect( |
| 1616 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1554 pathOffset += 1; | 1617 pathOffset += 1; |
1555 unittest.expect(path.substring(pathOffset, pathOffset + 18), unittest.eq
uals("v1beta1/namespaces")); | 1618 unittest.expect(path.substring(pathOffset, pathOffset + 18), |
| 1619 unittest.equals("v1beta1/namespaces")); |
1556 pathOffset += 18; | 1620 pathOffset += 18; |
1557 | 1621 |
1558 var query = (req.url).query; | 1622 var query = (req.url).query; |
1559 var queryOffset = 0; | 1623 var queryOffset = 0; |
1560 var queryMap = {}; | 1624 var queryMap = {}; |
1561 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1625 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1562 parseBool(n) { | 1626 parseBool(n) { |
1563 if (n == "true") return true; | 1627 if (n == "true") return true; |
1564 if (n == "false") return false; | 1628 if (n == "false") return false; |
1565 if (n == null) return null; | 1629 if (n == null) return null; |
1566 throw new core.ArgumentError("Invalid boolean: $n"); | 1630 throw new core.ArgumentError("Invalid boolean: $n"); |
1567 } | 1631 } |
| 1632 |
1568 if (query.length > 0) { | 1633 if (query.length > 0) { |
1569 for (var part in query.split("&")) { | 1634 for (var part in query.split("&")) { |
1570 var keyvalue = part.split("="); | 1635 var keyvalue = part.split("="); |
1571 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1636 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1637 core.Uri.decodeQueryComponent(keyvalue[1])); |
1572 } | 1638 } |
1573 } | 1639 } |
1574 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1640 unittest.expect( |
1575 | 1641 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1576 | 1642 |
1577 var h = { | 1643 var h = { |
1578 "content-type" : "application/json; charset=utf-8", | 1644 "content-type": "application/json; charset=utf-8", |
1579 }; | 1645 }; |
1580 var resp = convert.JSON.encode(buildListNamespacesResponse()); | 1646 var resp = convert.JSON.encode(buildListNamespacesResponse()); |
1581 return new async.Future.value(stringResponse(200, h, resp)); | 1647 return new async.Future.value(stringResponse(200, h, resp)); |
1582 }), true); | 1648 }), true); |
1583 res.list(projectId: arg_projectId).then(unittest.expectAsync1(((api.ListNa
mespacesResponse response) { | 1649 res |
| 1650 .list(projectId: arg_projectId) |
| 1651 .then(unittest.expectAsync1(((api.ListNamespacesResponse response) { |
1584 checkListNamespacesResponse(response); | 1652 checkListNamespacesResponse(response); |
1585 }))); | 1653 }))); |
1586 }); | 1654 }); |
1587 | 1655 |
1588 unittest.test("method--update", () { | 1656 unittest.test("method--update", () { |
1589 | |
1590 var mock = new HttpServerMock(); | 1657 var mock = new HttpServerMock(); |
1591 api.NamespacesResourceApi res = new api.ProximitybeaconApi(mock).namespace
s; | 1658 api.NamespacesResourceApi res = |
| 1659 new api.ProximitybeaconApi(mock).namespaces; |
1592 var arg_request = buildNamespace(); | 1660 var arg_request = buildNamespace(); |
1593 var arg_namespaceName = "foo"; | 1661 var arg_namespaceName = "foo"; |
1594 var arg_projectId = "foo"; | 1662 var arg_projectId = "foo"; |
1595 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1663 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1596 var obj = new api.Namespace.fromJson(json); | 1664 var obj = new api.Namespace.fromJson(json); |
1597 checkNamespace(obj); | 1665 checkNamespace(obj); |
1598 | 1666 |
1599 var path = (req.url).path; | 1667 var path = (req.url).path; |
1600 var pathOffset = 0; | 1668 var pathOffset = 0; |
1601 var index; | 1669 var index; |
1602 var subPart; | 1670 var subPart; |
1603 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1671 unittest.expect( |
| 1672 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1604 pathOffset += 1; | 1673 pathOffset += 1; |
1605 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1674 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1675 unittest.equals("v1beta1/")); |
1606 pathOffset += 8; | 1676 pathOffset += 8; |
1607 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1677 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1608 | 1678 |
1609 var query = (req.url).query; | 1679 var query = (req.url).query; |
1610 var queryOffset = 0; | 1680 var queryOffset = 0; |
1611 var queryMap = {}; | 1681 var queryMap = {}; |
1612 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1682 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1613 parseBool(n) { | 1683 parseBool(n) { |
1614 if (n == "true") return true; | 1684 if (n == "true") return true; |
1615 if (n == "false") return false; | 1685 if (n == "false") return false; |
1616 if (n == null) return null; | 1686 if (n == null) return null; |
1617 throw new core.ArgumentError("Invalid boolean: $n"); | 1687 throw new core.ArgumentError("Invalid boolean: $n"); |
1618 } | 1688 } |
| 1689 |
1619 if (query.length > 0) { | 1690 if (query.length > 0) { |
1620 for (var part in query.split("&")) { | 1691 for (var part in query.split("&")) { |
1621 var keyvalue = part.split("="); | 1692 var keyvalue = part.split("="); |
1622 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1693 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1694 core.Uri.decodeQueryComponent(keyvalue[1])); |
1623 } | 1695 } |
1624 } | 1696 } |
1625 unittest.expect(queryMap["projectId"].first, unittest.equals(arg_project
Id)); | 1697 unittest.expect( |
1626 | 1698 queryMap["projectId"].first, unittest.equals(arg_projectId)); |
1627 | 1699 |
1628 var h = { | 1700 var h = { |
1629 "content-type" : "application/json; charset=utf-8", | 1701 "content-type": "application/json; charset=utf-8", |
1630 }; | 1702 }; |
1631 var resp = convert.JSON.encode(buildNamespace()); | 1703 var resp = convert.JSON.encode(buildNamespace()); |
1632 return new async.Future.value(stringResponse(200, h, resp)); | 1704 return new async.Future.value(stringResponse(200, h, resp)); |
1633 }), true); | 1705 }), true); |
1634 res.update(arg_request, arg_namespaceName, projectId: arg_projectId).then(
unittest.expectAsync1(((api.Namespace response) { | 1706 res |
| 1707 .update(arg_request, arg_namespaceName, projectId: arg_projectId) |
| 1708 .then(unittest.expectAsync1(((api.Namespace response) { |
1635 checkNamespace(response); | 1709 checkNamespace(response); |
1636 }))); | 1710 }))); |
1637 }); | 1711 }); |
1638 | |
1639 }); | 1712 }); |
1640 | 1713 |
1641 | |
1642 unittest.group("resource-V1beta1ResourceApi", () { | 1714 unittest.group("resource-V1beta1ResourceApi", () { |
1643 unittest.test("method--getEidparams", () { | 1715 unittest.test("method--getEidparams", () { |
1644 | |
1645 var mock = new HttpServerMock(); | 1716 var mock = new HttpServerMock(); |
1646 api.V1beta1ResourceApi res = new api.ProximitybeaconApi(mock).v1beta1; | 1717 api.V1beta1ResourceApi res = new api.ProximitybeaconApi(mock).v1beta1; |
1647 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1718 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1648 var path = (req.url).path; | 1719 var path = (req.url).path; |
1649 var pathOffset = 0; | 1720 var pathOffset = 0; |
1650 var index; | 1721 var index; |
1651 var subPart; | 1722 var subPart; |
1652 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1723 unittest.expect( |
| 1724 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1653 pathOffset += 1; | 1725 pathOffset += 1; |
1654 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/eidparams")); | 1726 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1727 unittest.equals("v1beta1/eidparams")); |
1655 pathOffset += 17; | 1728 pathOffset += 17; |
1656 | 1729 |
1657 var query = (req.url).query; | 1730 var query = (req.url).query; |
1658 var queryOffset = 0; | 1731 var queryOffset = 0; |
1659 var queryMap = {}; | 1732 var queryMap = {}; |
1660 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1733 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1661 parseBool(n) { | 1734 parseBool(n) { |
1662 if (n == "true") return true; | 1735 if (n == "true") return true; |
1663 if (n == "false") return false; | 1736 if (n == "false") return false; |
1664 if (n == null) return null; | 1737 if (n == null) return null; |
1665 throw new core.ArgumentError("Invalid boolean: $n"); | 1738 throw new core.ArgumentError("Invalid boolean: $n"); |
1666 } | 1739 } |
| 1740 |
1667 if (query.length > 0) { | 1741 if (query.length > 0) { |
1668 for (var part in query.split("&")) { | 1742 for (var part in query.split("&")) { |
1669 var keyvalue = part.split("="); | 1743 var keyvalue = part.split("="); |
1670 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1744 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1745 core.Uri.decodeQueryComponent(keyvalue[1])); |
1671 } | 1746 } |
1672 } | 1747 } |
1673 | 1748 |
1674 | |
1675 var h = { | 1749 var h = { |
1676 "content-type" : "application/json; charset=utf-8", | 1750 "content-type": "application/json; charset=utf-8", |
1677 }; | 1751 }; |
1678 var resp = convert.JSON.encode(buildEphemeralIdRegistrationParams()); | 1752 var resp = convert.JSON.encode(buildEphemeralIdRegistrationParams()); |
1679 return new async.Future.value(stringResponse(200, h, resp)); | 1753 return new async.Future.value(stringResponse(200, h, resp)); |
1680 }), true); | 1754 }), true); |
1681 res.getEidparams().then(unittest.expectAsync1(((api.EphemeralIdRegistratio
nParams response) { | 1755 res.getEidparams().then( |
| 1756 unittest.expectAsync1(((api.EphemeralIdRegistrationParams response) { |
1682 checkEphemeralIdRegistrationParams(response); | 1757 checkEphemeralIdRegistrationParams(response); |
1683 }))); | 1758 }))); |
1684 }); | 1759 }); |
1685 | |
1686 }); | 1760 }); |
1687 | |
1688 | |
1689 } | 1761 } |
1690 | |
OLD | NEW |