| OLD | NEW |
| 1 library googleapis.androiddeviceprovisioning.v1.test; | 1 library googleapis.androiddeviceprovisioning.v1.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/androiddeviceprovisioning/v1.dart' as api; | 10 import 'package:googleapis/androiddeviceprovisioning/v1.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 buildCounterClaimDeviceRequest = 0; | 53 core.int buildCounterClaimDeviceRequest = 0; |
| 55 buildClaimDeviceRequest() { | 54 buildClaimDeviceRequest() { |
| 56 var o = new api.ClaimDeviceRequest(); | 55 var o = new api.ClaimDeviceRequest(); |
| 57 buildCounterClaimDeviceRequest++; | 56 buildCounterClaimDeviceRequest++; |
| 58 if (buildCounterClaimDeviceRequest < 3) { | 57 if (buildCounterClaimDeviceRequest < 3) { |
| 59 o.customerId = "foo"; | 58 o.customerId = "foo"; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 88 | 87 |
| 89 checkClaimDeviceResponse(api.ClaimDeviceResponse o) { | 88 checkClaimDeviceResponse(api.ClaimDeviceResponse o) { |
| 90 buildCounterClaimDeviceResponse++; | 89 buildCounterClaimDeviceResponse++; |
| 91 if (buildCounterClaimDeviceResponse < 3) { | 90 if (buildCounterClaimDeviceResponse < 3) { |
| 92 unittest.expect(o.deviceId, unittest.equals('foo')); | 91 unittest.expect(o.deviceId, unittest.equals('foo')); |
| 93 unittest.expect(o.deviceName, unittest.equals('foo')); | 92 unittest.expect(o.deviceName, unittest.equals('foo')); |
| 94 } | 93 } |
| 95 buildCounterClaimDeviceResponse--; | 94 buildCounterClaimDeviceResponse--; |
| 96 } | 95 } |
| 97 | 96 |
| 98 buildUnnamed54() { | 97 buildUnnamed47() { |
| 99 var o = new core.List<api.PartnerClaim>(); | 98 var o = new core.List<api.PartnerClaim>(); |
| 100 o.add(buildPartnerClaim()); | 99 o.add(buildPartnerClaim()); |
| 101 o.add(buildPartnerClaim()); | 100 o.add(buildPartnerClaim()); |
| 102 return o; | 101 return o; |
| 103 } | 102 } |
| 104 | 103 |
| 105 checkUnnamed54(core.List<api.PartnerClaim> o) { | 104 checkUnnamed47(core.List<api.PartnerClaim> o) { |
| 106 unittest.expect(o, unittest.hasLength(2)); | 105 unittest.expect(o, unittest.hasLength(2)); |
| 107 checkPartnerClaim(o[0]); | 106 checkPartnerClaim(o[0]); |
| 108 checkPartnerClaim(o[1]); | 107 checkPartnerClaim(o[1]); |
| 109 } | 108 } |
| 110 | 109 |
| 111 core.int buildCounterClaimDevicesRequest = 0; | 110 core.int buildCounterClaimDevicesRequest = 0; |
| 112 buildClaimDevicesRequest() { | 111 buildClaimDevicesRequest() { |
| 113 var o = new api.ClaimDevicesRequest(); | 112 var o = new api.ClaimDevicesRequest(); |
| 114 buildCounterClaimDevicesRequest++; | 113 buildCounterClaimDevicesRequest++; |
| 115 if (buildCounterClaimDevicesRequest < 3) { | 114 if (buildCounterClaimDevicesRequest < 3) { |
| 116 o.claims = buildUnnamed54(); | 115 o.claims = buildUnnamed47(); |
| 117 } | 116 } |
| 118 buildCounterClaimDevicesRequest--; | 117 buildCounterClaimDevicesRequest--; |
| 119 return o; | 118 return o; |
| 120 } | 119 } |
| 121 | 120 |
| 122 checkClaimDevicesRequest(api.ClaimDevicesRequest o) { | 121 checkClaimDevicesRequest(api.ClaimDevicesRequest o) { |
| 123 buildCounterClaimDevicesRequest++; | 122 buildCounterClaimDevicesRequest++; |
| 124 if (buildCounterClaimDevicesRequest < 3) { | 123 if (buildCounterClaimDevicesRequest < 3) { |
| 125 checkUnnamed54(o.claims); | 124 checkUnnamed47(o.claims); |
| 126 } | 125 } |
| 127 buildCounterClaimDevicesRequest--; | 126 buildCounterClaimDevicesRequest--; |
| 128 } | 127 } |
| 129 | 128 |
| 129 buildUnnamed48() { |
| 130 var o = new core.List<core.String>(); |
| 131 o.add("foo"); |
| 132 o.add("foo"); |
| 133 return o; |
| 134 } |
| 135 |
| 136 checkUnnamed48(core.List<core.String> o) { |
| 137 unittest.expect(o, unittest.hasLength(2)); |
| 138 unittest.expect(o[0], unittest.equals('foo')); |
| 139 unittest.expect(o[1], unittest.equals('foo')); |
| 140 } |
| 141 |
| 142 buildUnnamed49() { |
| 143 var o = new core.List<core.String>(); |
| 144 o.add("foo"); |
| 145 o.add("foo"); |
| 146 return o; |
| 147 } |
| 148 |
| 149 checkUnnamed49(core.List<core.String> o) { |
| 150 unittest.expect(o, unittest.hasLength(2)); |
| 151 unittest.expect(o[0], unittest.equals('foo')); |
| 152 unittest.expect(o[1], unittest.equals('foo')); |
| 153 } |
| 154 |
| 130 core.int buildCounterCompany = 0; | 155 core.int buildCounterCompany = 0; |
| 131 buildCompany() { | 156 buildCompany() { |
| 132 var o = new api.Company(); | 157 var o = new api.Company(); |
| 133 buildCounterCompany++; | 158 buildCounterCompany++; |
| 134 if (buildCounterCompany < 3) { | 159 if (buildCounterCompany < 3) { |
| 160 o.adminEmails = buildUnnamed48(); |
| 135 o.companyId = "foo"; | 161 o.companyId = "foo"; |
| 136 o.companyName = "foo"; | 162 o.companyName = "foo"; |
| 163 o.name = "foo"; |
| 164 o.ownerEmails = buildUnnamed49(); |
| 137 } | 165 } |
| 138 buildCounterCompany--; | 166 buildCounterCompany--; |
| 139 return o; | 167 return o; |
| 140 } | 168 } |
| 141 | 169 |
| 142 checkCompany(api.Company o) { | 170 checkCompany(api.Company o) { |
| 143 buildCounterCompany++; | 171 buildCounterCompany++; |
| 144 if (buildCounterCompany < 3) { | 172 if (buildCounterCompany < 3) { |
| 173 checkUnnamed48(o.adminEmails); |
| 145 unittest.expect(o.companyId, unittest.equals('foo')); | 174 unittest.expect(o.companyId, unittest.equals('foo')); |
| 146 unittest.expect(o.companyName, unittest.equals('foo')); | 175 unittest.expect(o.companyName, unittest.equals('foo')); |
| 176 unittest.expect(o.name, unittest.equals('foo')); |
| 177 checkUnnamed49(o.ownerEmails); |
| 147 } | 178 } |
| 148 buildCounterCompany--; | 179 buildCounterCompany--; |
| 149 } | 180 } |
| 150 | 181 |
| 151 buildUnnamed55() { | 182 core.int buildCounterCreateCustomerRequest = 0; |
| 183 buildCreateCustomerRequest() { |
| 184 var o = new api.CreateCustomerRequest(); |
| 185 buildCounterCreateCustomerRequest++; |
| 186 if (buildCounterCreateCustomerRequest < 3) { |
| 187 o.customer = buildCompany(); |
| 188 } |
| 189 buildCounterCreateCustomerRequest--; |
| 190 return o; |
| 191 } |
| 192 |
| 193 checkCreateCustomerRequest(api.CreateCustomerRequest o) { |
| 194 buildCounterCreateCustomerRequest++; |
| 195 if (buildCounterCreateCustomerRequest < 3) { |
| 196 checkCompany(o.customer); |
| 197 } |
| 198 buildCounterCreateCustomerRequest--; |
| 199 } |
| 200 |
| 201 buildUnnamed50() { |
| 152 var o = new core.List<api.DeviceClaim>(); | 202 var o = new core.List<api.DeviceClaim>(); |
| 153 o.add(buildDeviceClaim()); | 203 o.add(buildDeviceClaim()); |
| 154 o.add(buildDeviceClaim()); | 204 o.add(buildDeviceClaim()); |
| 155 return o; | 205 return o; |
| 156 } | 206 } |
| 157 | 207 |
| 158 checkUnnamed55(core.List<api.DeviceClaim> o) { | 208 checkUnnamed50(core.List<api.DeviceClaim> o) { |
| 159 unittest.expect(o, unittest.hasLength(2)); | 209 unittest.expect(o, unittest.hasLength(2)); |
| 160 checkDeviceClaim(o[0]); | 210 checkDeviceClaim(o[0]); |
| 161 checkDeviceClaim(o[1]); | 211 checkDeviceClaim(o[1]); |
| 162 } | 212 } |
| 163 | 213 |
| 164 core.int buildCounterDevice = 0; | 214 core.int buildCounterDevice = 0; |
| 165 buildDevice() { | 215 buildDevice() { |
| 166 var o = new api.Device(); | 216 var o = new api.Device(); |
| 167 buildCounterDevice++; | 217 buildCounterDevice++; |
| 168 if (buildCounterDevice < 3) { | 218 if (buildCounterDevice < 3) { |
| 169 o.claims = buildUnnamed55(); | 219 o.claims = buildUnnamed50(); |
| 220 o.configuration = "foo"; |
| 170 o.deviceId = "foo"; | 221 o.deviceId = "foo"; |
| 171 o.deviceIdentifier = buildDeviceIdentifier(); | 222 o.deviceIdentifier = buildDeviceIdentifier(); |
| 172 o.deviceMetadata = buildDeviceMetadata(); | 223 o.deviceMetadata = buildDeviceMetadata(); |
| 173 o.name = "foo"; | 224 o.name = "foo"; |
| 174 } | 225 } |
| 175 buildCounterDevice--; | 226 buildCounterDevice--; |
| 176 return o; | 227 return o; |
| 177 } | 228 } |
| 178 | 229 |
| 179 checkDevice(api.Device o) { | 230 checkDevice(api.Device o) { |
| 180 buildCounterDevice++; | 231 buildCounterDevice++; |
| 181 if (buildCounterDevice < 3) { | 232 if (buildCounterDevice < 3) { |
| 182 checkUnnamed55(o.claims); | 233 checkUnnamed50(o.claims); |
| 234 unittest.expect(o.configuration, unittest.equals('foo')); |
| 183 unittest.expect(o.deviceId, unittest.equals('foo')); | 235 unittest.expect(o.deviceId, unittest.equals('foo')); |
| 184 checkDeviceIdentifier(o.deviceIdentifier); | 236 checkDeviceIdentifier(o.deviceIdentifier); |
| 185 checkDeviceMetadata(o.deviceMetadata); | 237 checkDeviceMetadata(o.deviceMetadata); |
| 186 unittest.expect(o.name, unittest.equals('foo')); | 238 unittest.expect(o.name, unittest.equals('foo')); |
| 187 } | 239 } |
| 188 buildCounterDevice--; | 240 buildCounterDevice--; |
| 189 } | 241 } |
| 190 | 242 |
| 191 core.int buildCounterDeviceClaim = 0; | 243 core.int buildCounterDeviceClaim = 0; |
| 192 buildDeviceClaim() { | 244 buildDeviceClaim() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 buildCounterDeviceIdentifier++; | 279 buildCounterDeviceIdentifier++; |
| 228 if (buildCounterDeviceIdentifier < 3) { | 280 if (buildCounterDeviceIdentifier < 3) { |
| 229 unittest.expect(o.imei, unittest.equals('foo')); | 281 unittest.expect(o.imei, unittest.equals('foo')); |
| 230 unittest.expect(o.manufacturer, unittest.equals('foo')); | 282 unittest.expect(o.manufacturer, unittest.equals('foo')); |
| 231 unittest.expect(o.meid, unittest.equals('foo')); | 283 unittest.expect(o.meid, unittest.equals('foo')); |
| 232 unittest.expect(o.serialNumber, unittest.equals('foo')); | 284 unittest.expect(o.serialNumber, unittest.equals('foo')); |
| 233 } | 285 } |
| 234 buildCounterDeviceIdentifier--; | 286 buildCounterDeviceIdentifier--; |
| 235 } | 287 } |
| 236 | 288 |
| 237 buildUnnamed56() { | 289 buildUnnamed51() { |
| 238 var o = new core.Map<core.String, core.String>(); | 290 var o = new core.Map<core.String, core.String>(); |
| 239 o["x"] = "foo"; | 291 o["x"] = "foo"; |
| 240 o["y"] = "foo"; | 292 o["y"] = "foo"; |
| 241 return o; | 293 return o; |
| 242 } | 294 } |
| 243 | 295 |
| 244 checkUnnamed56(core.Map<core.String, core.String> o) { | 296 checkUnnamed51(core.Map<core.String, core.String> o) { |
| 245 unittest.expect(o, unittest.hasLength(2)); | 297 unittest.expect(o, unittest.hasLength(2)); |
| 246 unittest.expect(o["x"], unittest.equals('foo')); | 298 unittest.expect(o["x"], unittest.equals('foo')); |
| 247 unittest.expect(o["y"], unittest.equals('foo')); | 299 unittest.expect(o["y"], unittest.equals('foo')); |
| 248 } | 300 } |
| 249 | 301 |
| 250 core.int buildCounterDeviceMetadata = 0; | 302 core.int buildCounterDeviceMetadata = 0; |
| 251 buildDeviceMetadata() { | 303 buildDeviceMetadata() { |
| 252 var o = new api.DeviceMetadata(); | 304 var o = new api.DeviceMetadata(); |
| 253 buildCounterDeviceMetadata++; | 305 buildCounterDeviceMetadata++; |
| 254 if (buildCounterDeviceMetadata < 3) { | 306 if (buildCounterDeviceMetadata < 3) { |
| 255 o.entries = buildUnnamed56(); | 307 o.entries = buildUnnamed51(); |
| 256 } | 308 } |
| 257 buildCounterDeviceMetadata--; | 309 buildCounterDeviceMetadata--; |
| 258 return o; | 310 return o; |
| 259 } | 311 } |
| 260 | 312 |
| 261 checkDeviceMetadata(api.DeviceMetadata o) { | 313 checkDeviceMetadata(api.DeviceMetadata o) { |
| 262 buildCounterDeviceMetadata++; | 314 buildCounterDeviceMetadata++; |
| 263 if (buildCounterDeviceMetadata < 3) { | 315 if (buildCounterDeviceMetadata < 3) { |
| 264 checkUnnamed56(o.entries); | 316 checkUnnamed51(o.entries); |
| 265 } | 317 } |
| 266 buildCounterDeviceMetadata--; | 318 buildCounterDeviceMetadata--; |
| 267 } | 319 } |
| 268 | 320 |
| 269 core.int buildCounterDevicesLongRunningOperationMetadata = 0; | 321 core.int buildCounterDevicesLongRunningOperationMetadata = 0; |
| 270 buildDevicesLongRunningOperationMetadata() { | 322 buildDevicesLongRunningOperationMetadata() { |
| 271 var o = new api.DevicesLongRunningOperationMetadata(); | 323 var o = new api.DevicesLongRunningOperationMetadata(); |
| 272 buildCounterDevicesLongRunningOperationMetadata++; | 324 buildCounterDevicesLongRunningOperationMetadata++; |
| 273 if (buildCounterDevicesLongRunningOperationMetadata < 3) { | 325 if (buildCounterDevicesLongRunningOperationMetadata < 3) { |
| 274 o.devicesCount = 42; | 326 o.devicesCount = 42; |
| 275 o.processingStatus = "foo"; | 327 o.processingStatus = "foo"; |
| 276 o.progress = 42; | 328 o.progress = 42; |
| 277 } | 329 } |
| 278 buildCounterDevicesLongRunningOperationMetadata--; | 330 buildCounterDevicesLongRunningOperationMetadata--; |
| 279 return o; | 331 return o; |
| 280 } | 332 } |
| 281 | 333 |
| 282 checkDevicesLongRunningOperationMetadata(api.DevicesLongRunningOperationMetadata
o) { | 334 checkDevicesLongRunningOperationMetadata( |
| 335 api.DevicesLongRunningOperationMetadata o) { |
| 283 buildCounterDevicesLongRunningOperationMetadata++; | 336 buildCounterDevicesLongRunningOperationMetadata++; |
| 284 if (buildCounterDevicesLongRunningOperationMetadata < 3) { | 337 if (buildCounterDevicesLongRunningOperationMetadata < 3) { |
| 285 unittest.expect(o.devicesCount, unittest.equals(42)); | 338 unittest.expect(o.devicesCount, unittest.equals(42)); |
| 286 unittest.expect(o.processingStatus, unittest.equals('foo')); | 339 unittest.expect(o.processingStatus, unittest.equals('foo')); |
| 287 unittest.expect(o.progress, unittest.equals(42)); | 340 unittest.expect(o.progress, unittest.equals(42)); |
| 288 } | 341 } |
| 289 buildCounterDevicesLongRunningOperationMetadata--; | 342 buildCounterDevicesLongRunningOperationMetadata--; |
| 290 } | 343 } |
| 291 | 344 |
| 292 buildUnnamed57() { | 345 buildUnnamed52() { |
| 293 var o = new core.List<api.OperationPerDevice>(); | 346 var o = new core.List<api.OperationPerDevice>(); |
| 294 o.add(buildOperationPerDevice()); | 347 o.add(buildOperationPerDevice()); |
| 295 o.add(buildOperationPerDevice()); | 348 o.add(buildOperationPerDevice()); |
| 296 return o; | 349 return o; |
| 297 } | 350 } |
| 298 | 351 |
| 299 checkUnnamed57(core.List<api.OperationPerDevice> o) { | 352 checkUnnamed52(core.List<api.OperationPerDevice> o) { |
| 300 unittest.expect(o, unittest.hasLength(2)); | 353 unittest.expect(o, unittest.hasLength(2)); |
| 301 checkOperationPerDevice(o[0]); | 354 checkOperationPerDevice(o[0]); |
| 302 checkOperationPerDevice(o[1]); | 355 checkOperationPerDevice(o[1]); |
| 303 } | 356 } |
| 304 | 357 |
| 305 core.int buildCounterDevicesLongRunningOperationResponse = 0; | 358 core.int buildCounterDevicesLongRunningOperationResponse = 0; |
| 306 buildDevicesLongRunningOperationResponse() { | 359 buildDevicesLongRunningOperationResponse() { |
| 307 var o = new api.DevicesLongRunningOperationResponse(); | 360 var o = new api.DevicesLongRunningOperationResponse(); |
| 308 buildCounterDevicesLongRunningOperationResponse++; | 361 buildCounterDevicesLongRunningOperationResponse++; |
| 309 if (buildCounterDevicesLongRunningOperationResponse < 3) { | 362 if (buildCounterDevicesLongRunningOperationResponse < 3) { |
| 310 o.perDeviceStatus = buildUnnamed57(); | 363 o.perDeviceStatus = buildUnnamed52(); |
| 311 o.successCount = 42; | 364 o.successCount = 42; |
| 312 } | 365 } |
| 313 buildCounterDevicesLongRunningOperationResponse--; | 366 buildCounterDevicesLongRunningOperationResponse--; |
| 314 return o; | 367 return o; |
| 315 } | 368 } |
| 316 | 369 |
| 317 checkDevicesLongRunningOperationResponse(api.DevicesLongRunningOperationResponse
o) { | 370 checkDevicesLongRunningOperationResponse( |
| 371 api.DevicesLongRunningOperationResponse o) { |
| 318 buildCounterDevicesLongRunningOperationResponse++; | 372 buildCounterDevicesLongRunningOperationResponse++; |
| 319 if (buildCounterDevicesLongRunningOperationResponse < 3) { | 373 if (buildCounterDevicesLongRunningOperationResponse < 3) { |
| 320 checkUnnamed57(o.perDeviceStatus); | 374 checkUnnamed52(o.perDeviceStatus); |
| 321 unittest.expect(o.successCount, unittest.equals(42)); | 375 unittest.expect(o.successCount, unittest.equals(42)); |
| 322 } | 376 } |
| 323 buildCounterDevicesLongRunningOperationResponse--; | 377 buildCounterDevicesLongRunningOperationResponse--; |
| 324 } | 378 } |
| 325 | 379 |
| 326 core.int buildCounterEmpty = 0; | 380 core.int buildCounterEmpty = 0; |
| 327 buildEmpty() { | 381 buildEmpty() { |
| 328 var o = new api.Empty(); | 382 var o = new api.Empty(); |
| 329 buildCounterEmpty++; | 383 buildCounterEmpty++; |
| 330 if (buildCounterEmpty < 3) { | 384 if (buildCounterEmpty < 3) {} |
| 331 } | |
| 332 buildCounterEmpty--; | 385 buildCounterEmpty--; |
| 333 return o; | 386 return o; |
| 334 } | 387 } |
| 335 | 388 |
| 336 checkEmpty(api.Empty o) { | 389 checkEmpty(api.Empty o) { |
| 337 buildCounterEmpty++; | 390 buildCounterEmpty++; |
| 338 if (buildCounterEmpty < 3) { | 391 if (buildCounterEmpty < 3) {} |
| 339 } | |
| 340 buildCounterEmpty--; | 392 buildCounterEmpty--; |
| 341 } | 393 } |
| 342 | 394 |
| 343 core.int buildCounterFindDevicesByDeviceIdentifierRequest = 0; | 395 core.int buildCounterFindDevicesByDeviceIdentifierRequest = 0; |
| 344 buildFindDevicesByDeviceIdentifierRequest() { | 396 buildFindDevicesByDeviceIdentifierRequest() { |
| 345 var o = new api.FindDevicesByDeviceIdentifierRequest(); | 397 var o = new api.FindDevicesByDeviceIdentifierRequest(); |
| 346 buildCounterFindDevicesByDeviceIdentifierRequest++; | 398 buildCounterFindDevicesByDeviceIdentifierRequest++; |
| 347 if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) { | 399 if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) { |
| 348 o.deviceIdentifier = buildDeviceIdentifier(); | 400 o.deviceIdentifier = buildDeviceIdentifier(); |
| 349 o.limit = "foo"; | 401 o.limit = "foo"; |
| 350 o.pageToken = "foo"; | 402 o.pageToken = "foo"; |
| 351 } | 403 } |
| 352 buildCounterFindDevicesByDeviceIdentifierRequest--; | 404 buildCounterFindDevicesByDeviceIdentifierRequest--; |
| 353 return o; | 405 return o; |
| 354 } | 406 } |
| 355 | 407 |
| 356 checkFindDevicesByDeviceIdentifierRequest(api.FindDevicesByDeviceIdentifierReque
st o) { | 408 checkFindDevicesByDeviceIdentifierRequest( |
| 409 api.FindDevicesByDeviceIdentifierRequest o) { |
| 357 buildCounterFindDevicesByDeviceIdentifierRequest++; | 410 buildCounterFindDevicesByDeviceIdentifierRequest++; |
| 358 if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) { | 411 if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) { |
| 359 checkDeviceIdentifier(o.deviceIdentifier); | 412 checkDeviceIdentifier(o.deviceIdentifier); |
| 360 unittest.expect(o.limit, unittest.equals('foo')); | 413 unittest.expect(o.limit, unittest.equals('foo')); |
| 361 unittest.expect(o.pageToken, unittest.equals('foo')); | 414 unittest.expect(o.pageToken, unittest.equals('foo')); |
| 362 } | 415 } |
| 363 buildCounterFindDevicesByDeviceIdentifierRequest--; | 416 buildCounterFindDevicesByDeviceIdentifierRequest--; |
| 364 } | 417 } |
| 365 | 418 |
| 366 buildUnnamed58() { | 419 buildUnnamed53() { |
| 367 var o = new core.List<api.Device>(); | 420 var o = new core.List<api.Device>(); |
| 368 o.add(buildDevice()); | 421 o.add(buildDevice()); |
| 369 o.add(buildDevice()); | 422 o.add(buildDevice()); |
| 370 return o; | 423 return o; |
| 371 } | 424 } |
| 372 | 425 |
| 373 checkUnnamed58(core.List<api.Device> o) { | 426 checkUnnamed53(core.List<api.Device> o) { |
| 374 unittest.expect(o, unittest.hasLength(2)); | 427 unittest.expect(o, unittest.hasLength(2)); |
| 375 checkDevice(o[0]); | 428 checkDevice(o[0]); |
| 376 checkDevice(o[1]); | 429 checkDevice(o[1]); |
| 377 } | 430 } |
| 378 | 431 |
| 379 core.int buildCounterFindDevicesByDeviceIdentifierResponse = 0; | 432 core.int buildCounterFindDevicesByDeviceIdentifierResponse = 0; |
| 380 buildFindDevicesByDeviceIdentifierResponse() { | 433 buildFindDevicesByDeviceIdentifierResponse() { |
| 381 var o = new api.FindDevicesByDeviceIdentifierResponse(); | 434 var o = new api.FindDevicesByDeviceIdentifierResponse(); |
| 382 buildCounterFindDevicesByDeviceIdentifierResponse++; | 435 buildCounterFindDevicesByDeviceIdentifierResponse++; |
| 383 if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) { | 436 if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) { |
| 384 o.devices = buildUnnamed58(); | 437 o.devices = buildUnnamed53(); |
| 385 o.nextPageToken = "foo"; | 438 o.nextPageToken = "foo"; |
| 386 } | 439 } |
| 387 buildCounterFindDevicesByDeviceIdentifierResponse--; | 440 buildCounterFindDevicesByDeviceIdentifierResponse--; |
| 388 return o; | 441 return o; |
| 389 } | 442 } |
| 390 | 443 |
| 391 checkFindDevicesByDeviceIdentifierResponse(api.FindDevicesByDeviceIdentifierResp
onse o) { | 444 checkFindDevicesByDeviceIdentifierResponse( |
| 445 api.FindDevicesByDeviceIdentifierResponse o) { |
| 392 buildCounterFindDevicesByDeviceIdentifierResponse++; | 446 buildCounterFindDevicesByDeviceIdentifierResponse++; |
| 393 if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) { | 447 if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) { |
| 394 checkUnnamed58(o.devices); | 448 checkUnnamed53(o.devices); |
| 395 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 449 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 396 } | 450 } |
| 397 buildCounterFindDevicesByDeviceIdentifierResponse--; | 451 buildCounterFindDevicesByDeviceIdentifierResponse--; |
| 398 } | 452 } |
| 399 | 453 |
| 400 buildUnnamed59() { | 454 buildUnnamed54() { |
| 401 var o = new core.List<core.String>(); | 455 var o = new core.List<core.String>(); |
| 402 o.add("foo"); | 456 o.add("foo"); |
| 403 o.add("foo"); | 457 o.add("foo"); |
| 404 return o; | 458 return o; |
| 405 } | 459 } |
| 406 | 460 |
| 407 checkUnnamed59(core.List<core.String> o) { | 461 checkUnnamed54(core.List<core.String> o) { |
| 408 unittest.expect(o, unittest.hasLength(2)); | 462 unittest.expect(o, unittest.hasLength(2)); |
| 409 unittest.expect(o[0], unittest.equals('foo')); | 463 unittest.expect(o[0], unittest.equals('foo')); |
| 410 unittest.expect(o[1], unittest.equals('foo')); | 464 unittest.expect(o[1], unittest.equals('foo')); |
| 411 } | 465 } |
| 412 | 466 |
| 413 core.int buildCounterFindDevicesByOwnerRequest = 0; | 467 core.int buildCounterFindDevicesByOwnerRequest = 0; |
| 414 buildFindDevicesByOwnerRequest() { | 468 buildFindDevicesByOwnerRequest() { |
| 415 var o = new api.FindDevicesByOwnerRequest(); | 469 var o = new api.FindDevicesByOwnerRequest(); |
| 416 buildCounterFindDevicesByOwnerRequest++; | 470 buildCounterFindDevicesByOwnerRequest++; |
| 417 if (buildCounterFindDevicesByOwnerRequest < 3) { | 471 if (buildCounterFindDevicesByOwnerRequest < 3) { |
| 418 o.customerId = buildUnnamed59(); | 472 o.customerId = buildUnnamed54(); |
| 419 o.limit = "foo"; | 473 o.limit = "foo"; |
| 420 o.pageToken = "foo"; | 474 o.pageToken = "foo"; |
| 421 o.sectionType = "foo"; | 475 o.sectionType = "foo"; |
| 422 } | 476 } |
| 423 buildCounterFindDevicesByOwnerRequest--; | 477 buildCounterFindDevicesByOwnerRequest--; |
| 424 return o; | 478 return o; |
| 425 } | 479 } |
| 426 | 480 |
| 427 checkFindDevicesByOwnerRequest(api.FindDevicesByOwnerRequest o) { | 481 checkFindDevicesByOwnerRequest(api.FindDevicesByOwnerRequest o) { |
| 428 buildCounterFindDevicesByOwnerRequest++; | 482 buildCounterFindDevicesByOwnerRequest++; |
| 429 if (buildCounterFindDevicesByOwnerRequest < 3) { | 483 if (buildCounterFindDevicesByOwnerRequest < 3) { |
| 430 checkUnnamed59(o.customerId); | 484 checkUnnamed54(o.customerId); |
| 431 unittest.expect(o.limit, unittest.equals('foo')); | 485 unittest.expect(o.limit, unittest.equals('foo')); |
| 432 unittest.expect(o.pageToken, unittest.equals('foo')); | 486 unittest.expect(o.pageToken, unittest.equals('foo')); |
| 433 unittest.expect(o.sectionType, unittest.equals('foo')); | 487 unittest.expect(o.sectionType, unittest.equals('foo')); |
| 434 } | 488 } |
| 435 buildCounterFindDevicesByOwnerRequest--; | 489 buildCounterFindDevicesByOwnerRequest--; |
| 436 } | 490 } |
| 437 | 491 |
| 438 buildUnnamed60() { | 492 buildUnnamed55() { |
| 439 var o = new core.List<api.Device>(); | 493 var o = new core.List<api.Device>(); |
| 440 o.add(buildDevice()); | 494 o.add(buildDevice()); |
| 441 o.add(buildDevice()); | 495 o.add(buildDevice()); |
| 442 return o; | 496 return o; |
| 443 } | 497 } |
| 444 | 498 |
| 445 checkUnnamed60(core.List<api.Device> o) { | 499 checkUnnamed55(core.List<api.Device> o) { |
| 446 unittest.expect(o, unittest.hasLength(2)); | 500 unittest.expect(o, unittest.hasLength(2)); |
| 447 checkDevice(o[0]); | 501 checkDevice(o[0]); |
| 448 checkDevice(o[1]); | 502 checkDevice(o[1]); |
| 449 } | 503 } |
| 450 | 504 |
| 451 core.int buildCounterFindDevicesByOwnerResponse = 0; | 505 core.int buildCounterFindDevicesByOwnerResponse = 0; |
| 452 buildFindDevicesByOwnerResponse() { | 506 buildFindDevicesByOwnerResponse() { |
| 453 var o = new api.FindDevicesByOwnerResponse(); | 507 var o = new api.FindDevicesByOwnerResponse(); |
| 454 buildCounterFindDevicesByOwnerResponse++; | 508 buildCounterFindDevicesByOwnerResponse++; |
| 455 if (buildCounterFindDevicesByOwnerResponse < 3) { | 509 if (buildCounterFindDevicesByOwnerResponse < 3) { |
| 456 o.devices = buildUnnamed60(); | 510 o.devices = buildUnnamed55(); |
| 457 o.nextPageToken = "foo"; | 511 o.nextPageToken = "foo"; |
| 458 } | 512 } |
| 459 buildCounterFindDevicesByOwnerResponse--; | 513 buildCounterFindDevicesByOwnerResponse--; |
| 460 return o; | 514 return o; |
| 461 } | 515 } |
| 462 | 516 |
| 463 checkFindDevicesByOwnerResponse(api.FindDevicesByOwnerResponse o) { | 517 checkFindDevicesByOwnerResponse(api.FindDevicesByOwnerResponse o) { |
| 464 buildCounterFindDevicesByOwnerResponse++; | 518 buildCounterFindDevicesByOwnerResponse++; |
| 465 if (buildCounterFindDevicesByOwnerResponse < 3) { | 519 if (buildCounterFindDevicesByOwnerResponse < 3) { |
| 466 checkUnnamed60(o.devices); | 520 checkUnnamed55(o.devices); |
| 467 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 521 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 468 } | 522 } |
| 469 buildCounterFindDevicesByOwnerResponse--; | 523 buildCounterFindDevicesByOwnerResponse--; |
| 470 } | 524 } |
| 471 | 525 |
| 472 buildUnnamed61() { | 526 buildUnnamed56() { |
| 473 var o = new core.List<api.Company>(); | 527 var o = new core.List<api.Company>(); |
| 474 o.add(buildCompany()); | 528 o.add(buildCompany()); |
| 475 o.add(buildCompany()); | 529 o.add(buildCompany()); |
| 476 return o; | 530 return o; |
| 477 } | 531 } |
| 478 | 532 |
| 479 checkUnnamed61(core.List<api.Company> o) { | 533 checkUnnamed56(core.List<api.Company> o) { |
| 480 unittest.expect(o, unittest.hasLength(2)); | 534 unittest.expect(o, unittest.hasLength(2)); |
| 481 checkCompany(o[0]); | 535 checkCompany(o[0]); |
| 482 checkCompany(o[1]); | 536 checkCompany(o[1]); |
| 483 } | 537 } |
| 484 | 538 |
| 485 core.int buildCounterListCustomersResponse = 0; | 539 core.int buildCounterListCustomersResponse = 0; |
| 486 buildListCustomersResponse() { | 540 buildListCustomersResponse() { |
| 487 var o = new api.ListCustomersResponse(); | 541 var o = new api.ListCustomersResponse(); |
| 488 buildCounterListCustomersResponse++; | 542 buildCounterListCustomersResponse++; |
| 489 if (buildCounterListCustomersResponse < 3) { | 543 if (buildCounterListCustomersResponse < 3) { |
| 490 o.customers = buildUnnamed61(); | 544 o.customers = buildUnnamed56(); |
| 491 } | 545 } |
| 492 buildCounterListCustomersResponse--; | 546 buildCounterListCustomersResponse--; |
| 493 return o; | 547 return o; |
| 494 } | 548 } |
| 495 | 549 |
| 496 checkListCustomersResponse(api.ListCustomersResponse o) { | 550 checkListCustomersResponse(api.ListCustomersResponse o) { |
| 497 buildCounterListCustomersResponse++; | 551 buildCounterListCustomersResponse++; |
| 498 if (buildCounterListCustomersResponse < 3) { | 552 if (buildCounterListCustomersResponse < 3) { |
| 499 checkUnnamed61(o.customers); | 553 checkUnnamed56(o.customers); |
| 500 } | 554 } |
| 501 buildCounterListCustomersResponse--; | 555 buildCounterListCustomersResponse--; |
| 502 } | 556 } |
| 503 | 557 |
| 504 buildUnnamed62() { | 558 buildUnnamed57() { |
| 505 var o = new core.Map<core.String, core.Object>(); | 559 var o = new core.Map<core.String, core.Object>(); |
| 506 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 560 o["x"] = { |
| 507 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 561 'list': [1, 2, 3], |
| 562 'bool': true, |
| 563 'string': 'foo' |
| 564 }; |
| 565 o["y"] = { |
| 566 'list': [1, 2, 3], |
| 567 'bool': true, |
| 568 'string': 'foo' |
| 569 }; |
| 508 return o; | 570 return o; |
| 509 } | 571 } |
| 510 | 572 |
| 511 checkUnnamed62(core.Map<core.String, core.Object> o) { | 573 checkUnnamed57(core.Map<core.String, core.Object> o) { |
| 512 unittest.expect(o, unittest.hasLength(2)); | 574 unittest.expect(o, unittest.hasLength(2)); |
| 513 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | 575 var casted1 = (o["x"]) as core.Map; |
| 514 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | 576 unittest.expect(casted1, unittest.hasLength(3)); |
| 577 unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); |
| 578 unittest.expect(casted1["bool"], unittest.equals(true)); |
| 579 unittest.expect(casted1["string"], unittest.equals('foo')); |
| 580 var casted2 = (o["y"]) as core.Map; |
| 581 unittest.expect(casted2, unittest.hasLength(3)); |
| 582 unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); |
| 583 unittest.expect(casted2["bool"], unittest.equals(true)); |
| 584 unittest.expect(casted2["string"], unittest.equals('foo')); |
| 515 } | 585 } |
| 516 | 586 |
| 517 buildUnnamed63() { | 587 buildUnnamed58() { |
| 518 var o = new core.Map<core.String, core.Object>(); | 588 var o = new core.Map<core.String, core.Object>(); |
| 519 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 589 o["x"] = { |
| 520 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 590 'list': [1, 2, 3], |
| 591 'bool': true, |
| 592 'string': 'foo' |
| 593 }; |
| 594 o["y"] = { |
| 595 'list': [1, 2, 3], |
| 596 'bool': true, |
| 597 'string': 'foo' |
| 598 }; |
| 521 return o; | 599 return o; |
| 522 } | 600 } |
| 523 | 601 |
| 524 checkUnnamed63(core.Map<core.String, core.Object> o) { | 602 checkUnnamed58(core.Map<core.String, core.Object> o) { |
| 525 unittest.expect(o, unittest.hasLength(2)); | 603 unittest.expect(o, unittest.hasLength(2)); |
| 526 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); | 604 var casted3 = (o["x"]) as core.Map; |
| 527 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); | 605 unittest.expect(casted3, unittest.hasLength(3)); |
| 606 unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); |
| 607 unittest.expect(casted3["bool"], unittest.equals(true)); |
| 608 unittest.expect(casted3["string"], unittest.equals('foo')); |
| 609 var casted4 = (o["y"]) as core.Map; |
| 610 unittest.expect(casted4, unittest.hasLength(3)); |
| 611 unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); |
| 612 unittest.expect(casted4["bool"], unittest.equals(true)); |
| 613 unittest.expect(casted4["string"], unittest.equals('foo')); |
| 528 } | 614 } |
| 529 | 615 |
| 530 core.int buildCounterOperation = 0; | 616 core.int buildCounterOperation = 0; |
| 531 buildOperation() { | 617 buildOperation() { |
| 532 var o = new api.Operation(); | 618 var o = new api.Operation(); |
| 533 buildCounterOperation++; | 619 buildCounterOperation++; |
| 534 if (buildCounterOperation < 3) { | 620 if (buildCounterOperation < 3) { |
| 535 o.done = true; | 621 o.done = true; |
| 536 o.error = buildStatus(); | 622 o.error = buildStatus(); |
| 537 o.metadata = buildUnnamed62(); | 623 o.metadata = buildUnnamed57(); |
| 538 o.name = "foo"; | 624 o.name = "foo"; |
| 539 o.response = buildUnnamed63(); | 625 o.response = buildUnnamed58(); |
| 540 } | 626 } |
| 541 buildCounterOperation--; | 627 buildCounterOperation--; |
| 542 return o; | 628 return o; |
| 543 } | 629 } |
| 544 | 630 |
| 545 checkOperation(api.Operation o) { | 631 checkOperation(api.Operation o) { |
| 546 buildCounterOperation++; | 632 buildCounterOperation++; |
| 547 if (buildCounterOperation < 3) { | 633 if (buildCounterOperation < 3) { |
| 548 unittest.expect(o.done, unittest.isTrue); | 634 unittest.expect(o.done, unittest.isTrue); |
| 549 checkStatus(o.error); | 635 checkStatus(o.error); |
| 550 checkUnnamed62(o.metadata); | 636 checkUnnamed57(o.metadata); |
| 551 unittest.expect(o.name, unittest.equals('foo')); | 637 unittest.expect(o.name, unittest.equals('foo')); |
| 552 checkUnnamed63(o.response); | 638 checkUnnamed58(o.response); |
| 553 } | 639 } |
| 554 buildCounterOperation--; | 640 buildCounterOperation--; |
| 555 } | 641 } |
| 556 | 642 |
| 557 core.int buildCounterOperationPerDevice = 0; | 643 core.int buildCounterOperationPerDevice = 0; |
| 558 buildOperationPerDevice() { | 644 buildOperationPerDevice() { |
| 559 var o = new api.OperationPerDevice(); | 645 var o = new api.OperationPerDevice(); |
| 560 buildCounterOperationPerDevice++; | 646 buildCounterOperationPerDevice++; |
| 561 if (buildCounterOperationPerDevice < 3) { | 647 if (buildCounterOperationPerDevice < 3) { |
| 562 o.claim = buildPartnerClaim(); | 648 o.claim = buildPartnerClaim(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 buildCounterPerDeviceStatusInBatch++; | 731 buildCounterPerDeviceStatusInBatch++; |
| 646 if (buildCounterPerDeviceStatusInBatch < 3) { | 732 if (buildCounterPerDeviceStatusInBatch < 3) { |
| 647 unittest.expect(o.deviceId, unittest.equals('foo')); | 733 unittest.expect(o.deviceId, unittest.equals('foo')); |
| 648 unittest.expect(o.errorIdentifier, unittest.equals('foo')); | 734 unittest.expect(o.errorIdentifier, unittest.equals('foo')); |
| 649 unittest.expect(o.errorMessage, unittest.equals('foo')); | 735 unittest.expect(o.errorMessage, unittest.equals('foo')); |
| 650 unittest.expect(o.status, unittest.equals('foo')); | 736 unittest.expect(o.status, unittest.equals('foo')); |
| 651 } | 737 } |
| 652 buildCounterPerDeviceStatusInBatch--; | 738 buildCounterPerDeviceStatusInBatch--; |
| 653 } | 739 } |
| 654 | 740 |
| 655 buildUnnamed64() { | 741 buildUnnamed59() { |
| 656 var o = new core.Map<core.String, core.Object>(); | 742 var o = new core.Map<core.String, core.Object>(); |
| 657 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 743 o["x"] = { |
| 658 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 744 'list': [1, 2, 3], |
| 745 'bool': true, |
| 746 'string': 'foo' |
| 747 }; |
| 748 o["y"] = { |
| 749 'list': [1, 2, 3], |
| 750 'bool': true, |
| 751 'string': 'foo' |
| 752 }; |
| 659 return o; | 753 return o; |
| 660 } | 754 } |
| 661 | 755 |
| 662 checkUnnamed64(core.Map<core.String, core.Object> o) { | 756 checkUnnamed59(core.Map<core.String, core.Object> o) { |
| 663 unittest.expect(o, unittest.hasLength(2)); | 757 unittest.expect(o, unittest.hasLength(2)); |
| 664 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); | 758 var casted5 = (o["x"]) as core.Map; |
| 665 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); | 759 unittest.expect(casted5, unittest.hasLength(3)); |
| 760 unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); |
| 761 unittest.expect(casted5["bool"], unittest.equals(true)); |
| 762 unittest.expect(casted5["string"], unittest.equals('foo')); |
| 763 var casted6 = (o["y"]) as core.Map; |
| 764 unittest.expect(casted6, unittest.hasLength(3)); |
| 765 unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); |
| 766 unittest.expect(casted6["bool"], unittest.equals(true)); |
| 767 unittest.expect(casted6["string"], unittest.equals('foo')); |
| 666 } | 768 } |
| 667 | 769 |
| 668 buildUnnamed65() { | 770 buildUnnamed60() { |
| 669 var o = new core.List<core.Map<core.String, core.Object>>(); | 771 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 670 o.add(buildUnnamed64()); | 772 o.add(buildUnnamed59()); |
| 671 o.add(buildUnnamed64()); | 773 o.add(buildUnnamed59()); |
| 672 return o; | 774 return o; |
| 673 } | 775 } |
| 674 | 776 |
| 675 checkUnnamed65(core.List<core.Map<core.String, core.Object>> o) { | 777 checkUnnamed60(core.List<core.Map<core.String, core.Object>> o) { |
| 676 unittest.expect(o, unittest.hasLength(2)); | 778 unittest.expect(o, unittest.hasLength(2)); |
| 677 checkUnnamed64(o[0]); | 779 checkUnnamed59(o[0]); |
| 678 checkUnnamed64(o[1]); | 780 checkUnnamed59(o[1]); |
| 679 } | 781 } |
| 680 | 782 |
| 681 core.int buildCounterStatus = 0; | 783 core.int buildCounterStatus = 0; |
| 682 buildStatus() { | 784 buildStatus() { |
| 683 var o = new api.Status(); | 785 var o = new api.Status(); |
| 684 buildCounterStatus++; | 786 buildCounterStatus++; |
| 685 if (buildCounterStatus < 3) { | 787 if (buildCounterStatus < 3) { |
| 686 o.code = 42; | 788 o.code = 42; |
| 687 o.details = buildUnnamed65(); | 789 o.details = buildUnnamed60(); |
| 688 o.message = "foo"; | 790 o.message = "foo"; |
| 689 } | 791 } |
| 690 buildCounterStatus--; | 792 buildCounterStatus--; |
| 691 return o; | 793 return o; |
| 692 } | 794 } |
| 693 | 795 |
| 694 checkStatus(api.Status o) { | 796 checkStatus(api.Status o) { |
| 695 buildCounterStatus++; | 797 buildCounterStatus++; |
| 696 if (buildCounterStatus < 3) { | 798 if (buildCounterStatus < 3) { |
| 697 unittest.expect(o.code, unittest.equals(42)); | 799 unittest.expect(o.code, unittest.equals(42)); |
| 698 checkUnnamed65(o.details); | 800 checkUnnamed60(o.details); |
| 699 unittest.expect(o.message, unittest.equals('foo')); | 801 unittest.expect(o.message, unittest.equals('foo')); |
| 700 } | 802 } |
| 701 buildCounterStatus--; | 803 buildCounterStatus--; |
| 702 } | 804 } |
| 703 | 805 |
| 704 core.int buildCounterUnclaimDeviceRequest = 0; | 806 core.int buildCounterUnclaimDeviceRequest = 0; |
| 705 buildUnclaimDeviceRequest() { | 807 buildUnclaimDeviceRequest() { |
| 706 var o = new api.UnclaimDeviceRequest(); | 808 var o = new api.UnclaimDeviceRequest(); |
| 707 buildCounterUnclaimDeviceRequest++; | 809 buildCounterUnclaimDeviceRequest++; |
| 708 if (buildCounterUnclaimDeviceRequest < 3) { | 810 if (buildCounterUnclaimDeviceRequest < 3) { |
| 709 o.deviceId = "foo"; | 811 o.deviceId = "foo"; |
| 710 o.deviceIdentifier = buildDeviceIdentifier(); | 812 o.deviceIdentifier = buildDeviceIdentifier(); |
| 711 o.sectionType = "foo"; | 813 o.sectionType = "foo"; |
| 712 } | 814 } |
| 713 buildCounterUnclaimDeviceRequest--; | 815 buildCounterUnclaimDeviceRequest--; |
| 714 return o; | 816 return o; |
| 715 } | 817 } |
| 716 | 818 |
| 717 checkUnclaimDeviceRequest(api.UnclaimDeviceRequest o) { | 819 checkUnclaimDeviceRequest(api.UnclaimDeviceRequest o) { |
| 718 buildCounterUnclaimDeviceRequest++; | 820 buildCounterUnclaimDeviceRequest++; |
| 719 if (buildCounterUnclaimDeviceRequest < 3) { | 821 if (buildCounterUnclaimDeviceRequest < 3) { |
| 720 unittest.expect(o.deviceId, unittest.equals('foo')); | 822 unittest.expect(o.deviceId, unittest.equals('foo')); |
| 721 checkDeviceIdentifier(o.deviceIdentifier); | 823 checkDeviceIdentifier(o.deviceIdentifier); |
| 722 unittest.expect(o.sectionType, unittest.equals('foo')); | 824 unittest.expect(o.sectionType, unittest.equals('foo')); |
| 723 } | 825 } |
| 724 buildCounterUnclaimDeviceRequest--; | 826 buildCounterUnclaimDeviceRequest--; |
| 725 } | 827 } |
| 726 | 828 |
| 727 buildUnnamed66() { | 829 buildUnnamed61() { |
| 728 var o = new core.List<api.PartnerUnclaim>(); | 830 var o = new core.List<api.PartnerUnclaim>(); |
| 729 o.add(buildPartnerUnclaim()); | 831 o.add(buildPartnerUnclaim()); |
| 730 o.add(buildPartnerUnclaim()); | 832 o.add(buildPartnerUnclaim()); |
| 731 return o; | 833 return o; |
| 732 } | 834 } |
| 733 | 835 |
| 734 checkUnnamed66(core.List<api.PartnerUnclaim> o) { | 836 checkUnnamed61(core.List<api.PartnerUnclaim> o) { |
| 735 unittest.expect(o, unittest.hasLength(2)); | 837 unittest.expect(o, unittest.hasLength(2)); |
| 736 checkPartnerUnclaim(o[0]); | 838 checkPartnerUnclaim(o[0]); |
| 737 checkPartnerUnclaim(o[1]); | 839 checkPartnerUnclaim(o[1]); |
| 738 } | 840 } |
| 739 | 841 |
| 740 core.int buildCounterUnclaimDevicesRequest = 0; | 842 core.int buildCounterUnclaimDevicesRequest = 0; |
| 741 buildUnclaimDevicesRequest() { | 843 buildUnclaimDevicesRequest() { |
| 742 var o = new api.UnclaimDevicesRequest(); | 844 var o = new api.UnclaimDevicesRequest(); |
| 743 buildCounterUnclaimDevicesRequest++; | 845 buildCounterUnclaimDevicesRequest++; |
| 744 if (buildCounterUnclaimDevicesRequest < 3) { | 846 if (buildCounterUnclaimDevicesRequest < 3) { |
| 745 o.unclaims = buildUnnamed66(); | 847 o.unclaims = buildUnnamed61(); |
| 746 } | 848 } |
| 747 buildCounterUnclaimDevicesRequest--; | 849 buildCounterUnclaimDevicesRequest--; |
| 748 return o; | 850 return o; |
| 749 } | 851 } |
| 750 | 852 |
| 751 checkUnclaimDevicesRequest(api.UnclaimDevicesRequest o) { | 853 checkUnclaimDevicesRequest(api.UnclaimDevicesRequest o) { |
| 752 buildCounterUnclaimDevicesRequest++; | 854 buildCounterUnclaimDevicesRequest++; |
| 753 if (buildCounterUnclaimDevicesRequest < 3) { | 855 if (buildCounterUnclaimDevicesRequest < 3) { |
| 754 checkUnnamed66(o.unclaims); | 856 checkUnnamed61(o.unclaims); |
| 755 } | 857 } |
| 756 buildCounterUnclaimDevicesRequest--; | 858 buildCounterUnclaimDevicesRequest--; |
| 757 } | 859 } |
| 758 | 860 |
| 759 buildUnnamed67() { | 861 buildUnnamed62() { |
| 760 var o = new core.List<api.UpdateMetadataArguments>(); | 862 var o = new core.List<api.UpdateMetadataArguments>(); |
| 761 o.add(buildUpdateMetadataArguments()); | 863 o.add(buildUpdateMetadataArguments()); |
| 762 o.add(buildUpdateMetadataArguments()); | 864 o.add(buildUpdateMetadataArguments()); |
| 763 return o; | 865 return o; |
| 764 } | 866 } |
| 765 | 867 |
| 766 checkUnnamed67(core.List<api.UpdateMetadataArguments> o) { | 868 checkUnnamed62(core.List<api.UpdateMetadataArguments> o) { |
| 767 unittest.expect(o, unittest.hasLength(2)); | 869 unittest.expect(o, unittest.hasLength(2)); |
| 768 checkUpdateMetadataArguments(o[0]); | 870 checkUpdateMetadataArguments(o[0]); |
| 769 checkUpdateMetadataArguments(o[1]); | 871 checkUpdateMetadataArguments(o[1]); |
| 770 } | 872 } |
| 771 | 873 |
| 772 core.int buildCounterUpdateDeviceMetadataInBatchRequest = 0; | 874 core.int buildCounterUpdateDeviceMetadataInBatchRequest = 0; |
| 773 buildUpdateDeviceMetadataInBatchRequest() { | 875 buildUpdateDeviceMetadataInBatchRequest() { |
| 774 var o = new api.UpdateDeviceMetadataInBatchRequest(); | 876 var o = new api.UpdateDeviceMetadataInBatchRequest(); |
| 775 buildCounterUpdateDeviceMetadataInBatchRequest++; | 877 buildCounterUpdateDeviceMetadataInBatchRequest++; |
| 776 if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) { | 878 if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) { |
| 777 o.updates = buildUnnamed67(); | 879 o.updates = buildUnnamed62(); |
| 778 } | 880 } |
| 779 buildCounterUpdateDeviceMetadataInBatchRequest--; | 881 buildCounterUpdateDeviceMetadataInBatchRequest--; |
| 780 return o; | 882 return o; |
| 781 } | 883 } |
| 782 | 884 |
| 783 checkUpdateDeviceMetadataInBatchRequest(api.UpdateDeviceMetadataInBatchRequest o
) { | 885 checkUpdateDeviceMetadataInBatchRequest( |
| 886 api.UpdateDeviceMetadataInBatchRequest o) { |
| 784 buildCounterUpdateDeviceMetadataInBatchRequest++; | 887 buildCounterUpdateDeviceMetadataInBatchRequest++; |
| 785 if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) { | 888 if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) { |
| 786 checkUnnamed67(o.updates); | 889 checkUnnamed62(o.updates); |
| 787 } | 890 } |
| 788 buildCounterUpdateDeviceMetadataInBatchRequest--; | 891 buildCounterUpdateDeviceMetadataInBatchRequest--; |
| 789 } | 892 } |
| 790 | 893 |
| 791 core.int buildCounterUpdateDeviceMetadataRequest = 0; | 894 core.int buildCounterUpdateDeviceMetadataRequest = 0; |
| 792 buildUpdateDeviceMetadataRequest() { | 895 buildUpdateDeviceMetadataRequest() { |
| 793 var o = new api.UpdateDeviceMetadataRequest(); | 896 var o = new api.UpdateDeviceMetadataRequest(); |
| 794 buildCounterUpdateDeviceMetadataRequest++; | 897 buildCounterUpdateDeviceMetadataRequest++; |
| 795 if (buildCounterUpdateDeviceMetadataRequest < 3) { | 898 if (buildCounterUpdateDeviceMetadataRequest < 3) { |
| 796 o.deviceMetadata = buildDeviceMetadata(); | 899 o.deviceMetadata = buildDeviceMetadata(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 823 checkUpdateMetadataArguments(api.UpdateMetadataArguments o) { | 926 checkUpdateMetadataArguments(api.UpdateMetadataArguments o) { |
| 824 buildCounterUpdateMetadataArguments++; | 927 buildCounterUpdateMetadataArguments++; |
| 825 if (buildCounterUpdateMetadataArguments < 3) { | 928 if (buildCounterUpdateMetadataArguments < 3) { |
| 826 unittest.expect(o.deviceId, unittest.equals('foo')); | 929 unittest.expect(o.deviceId, unittest.equals('foo')); |
| 827 checkDeviceIdentifier(o.deviceIdentifier); | 930 checkDeviceIdentifier(o.deviceIdentifier); |
| 828 checkDeviceMetadata(o.deviceMetadata); | 931 checkDeviceMetadata(o.deviceMetadata); |
| 829 } | 932 } |
| 830 buildCounterUpdateMetadataArguments--; | 933 buildCounterUpdateMetadataArguments--; |
| 831 } | 934 } |
| 832 | 935 |
| 833 | |
| 834 main() { | 936 main() { |
| 835 unittest.group("obj-schema-ClaimDeviceRequest", () { | 937 unittest.group("obj-schema-ClaimDeviceRequest", () { |
| 836 unittest.test("to-json--from-json", () { | 938 unittest.test("to-json--from-json", () { |
| 837 var o = buildClaimDeviceRequest(); | 939 var o = buildClaimDeviceRequest(); |
| 838 var od = new api.ClaimDeviceRequest.fromJson(o.toJson()); | 940 var od = new api.ClaimDeviceRequest.fromJson(o.toJson()); |
| 839 checkClaimDeviceRequest(od); | 941 checkClaimDeviceRequest(od); |
| 840 }); | 942 }); |
| 841 }); | 943 }); |
| 842 | 944 |
| 843 | |
| 844 unittest.group("obj-schema-ClaimDeviceResponse", () { | 945 unittest.group("obj-schema-ClaimDeviceResponse", () { |
| 845 unittest.test("to-json--from-json", () { | 946 unittest.test("to-json--from-json", () { |
| 846 var o = buildClaimDeviceResponse(); | 947 var o = buildClaimDeviceResponse(); |
| 847 var od = new api.ClaimDeviceResponse.fromJson(o.toJson()); | 948 var od = new api.ClaimDeviceResponse.fromJson(o.toJson()); |
| 848 checkClaimDeviceResponse(od); | 949 checkClaimDeviceResponse(od); |
| 849 }); | 950 }); |
| 850 }); | 951 }); |
| 851 | 952 |
| 852 | |
| 853 unittest.group("obj-schema-ClaimDevicesRequest", () { | 953 unittest.group("obj-schema-ClaimDevicesRequest", () { |
| 854 unittest.test("to-json--from-json", () { | 954 unittest.test("to-json--from-json", () { |
| 855 var o = buildClaimDevicesRequest(); | 955 var o = buildClaimDevicesRequest(); |
| 856 var od = new api.ClaimDevicesRequest.fromJson(o.toJson()); | 956 var od = new api.ClaimDevicesRequest.fromJson(o.toJson()); |
| 857 checkClaimDevicesRequest(od); | 957 checkClaimDevicesRequest(od); |
| 858 }); | 958 }); |
| 859 }); | 959 }); |
| 860 | 960 |
| 861 | |
| 862 unittest.group("obj-schema-Company", () { | 961 unittest.group("obj-schema-Company", () { |
| 863 unittest.test("to-json--from-json", () { | 962 unittest.test("to-json--from-json", () { |
| 864 var o = buildCompany(); | 963 var o = buildCompany(); |
| 865 var od = new api.Company.fromJson(o.toJson()); | 964 var od = new api.Company.fromJson(o.toJson()); |
| 866 checkCompany(od); | 965 checkCompany(od); |
| 867 }); | 966 }); |
| 868 }); | 967 }); |
| 869 | 968 |
| 969 unittest.group("obj-schema-CreateCustomerRequest", () { |
| 970 unittest.test("to-json--from-json", () { |
| 971 var o = buildCreateCustomerRequest(); |
| 972 var od = new api.CreateCustomerRequest.fromJson(o.toJson()); |
| 973 checkCreateCustomerRequest(od); |
| 974 }); |
| 975 }); |
| 870 | 976 |
| 871 unittest.group("obj-schema-Device", () { | 977 unittest.group("obj-schema-Device", () { |
| 872 unittest.test("to-json--from-json", () { | 978 unittest.test("to-json--from-json", () { |
| 873 var o = buildDevice(); | 979 var o = buildDevice(); |
| 874 var od = new api.Device.fromJson(o.toJson()); | 980 var od = new api.Device.fromJson(o.toJson()); |
| 875 checkDevice(od); | 981 checkDevice(od); |
| 876 }); | 982 }); |
| 877 }); | 983 }); |
| 878 | 984 |
| 879 | |
| 880 unittest.group("obj-schema-DeviceClaim", () { | 985 unittest.group("obj-schema-DeviceClaim", () { |
| 881 unittest.test("to-json--from-json", () { | 986 unittest.test("to-json--from-json", () { |
| 882 var o = buildDeviceClaim(); | 987 var o = buildDeviceClaim(); |
| 883 var od = new api.DeviceClaim.fromJson(o.toJson()); | 988 var od = new api.DeviceClaim.fromJson(o.toJson()); |
| 884 checkDeviceClaim(od); | 989 checkDeviceClaim(od); |
| 885 }); | 990 }); |
| 886 }); | 991 }); |
| 887 | 992 |
| 888 | |
| 889 unittest.group("obj-schema-DeviceIdentifier", () { | 993 unittest.group("obj-schema-DeviceIdentifier", () { |
| 890 unittest.test("to-json--from-json", () { | 994 unittest.test("to-json--from-json", () { |
| 891 var o = buildDeviceIdentifier(); | 995 var o = buildDeviceIdentifier(); |
| 892 var od = new api.DeviceIdentifier.fromJson(o.toJson()); | 996 var od = new api.DeviceIdentifier.fromJson(o.toJson()); |
| 893 checkDeviceIdentifier(od); | 997 checkDeviceIdentifier(od); |
| 894 }); | 998 }); |
| 895 }); | 999 }); |
| 896 | 1000 |
| 897 | |
| 898 unittest.group("obj-schema-DeviceMetadata", () { | 1001 unittest.group("obj-schema-DeviceMetadata", () { |
| 899 unittest.test("to-json--from-json", () { | 1002 unittest.test("to-json--from-json", () { |
| 900 var o = buildDeviceMetadata(); | 1003 var o = buildDeviceMetadata(); |
| 901 var od = new api.DeviceMetadata.fromJson(o.toJson()); | 1004 var od = new api.DeviceMetadata.fromJson(o.toJson()); |
| 902 checkDeviceMetadata(od); | 1005 checkDeviceMetadata(od); |
| 903 }); | 1006 }); |
| 904 }); | 1007 }); |
| 905 | 1008 |
| 906 | |
| 907 unittest.group("obj-schema-DevicesLongRunningOperationMetadata", () { | 1009 unittest.group("obj-schema-DevicesLongRunningOperationMetadata", () { |
| 908 unittest.test("to-json--from-json", () { | 1010 unittest.test("to-json--from-json", () { |
| 909 var o = buildDevicesLongRunningOperationMetadata(); | 1011 var o = buildDevicesLongRunningOperationMetadata(); |
| 910 var od = new api.DevicesLongRunningOperationMetadata.fromJson(o.toJson()); | 1012 var od = new api.DevicesLongRunningOperationMetadata.fromJson(o.toJson()); |
| 911 checkDevicesLongRunningOperationMetadata(od); | 1013 checkDevicesLongRunningOperationMetadata(od); |
| 912 }); | 1014 }); |
| 913 }); | 1015 }); |
| 914 | 1016 |
| 915 | |
| 916 unittest.group("obj-schema-DevicesLongRunningOperationResponse", () { | 1017 unittest.group("obj-schema-DevicesLongRunningOperationResponse", () { |
| 917 unittest.test("to-json--from-json", () { | 1018 unittest.test("to-json--from-json", () { |
| 918 var o = buildDevicesLongRunningOperationResponse(); | 1019 var o = buildDevicesLongRunningOperationResponse(); |
| 919 var od = new api.DevicesLongRunningOperationResponse.fromJson(o.toJson()); | 1020 var od = new api.DevicesLongRunningOperationResponse.fromJson(o.toJson()); |
| 920 checkDevicesLongRunningOperationResponse(od); | 1021 checkDevicesLongRunningOperationResponse(od); |
| 921 }); | 1022 }); |
| 922 }); | 1023 }); |
| 923 | 1024 |
| 924 | |
| 925 unittest.group("obj-schema-Empty", () { | 1025 unittest.group("obj-schema-Empty", () { |
| 926 unittest.test("to-json--from-json", () { | 1026 unittest.test("to-json--from-json", () { |
| 927 var o = buildEmpty(); | 1027 var o = buildEmpty(); |
| 928 var od = new api.Empty.fromJson(o.toJson()); | 1028 var od = new api.Empty.fromJson(o.toJson()); |
| 929 checkEmpty(od); | 1029 checkEmpty(od); |
| 930 }); | 1030 }); |
| 931 }); | 1031 }); |
| 932 | 1032 |
| 933 | |
| 934 unittest.group("obj-schema-FindDevicesByDeviceIdentifierRequest", () { | 1033 unittest.group("obj-schema-FindDevicesByDeviceIdentifierRequest", () { |
| 935 unittest.test("to-json--from-json", () { | 1034 unittest.test("to-json--from-json", () { |
| 936 var o = buildFindDevicesByDeviceIdentifierRequest(); | 1035 var o = buildFindDevicesByDeviceIdentifierRequest(); |
| 937 var od = new api.FindDevicesByDeviceIdentifierRequest.fromJson(o.toJson())
; | 1036 var od = |
| 1037 new api.FindDevicesByDeviceIdentifierRequest.fromJson(o.toJson()); |
| 938 checkFindDevicesByDeviceIdentifierRequest(od); | 1038 checkFindDevicesByDeviceIdentifierRequest(od); |
| 939 }); | 1039 }); |
| 940 }); | 1040 }); |
| 941 | 1041 |
| 942 | |
| 943 unittest.group("obj-schema-FindDevicesByDeviceIdentifierResponse", () { | 1042 unittest.group("obj-schema-FindDevicesByDeviceIdentifierResponse", () { |
| 944 unittest.test("to-json--from-json", () { | 1043 unittest.test("to-json--from-json", () { |
| 945 var o = buildFindDevicesByDeviceIdentifierResponse(); | 1044 var o = buildFindDevicesByDeviceIdentifierResponse(); |
| 946 var od = new api.FindDevicesByDeviceIdentifierResponse.fromJson(o.toJson()
); | 1045 var od = |
| 1046 new api.FindDevicesByDeviceIdentifierResponse.fromJson(o.toJson()); |
| 947 checkFindDevicesByDeviceIdentifierResponse(od); | 1047 checkFindDevicesByDeviceIdentifierResponse(od); |
| 948 }); | 1048 }); |
| 949 }); | 1049 }); |
| 950 | 1050 |
| 951 | |
| 952 unittest.group("obj-schema-FindDevicesByOwnerRequest", () { | 1051 unittest.group("obj-schema-FindDevicesByOwnerRequest", () { |
| 953 unittest.test("to-json--from-json", () { | 1052 unittest.test("to-json--from-json", () { |
| 954 var o = buildFindDevicesByOwnerRequest(); | 1053 var o = buildFindDevicesByOwnerRequest(); |
| 955 var od = new api.FindDevicesByOwnerRequest.fromJson(o.toJson()); | 1054 var od = new api.FindDevicesByOwnerRequest.fromJson(o.toJson()); |
| 956 checkFindDevicesByOwnerRequest(od); | 1055 checkFindDevicesByOwnerRequest(od); |
| 957 }); | 1056 }); |
| 958 }); | 1057 }); |
| 959 | 1058 |
| 960 | |
| 961 unittest.group("obj-schema-FindDevicesByOwnerResponse", () { | 1059 unittest.group("obj-schema-FindDevicesByOwnerResponse", () { |
| 962 unittest.test("to-json--from-json", () { | 1060 unittest.test("to-json--from-json", () { |
| 963 var o = buildFindDevicesByOwnerResponse(); | 1061 var o = buildFindDevicesByOwnerResponse(); |
| 964 var od = new api.FindDevicesByOwnerResponse.fromJson(o.toJson()); | 1062 var od = new api.FindDevicesByOwnerResponse.fromJson(o.toJson()); |
| 965 checkFindDevicesByOwnerResponse(od); | 1063 checkFindDevicesByOwnerResponse(od); |
| 966 }); | 1064 }); |
| 967 }); | 1065 }); |
| 968 | 1066 |
| 969 | |
| 970 unittest.group("obj-schema-ListCustomersResponse", () { | 1067 unittest.group("obj-schema-ListCustomersResponse", () { |
| 971 unittest.test("to-json--from-json", () { | 1068 unittest.test("to-json--from-json", () { |
| 972 var o = buildListCustomersResponse(); | 1069 var o = buildListCustomersResponse(); |
| 973 var od = new api.ListCustomersResponse.fromJson(o.toJson()); | 1070 var od = new api.ListCustomersResponse.fromJson(o.toJson()); |
| 974 checkListCustomersResponse(od); | 1071 checkListCustomersResponse(od); |
| 975 }); | 1072 }); |
| 976 }); | 1073 }); |
| 977 | 1074 |
| 978 | |
| 979 unittest.group("obj-schema-Operation", () { | 1075 unittest.group("obj-schema-Operation", () { |
| 980 unittest.test("to-json--from-json", () { | 1076 unittest.test("to-json--from-json", () { |
| 981 var o = buildOperation(); | 1077 var o = buildOperation(); |
| 982 var od = new api.Operation.fromJson(o.toJson()); | 1078 var od = new api.Operation.fromJson(o.toJson()); |
| 983 checkOperation(od); | 1079 checkOperation(od); |
| 984 }); | 1080 }); |
| 985 }); | 1081 }); |
| 986 | 1082 |
| 987 | |
| 988 unittest.group("obj-schema-OperationPerDevice", () { | 1083 unittest.group("obj-schema-OperationPerDevice", () { |
| 989 unittest.test("to-json--from-json", () { | 1084 unittest.test("to-json--from-json", () { |
| 990 var o = buildOperationPerDevice(); | 1085 var o = buildOperationPerDevice(); |
| 991 var od = new api.OperationPerDevice.fromJson(o.toJson()); | 1086 var od = new api.OperationPerDevice.fromJson(o.toJson()); |
| 992 checkOperationPerDevice(od); | 1087 checkOperationPerDevice(od); |
| 993 }); | 1088 }); |
| 994 }); | 1089 }); |
| 995 | 1090 |
| 996 | |
| 997 unittest.group("obj-schema-PartnerClaim", () { | 1091 unittest.group("obj-schema-PartnerClaim", () { |
| 998 unittest.test("to-json--from-json", () { | 1092 unittest.test("to-json--from-json", () { |
| 999 var o = buildPartnerClaim(); | 1093 var o = buildPartnerClaim(); |
| 1000 var od = new api.PartnerClaim.fromJson(o.toJson()); | 1094 var od = new api.PartnerClaim.fromJson(o.toJson()); |
| 1001 checkPartnerClaim(od); | 1095 checkPartnerClaim(od); |
| 1002 }); | 1096 }); |
| 1003 }); | 1097 }); |
| 1004 | 1098 |
| 1005 | |
| 1006 unittest.group("obj-schema-PartnerUnclaim", () { | 1099 unittest.group("obj-schema-PartnerUnclaim", () { |
| 1007 unittest.test("to-json--from-json", () { | 1100 unittest.test("to-json--from-json", () { |
| 1008 var o = buildPartnerUnclaim(); | 1101 var o = buildPartnerUnclaim(); |
| 1009 var od = new api.PartnerUnclaim.fromJson(o.toJson()); | 1102 var od = new api.PartnerUnclaim.fromJson(o.toJson()); |
| 1010 checkPartnerUnclaim(od); | 1103 checkPartnerUnclaim(od); |
| 1011 }); | 1104 }); |
| 1012 }); | 1105 }); |
| 1013 | 1106 |
| 1014 | |
| 1015 unittest.group("obj-schema-PerDeviceStatusInBatch", () { | 1107 unittest.group("obj-schema-PerDeviceStatusInBatch", () { |
| 1016 unittest.test("to-json--from-json", () { | 1108 unittest.test("to-json--from-json", () { |
| 1017 var o = buildPerDeviceStatusInBatch(); | 1109 var o = buildPerDeviceStatusInBatch(); |
| 1018 var od = new api.PerDeviceStatusInBatch.fromJson(o.toJson()); | 1110 var od = new api.PerDeviceStatusInBatch.fromJson(o.toJson()); |
| 1019 checkPerDeviceStatusInBatch(od); | 1111 checkPerDeviceStatusInBatch(od); |
| 1020 }); | 1112 }); |
| 1021 }); | 1113 }); |
| 1022 | 1114 |
| 1023 | |
| 1024 unittest.group("obj-schema-Status", () { | 1115 unittest.group("obj-schema-Status", () { |
| 1025 unittest.test("to-json--from-json", () { | 1116 unittest.test("to-json--from-json", () { |
| 1026 var o = buildStatus(); | 1117 var o = buildStatus(); |
| 1027 var od = new api.Status.fromJson(o.toJson()); | 1118 var od = new api.Status.fromJson(o.toJson()); |
| 1028 checkStatus(od); | 1119 checkStatus(od); |
| 1029 }); | 1120 }); |
| 1030 }); | 1121 }); |
| 1031 | 1122 |
| 1032 | |
| 1033 unittest.group("obj-schema-UnclaimDeviceRequest", () { | 1123 unittest.group("obj-schema-UnclaimDeviceRequest", () { |
| 1034 unittest.test("to-json--from-json", () { | 1124 unittest.test("to-json--from-json", () { |
| 1035 var o = buildUnclaimDeviceRequest(); | 1125 var o = buildUnclaimDeviceRequest(); |
| 1036 var od = new api.UnclaimDeviceRequest.fromJson(o.toJson()); | 1126 var od = new api.UnclaimDeviceRequest.fromJson(o.toJson()); |
| 1037 checkUnclaimDeviceRequest(od); | 1127 checkUnclaimDeviceRequest(od); |
| 1038 }); | 1128 }); |
| 1039 }); | 1129 }); |
| 1040 | 1130 |
| 1041 | |
| 1042 unittest.group("obj-schema-UnclaimDevicesRequest", () { | 1131 unittest.group("obj-schema-UnclaimDevicesRequest", () { |
| 1043 unittest.test("to-json--from-json", () { | 1132 unittest.test("to-json--from-json", () { |
| 1044 var o = buildUnclaimDevicesRequest(); | 1133 var o = buildUnclaimDevicesRequest(); |
| 1045 var od = new api.UnclaimDevicesRequest.fromJson(o.toJson()); | 1134 var od = new api.UnclaimDevicesRequest.fromJson(o.toJson()); |
| 1046 checkUnclaimDevicesRequest(od); | 1135 checkUnclaimDevicesRequest(od); |
| 1047 }); | 1136 }); |
| 1048 }); | 1137 }); |
| 1049 | 1138 |
| 1050 | |
| 1051 unittest.group("obj-schema-UpdateDeviceMetadataInBatchRequest", () { | 1139 unittest.group("obj-schema-UpdateDeviceMetadataInBatchRequest", () { |
| 1052 unittest.test("to-json--from-json", () { | 1140 unittest.test("to-json--from-json", () { |
| 1053 var o = buildUpdateDeviceMetadataInBatchRequest(); | 1141 var o = buildUpdateDeviceMetadataInBatchRequest(); |
| 1054 var od = new api.UpdateDeviceMetadataInBatchRequest.fromJson(o.toJson()); | 1142 var od = new api.UpdateDeviceMetadataInBatchRequest.fromJson(o.toJson()); |
| 1055 checkUpdateDeviceMetadataInBatchRequest(od); | 1143 checkUpdateDeviceMetadataInBatchRequest(od); |
| 1056 }); | 1144 }); |
| 1057 }); | 1145 }); |
| 1058 | 1146 |
| 1059 | |
| 1060 unittest.group("obj-schema-UpdateDeviceMetadataRequest", () { | 1147 unittest.group("obj-schema-UpdateDeviceMetadataRequest", () { |
| 1061 unittest.test("to-json--from-json", () { | 1148 unittest.test("to-json--from-json", () { |
| 1062 var o = buildUpdateDeviceMetadataRequest(); | 1149 var o = buildUpdateDeviceMetadataRequest(); |
| 1063 var od = new api.UpdateDeviceMetadataRequest.fromJson(o.toJson()); | 1150 var od = new api.UpdateDeviceMetadataRequest.fromJson(o.toJson()); |
| 1064 checkUpdateDeviceMetadataRequest(od); | 1151 checkUpdateDeviceMetadataRequest(od); |
| 1065 }); | 1152 }); |
| 1066 }); | 1153 }); |
| 1067 | 1154 |
| 1068 | |
| 1069 unittest.group("obj-schema-UpdateMetadataArguments", () { | 1155 unittest.group("obj-schema-UpdateMetadataArguments", () { |
| 1070 unittest.test("to-json--from-json", () { | 1156 unittest.test("to-json--from-json", () { |
| 1071 var o = buildUpdateMetadataArguments(); | 1157 var o = buildUpdateMetadataArguments(); |
| 1072 var od = new api.UpdateMetadataArguments.fromJson(o.toJson()); | 1158 var od = new api.UpdateMetadataArguments.fromJson(o.toJson()); |
| 1073 checkUpdateMetadataArguments(od); | 1159 checkUpdateMetadataArguments(od); |
| 1074 }); | 1160 }); |
| 1075 }); | 1161 }); |
| 1076 | 1162 |
| 1077 | |
| 1078 unittest.group("resource-OperationsResourceApi", () { | 1163 unittest.group("resource-OperationsResourceApi", () { |
| 1079 unittest.test("method--get", () { | 1164 unittest.test("method--get", () { |
| 1080 | |
| 1081 var mock = new HttpServerMock(); | 1165 var mock = new HttpServerMock(); |
| 1082 api.OperationsResourceApi res = new api.AndroiddeviceprovisioningApi(mock)
.operations; | 1166 api.OperationsResourceApi res = |
| 1167 new api.AndroiddeviceprovisioningApi(mock).operations; |
| 1083 var arg_name = "foo"; | 1168 var arg_name = "foo"; |
| 1084 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1169 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1085 var path = (req.url).path; | 1170 var path = (req.url).path; |
| 1086 var pathOffset = 0; | 1171 var pathOffset = 0; |
| 1087 var index; | 1172 var index; |
| 1088 var subPart; | 1173 var subPart; |
| 1089 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1174 unittest.expect( |
| 1175 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1090 pathOffset += 1; | 1176 pathOffset += 1; |
| 1091 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1177 unittest.expect( |
| 1178 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1092 pathOffset += 3; | 1179 pathOffset += 3; |
| 1093 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1180 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1094 | 1181 |
| 1095 var query = (req.url).query; | 1182 var query = (req.url).query; |
| 1096 var queryOffset = 0; | 1183 var queryOffset = 0; |
| 1097 var queryMap = {}; | 1184 var queryMap = {}; |
| 1098 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1185 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1099 parseBool(n) { | 1186 parseBool(n) { |
| 1100 if (n == "true") return true; | 1187 if (n == "true") return true; |
| 1101 if (n == "false") return false; | 1188 if (n == "false") return false; |
| 1102 if (n == null) return null; | 1189 if (n == null) return null; |
| 1103 throw new core.ArgumentError("Invalid boolean: $n"); | 1190 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1104 } | 1191 } |
| 1192 |
| 1105 if (query.length > 0) { | 1193 if (query.length > 0) { |
| 1106 for (var part in query.split("&")) { | 1194 for (var part in query.split("&")) { |
| 1107 var keyvalue = part.split("="); | 1195 var keyvalue = part.split("="); |
| 1108 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1196 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1197 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1109 } | 1198 } |
| 1110 } | 1199 } |
| 1111 | 1200 |
| 1112 | |
| 1113 var h = { | 1201 var h = { |
| 1114 "content-type" : "application/json; charset=utf-8", | 1202 "content-type": "application/json; charset=utf-8", |
| 1115 }; | 1203 }; |
| 1116 var resp = convert.JSON.encode(buildOperation()); | 1204 var resp = convert.JSON.encode(buildOperation()); |
| 1117 return new async.Future.value(stringResponse(200, h, resp)); | 1205 return new async.Future.value(stringResponse(200, h, resp)); |
| 1118 }), true); | 1206 }), true); |
| 1119 res.get(arg_name).then(unittest.expectAsync1(((api.Operation response) { | 1207 res.get(arg_name).then(unittest.expectAsync1(((api.Operation response) { |
| 1120 checkOperation(response); | 1208 checkOperation(response); |
| 1121 }))); | 1209 }))); |
| 1122 }); | 1210 }); |
| 1123 | |
| 1124 }); | 1211 }); |
| 1125 | 1212 |
| 1213 unittest.group("resource-PartnersCustomersResourceApi", () { |
| 1214 unittest.test("method--create", () { |
| 1215 var mock = new HttpServerMock(); |
| 1216 api.PartnersCustomersResourceApi res = |
| 1217 new api.AndroiddeviceprovisioningApi(mock).partners.customers; |
| 1218 var arg_request = buildCreateCustomerRequest(); |
| 1219 var arg_parent = "foo"; |
| 1220 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1221 var obj = new api.CreateCustomerRequest.fromJson(json); |
| 1222 checkCreateCustomerRequest(obj); |
| 1126 | 1223 |
| 1127 unittest.group("resource-PartnersCustomersResourceApi", () { | 1224 var path = (req.url).path; |
| 1225 var pathOffset = 0; |
| 1226 var index; |
| 1227 var subPart; |
| 1228 unittest.expect( |
| 1229 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1230 pathOffset += 1; |
| 1231 unittest.expect( |
| 1232 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1233 pathOffset += 3; |
| 1234 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1235 |
| 1236 var query = (req.url).query; |
| 1237 var queryOffset = 0; |
| 1238 var queryMap = {}; |
| 1239 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1240 parseBool(n) { |
| 1241 if (n == "true") return true; |
| 1242 if (n == "false") return false; |
| 1243 if (n == null) return null; |
| 1244 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1245 } |
| 1246 |
| 1247 if (query.length > 0) { |
| 1248 for (var part in query.split("&")) { |
| 1249 var keyvalue = part.split("="); |
| 1250 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1251 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1252 } |
| 1253 } |
| 1254 |
| 1255 var h = { |
| 1256 "content-type": "application/json; charset=utf-8", |
| 1257 }; |
| 1258 var resp = convert.JSON.encode(buildCompany()); |
| 1259 return new async.Future.value(stringResponse(200, h, resp)); |
| 1260 }), true); |
| 1261 res |
| 1262 .create(arg_request, arg_parent) |
| 1263 .then(unittest.expectAsync1(((api.Company response) { |
| 1264 checkCompany(response); |
| 1265 }))); |
| 1266 }); |
| 1267 |
| 1128 unittest.test("method--list", () { | 1268 unittest.test("method--list", () { |
| 1129 | |
| 1130 var mock = new HttpServerMock(); | 1269 var mock = new HttpServerMock(); |
| 1131 api.PartnersCustomersResourceApi res = new api.AndroiddeviceprovisioningAp
i(mock).partners.customers; | 1270 api.PartnersCustomersResourceApi res = |
| 1271 new api.AndroiddeviceprovisioningApi(mock).partners.customers; |
| 1132 var arg_partnerId = "foo"; | 1272 var arg_partnerId = "foo"; |
| 1133 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1273 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1134 var path = (req.url).path; | 1274 var path = (req.url).path; |
| 1135 var pathOffset = 0; | 1275 var pathOffset = 0; |
| 1136 var index; | 1276 var index; |
| 1137 var subPart; | 1277 var subPart; |
| 1138 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1278 unittest.expect( |
| 1279 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1139 pathOffset += 1; | 1280 pathOffset += 1; |
| 1140 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1281 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1282 unittest.equals("v1/partners/")); |
| 1141 pathOffset += 12; | 1283 pathOffset += 12; |
| 1142 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1284 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1143 | 1285 |
| 1144 var query = (req.url).query; | 1286 var query = (req.url).query; |
| 1145 var queryOffset = 0; | 1287 var queryOffset = 0; |
| 1146 var queryMap = {}; | 1288 var queryMap = {}; |
| 1147 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1289 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1148 parseBool(n) { | 1290 parseBool(n) { |
| 1149 if (n == "true") return true; | 1291 if (n == "true") return true; |
| 1150 if (n == "false") return false; | 1292 if (n == "false") return false; |
| 1151 if (n == null) return null; | 1293 if (n == null) return null; |
| 1152 throw new core.ArgumentError("Invalid boolean: $n"); | 1294 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1153 } | 1295 } |
| 1296 |
| 1154 if (query.length > 0) { | 1297 if (query.length > 0) { |
| 1155 for (var part in query.split("&")) { | 1298 for (var part in query.split("&")) { |
| 1156 var keyvalue = part.split("="); | 1299 var keyvalue = part.split("="); |
| 1157 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1300 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1301 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1158 } | 1302 } |
| 1159 } | 1303 } |
| 1160 | 1304 |
| 1161 | |
| 1162 var h = { | 1305 var h = { |
| 1163 "content-type" : "application/json; charset=utf-8", | 1306 "content-type": "application/json; charset=utf-8", |
| 1164 }; | 1307 }; |
| 1165 var resp = convert.JSON.encode(buildListCustomersResponse()); | 1308 var resp = convert.JSON.encode(buildListCustomersResponse()); |
| 1166 return new async.Future.value(stringResponse(200, h, resp)); | 1309 return new async.Future.value(stringResponse(200, h, resp)); |
| 1167 }), true); | 1310 }), true); |
| 1168 res.list(arg_partnerId).then(unittest.expectAsync1(((api.ListCustomersResp
onse response) { | 1311 res |
| 1312 .list(arg_partnerId) |
| 1313 .then(unittest.expectAsync1(((api.ListCustomersResponse response) { |
| 1169 checkListCustomersResponse(response); | 1314 checkListCustomersResponse(response); |
| 1170 }))); | 1315 }))); |
| 1171 }); | 1316 }); |
| 1172 | |
| 1173 }); | 1317 }); |
| 1174 | 1318 |
| 1175 | |
| 1176 unittest.group("resource-PartnersDevicesResourceApi", () { | 1319 unittest.group("resource-PartnersDevicesResourceApi", () { |
| 1177 unittest.test("method--claim", () { | 1320 unittest.test("method--claim", () { |
| 1178 | |
| 1179 var mock = new HttpServerMock(); | 1321 var mock = new HttpServerMock(); |
| 1180 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1322 api.PartnersDevicesResourceApi res = |
| 1323 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1181 var arg_request = buildClaimDeviceRequest(); | 1324 var arg_request = buildClaimDeviceRequest(); |
| 1182 var arg_partnerId = "foo"; | 1325 var arg_partnerId = "foo"; |
| 1183 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1326 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1184 var obj = new api.ClaimDeviceRequest.fromJson(json); | 1327 var obj = new api.ClaimDeviceRequest.fromJson(json); |
| 1185 checkClaimDeviceRequest(obj); | 1328 checkClaimDeviceRequest(obj); |
| 1186 | 1329 |
| 1187 var path = (req.url).path; | 1330 var path = (req.url).path; |
| 1188 var pathOffset = 0; | 1331 var pathOffset = 0; |
| 1189 var index; | 1332 var index; |
| 1190 var subPart; | 1333 var subPart; |
| 1191 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1334 unittest.expect( |
| 1335 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1192 pathOffset += 1; | 1336 pathOffset += 1; |
| 1193 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1337 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1338 unittest.equals("v1/partners/")); |
| 1194 pathOffset += 12; | 1339 pathOffset += 12; |
| 1195 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1340 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1196 | 1341 |
| 1197 var query = (req.url).query; | 1342 var query = (req.url).query; |
| 1198 var queryOffset = 0; | 1343 var queryOffset = 0; |
| 1199 var queryMap = {}; | 1344 var queryMap = {}; |
| 1200 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1345 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1201 parseBool(n) { | 1346 parseBool(n) { |
| 1202 if (n == "true") return true; | 1347 if (n == "true") return true; |
| 1203 if (n == "false") return false; | 1348 if (n == "false") return false; |
| 1204 if (n == null) return null; | 1349 if (n == null) return null; |
| 1205 throw new core.ArgumentError("Invalid boolean: $n"); | 1350 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1206 } | 1351 } |
| 1352 |
| 1207 if (query.length > 0) { | 1353 if (query.length > 0) { |
| 1208 for (var part in query.split("&")) { | 1354 for (var part in query.split("&")) { |
| 1209 var keyvalue = part.split("="); | 1355 var keyvalue = part.split("="); |
| 1210 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1356 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1357 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1211 } | 1358 } |
| 1212 } | 1359 } |
| 1213 | 1360 |
| 1214 | |
| 1215 var h = { | 1361 var h = { |
| 1216 "content-type" : "application/json; charset=utf-8", | 1362 "content-type": "application/json; charset=utf-8", |
| 1217 }; | 1363 }; |
| 1218 var resp = convert.JSON.encode(buildClaimDeviceResponse()); | 1364 var resp = convert.JSON.encode(buildClaimDeviceResponse()); |
| 1219 return new async.Future.value(stringResponse(200, h, resp)); | 1365 return new async.Future.value(stringResponse(200, h, resp)); |
| 1220 }), true); | 1366 }), true); |
| 1221 res.claim(arg_request, arg_partnerId).then(unittest.expectAsync1(((api.Cla
imDeviceResponse response) { | 1367 res |
| 1368 .claim(arg_request, arg_partnerId) |
| 1369 .then(unittest.expectAsync1(((api.ClaimDeviceResponse response) { |
| 1222 checkClaimDeviceResponse(response); | 1370 checkClaimDeviceResponse(response); |
| 1223 }))); | 1371 }))); |
| 1224 }); | 1372 }); |
| 1225 | 1373 |
| 1226 unittest.test("method--claimAsync", () { | 1374 unittest.test("method--claimAsync", () { |
| 1227 | |
| 1228 var mock = new HttpServerMock(); | 1375 var mock = new HttpServerMock(); |
| 1229 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1376 api.PartnersDevicesResourceApi res = |
| 1377 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1230 var arg_request = buildClaimDevicesRequest(); | 1378 var arg_request = buildClaimDevicesRequest(); |
| 1231 var arg_partnerId = "foo"; | 1379 var arg_partnerId = "foo"; |
| 1232 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1380 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1233 var obj = new api.ClaimDevicesRequest.fromJson(json); | 1381 var obj = new api.ClaimDevicesRequest.fromJson(json); |
| 1234 checkClaimDevicesRequest(obj); | 1382 checkClaimDevicesRequest(obj); |
| 1235 | 1383 |
| 1236 var path = (req.url).path; | 1384 var path = (req.url).path; |
| 1237 var pathOffset = 0; | 1385 var pathOffset = 0; |
| 1238 var index; | 1386 var index; |
| 1239 var subPart; | 1387 var subPart; |
| 1240 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1388 unittest.expect( |
| 1389 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1241 pathOffset += 1; | 1390 pathOffset += 1; |
| 1242 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1391 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1392 unittest.equals("v1/partners/")); |
| 1243 pathOffset += 12; | 1393 pathOffset += 12; |
| 1244 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1394 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1245 | 1395 |
| 1246 var query = (req.url).query; | 1396 var query = (req.url).query; |
| 1247 var queryOffset = 0; | 1397 var queryOffset = 0; |
| 1248 var queryMap = {}; | 1398 var queryMap = {}; |
| 1249 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1399 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1250 parseBool(n) { | 1400 parseBool(n) { |
| 1251 if (n == "true") return true; | 1401 if (n == "true") return true; |
| 1252 if (n == "false") return false; | 1402 if (n == "false") return false; |
| 1253 if (n == null) return null; | 1403 if (n == null) return null; |
| 1254 throw new core.ArgumentError("Invalid boolean: $n"); | 1404 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1255 } | 1405 } |
| 1406 |
| 1256 if (query.length > 0) { | 1407 if (query.length > 0) { |
| 1257 for (var part in query.split("&")) { | 1408 for (var part in query.split("&")) { |
| 1258 var keyvalue = part.split("="); | 1409 var keyvalue = part.split("="); |
| 1259 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1410 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1411 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1260 } | 1412 } |
| 1261 } | 1413 } |
| 1262 | 1414 |
| 1263 | |
| 1264 var h = { | 1415 var h = { |
| 1265 "content-type" : "application/json; charset=utf-8", | 1416 "content-type": "application/json; charset=utf-8", |
| 1266 }; | 1417 }; |
| 1267 var resp = convert.JSON.encode(buildOperation()); | 1418 var resp = convert.JSON.encode(buildOperation()); |
| 1268 return new async.Future.value(stringResponse(200, h, resp)); | 1419 return new async.Future.value(stringResponse(200, h, resp)); |
| 1269 }), true); | 1420 }), true); |
| 1270 res.claimAsync(arg_request, arg_partnerId).then(unittest.expectAsync1(((ap
i.Operation response) { | 1421 res |
| 1422 .claimAsync(arg_request, arg_partnerId) |
| 1423 .then(unittest.expectAsync1(((api.Operation response) { |
| 1271 checkOperation(response); | 1424 checkOperation(response); |
| 1272 }))); | 1425 }))); |
| 1273 }); | 1426 }); |
| 1274 | 1427 |
| 1275 unittest.test("method--findByIdentifier", () { | 1428 unittest.test("method--findByIdentifier", () { |
| 1276 | |
| 1277 var mock = new HttpServerMock(); | 1429 var mock = new HttpServerMock(); |
| 1278 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1430 api.PartnersDevicesResourceApi res = |
| 1431 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1279 var arg_request = buildFindDevicesByDeviceIdentifierRequest(); | 1432 var arg_request = buildFindDevicesByDeviceIdentifierRequest(); |
| 1280 var arg_partnerId = "foo"; | 1433 var arg_partnerId = "foo"; |
| 1281 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1434 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1282 var obj = new api.FindDevicesByDeviceIdentifierRequest.fromJson(json); | 1435 var obj = new api.FindDevicesByDeviceIdentifierRequest.fromJson(json); |
| 1283 checkFindDevicesByDeviceIdentifierRequest(obj); | 1436 checkFindDevicesByDeviceIdentifierRequest(obj); |
| 1284 | 1437 |
| 1285 var path = (req.url).path; | 1438 var path = (req.url).path; |
| 1286 var pathOffset = 0; | 1439 var pathOffset = 0; |
| 1287 var index; | 1440 var index; |
| 1288 var subPart; | 1441 var subPart; |
| 1289 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1442 unittest.expect( |
| 1443 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1290 pathOffset += 1; | 1444 pathOffset += 1; |
| 1291 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1445 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1446 unittest.equals("v1/partners/")); |
| 1292 pathOffset += 12; | 1447 pathOffset += 12; |
| 1293 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1448 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1294 | 1449 |
| 1295 var query = (req.url).query; | 1450 var query = (req.url).query; |
| 1296 var queryOffset = 0; | 1451 var queryOffset = 0; |
| 1297 var queryMap = {}; | 1452 var queryMap = {}; |
| 1298 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1453 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1299 parseBool(n) { | 1454 parseBool(n) { |
| 1300 if (n == "true") return true; | 1455 if (n == "true") return true; |
| 1301 if (n == "false") return false; | 1456 if (n == "false") return false; |
| 1302 if (n == null) return null; | 1457 if (n == null) return null; |
| 1303 throw new core.ArgumentError("Invalid boolean: $n"); | 1458 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1304 } | 1459 } |
| 1460 |
| 1305 if (query.length > 0) { | 1461 if (query.length > 0) { |
| 1306 for (var part in query.split("&")) { | 1462 for (var part in query.split("&")) { |
| 1307 var keyvalue = part.split("="); | 1463 var keyvalue = part.split("="); |
| 1308 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1464 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1465 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1309 } | 1466 } |
| 1310 } | 1467 } |
| 1311 | 1468 |
| 1312 | |
| 1313 var h = { | 1469 var h = { |
| 1314 "content-type" : "application/json; charset=utf-8", | 1470 "content-type": "application/json; charset=utf-8", |
| 1315 }; | 1471 }; |
| 1316 var resp = convert.JSON.encode(buildFindDevicesByDeviceIdentifierRespons
e()); | 1472 var resp = |
| 1473 convert.JSON.encode(buildFindDevicesByDeviceIdentifierResponse()); |
| 1317 return new async.Future.value(stringResponse(200, h, resp)); | 1474 return new async.Future.value(stringResponse(200, h, resp)); |
| 1318 }), true); | 1475 }), true); |
| 1319 res.findByIdentifier(arg_request, arg_partnerId).then(unittest.expectAsync
1(((api.FindDevicesByDeviceIdentifierResponse response) { | 1476 res.findByIdentifier(arg_request, arg_partnerId).then(unittest |
| 1477 .expectAsync1(((api.FindDevicesByDeviceIdentifierResponse response) { |
| 1320 checkFindDevicesByDeviceIdentifierResponse(response); | 1478 checkFindDevicesByDeviceIdentifierResponse(response); |
| 1321 }))); | 1479 }))); |
| 1322 }); | 1480 }); |
| 1323 | 1481 |
| 1324 unittest.test("method--findByOwner", () { | 1482 unittest.test("method--findByOwner", () { |
| 1325 | |
| 1326 var mock = new HttpServerMock(); | 1483 var mock = new HttpServerMock(); |
| 1327 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1484 api.PartnersDevicesResourceApi res = |
| 1485 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1328 var arg_request = buildFindDevicesByOwnerRequest(); | 1486 var arg_request = buildFindDevicesByOwnerRequest(); |
| 1329 var arg_partnerId = "foo"; | 1487 var arg_partnerId = "foo"; |
| 1330 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1488 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1331 var obj = new api.FindDevicesByOwnerRequest.fromJson(json); | 1489 var obj = new api.FindDevicesByOwnerRequest.fromJson(json); |
| 1332 checkFindDevicesByOwnerRequest(obj); | 1490 checkFindDevicesByOwnerRequest(obj); |
| 1333 | 1491 |
| 1334 var path = (req.url).path; | 1492 var path = (req.url).path; |
| 1335 var pathOffset = 0; | 1493 var pathOffset = 0; |
| 1336 var index; | 1494 var index; |
| 1337 var subPart; | 1495 var subPart; |
| 1338 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1496 unittest.expect( |
| 1497 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1339 pathOffset += 1; | 1498 pathOffset += 1; |
| 1340 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1499 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1500 unittest.equals("v1/partners/")); |
| 1341 pathOffset += 12; | 1501 pathOffset += 12; |
| 1342 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1502 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1343 | 1503 |
| 1344 var query = (req.url).query; | 1504 var query = (req.url).query; |
| 1345 var queryOffset = 0; | 1505 var queryOffset = 0; |
| 1346 var queryMap = {}; | 1506 var queryMap = {}; |
| 1347 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1507 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1348 parseBool(n) { | 1508 parseBool(n) { |
| 1349 if (n == "true") return true; | 1509 if (n == "true") return true; |
| 1350 if (n == "false") return false; | 1510 if (n == "false") return false; |
| 1351 if (n == null) return null; | 1511 if (n == null) return null; |
| 1352 throw new core.ArgumentError("Invalid boolean: $n"); | 1512 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1353 } | 1513 } |
| 1514 |
| 1354 if (query.length > 0) { | 1515 if (query.length > 0) { |
| 1355 for (var part in query.split("&")) { | 1516 for (var part in query.split("&")) { |
| 1356 var keyvalue = part.split("="); | 1517 var keyvalue = part.split("="); |
| 1357 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1518 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1519 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1358 } | 1520 } |
| 1359 } | 1521 } |
| 1360 | 1522 |
| 1361 | |
| 1362 var h = { | 1523 var h = { |
| 1363 "content-type" : "application/json; charset=utf-8", | 1524 "content-type": "application/json; charset=utf-8", |
| 1364 }; | 1525 }; |
| 1365 var resp = convert.JSON.encode(buildFindDevicesByOwnerResponse()); | 1526 var resp = convert.JSON.encode(buildFindDevicesByOwnerResponse()); |
| 1366 return new async.Future.value(stringResponse(200, h, resp)); | 1527 return new async.Future.value(stringResponse(200, h, resp)); |
| 1367 }), true); | 1528 }), true); |
| 1368 res.findByOwner(arg_request, arg_partnerId).then(unittest.expectAsync1(((a
pi.FindDevicesByOwnerResponse response) { | 1529 res.findByOwner(arg_request, arg_partnerId).then( |
| 1530 unittest.expectAsync1(((api.FindDevicesByOwnerResponse response) { |
| 1369 checkFindDevicesByOwnerResponse(response); | 1531 checkFindDevicesByOwnerResponse(response); |
| 1370 }))); | 1532 }))); |
| 1371 }); | 1533 }); |
| 1372 | 1534 |
| 1373 unittest.test("method--get", () { | 1535 unittest.test("method--get", () { |
| 1374 | |
| 1375 var mock = new HttpServerMock(); | 1536 var mock = new HttpServerMock(); |
| 1376 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1537 api.PartnersDevicesResourceApi res = |
| 1538 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1377 var arg_name = "foo"; | 1539 var arg_name = "foo"; |
| 1378 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1540 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1379 var path = (req.url).path; | 1541 var path = (req.url).path; |
| 1380 var pathOffset = 0; | 1542 var pathOffset = 0; |
| 1381 var index; | 1543 var index; |
| 1382 var subPart; | 1544 var subPart; |
| 1383 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1545 unittest.expect( |
| 1546 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1384 pathOffset += 1; | 1547 pathOffset += 1; |
| 1385 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1548 unittest.expect( |
| 1549 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1386 pathOffset += 3; | 1550 pathOffset += 3; |
| 1387 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1551 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1388 | 1552 |
| 1389 var query = (req.url).query; | 1553 var query = (req.url).query; |
| 1390 var queryOffset = 0; | 1554 var queryOffset = 0; |
| 1391 var queryMap = {}; | 1555 var queryMap = {}; |
| 1392 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1556 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1393 parseBool(n) { | 1557 parseBool(n) { |
| 1394 if (n == "true") return true; | 1558 if (n == "true") return true; |
| 1395 if (n == "false") return false; | 1559 if (n == "false") return false; |
| 1396 if (n == null) return null; | 1560 if (n == null) return null; |
| 1397 throw new core.ArgumentError("Invalid boolean: $n"); | 1561 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1398 } | 1562 } |
| 1563 |
| 1399 if (query.length > 0) { | 1564 if (query.length > 0) { |
| 1400 for (var part in query.split("&")) { | 1565 for (var part in query.split("&")) { |
| 1401 var keyvalue = part.split("="); | 1566 var keyvalue = part.split("="); |
| 1402 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1567 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1568 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1403 } | 1569 } |
| 1404 } | 1570 } |
| 1405 | 1571 |
| 1406 | |
| 1407 var h = { | 1572 var h = { |
| 1408 "content-type" : "application/json; charset=utf-8", | 1573 "content-type": "application/json; charset=utf-8", |
| 1409 }; | 1574 }; |
| 1410 var resp = convert.JSON.encode(buildDevice()); | 1575 var resp = convert.JSON.encode(buildDevice()); |
| 1411 return new async.Future.value(stringResponse(200, h, resp)); | 1576 return new async.Future.value(stringResponse(200, h, resp)); |
| 1412 }), true); | 1577 }), true); |
| 1413 res.get(arg_name).then(unittest.expectAsync1(((api.Device response) { | 1578 res.get(arg_name).then(unittest.expectAsync1(((api.Device response) { |
| 1414 checkDevice(response); | 1579 checkDevice(response); |
| 1415 }))); | 1580 }))); |
| 1416 }); | 1581 }); |
| 1417 | 1582 |
| 1418 unittest.test("method--metadata", () { | 1583 unittest.test("method--metadata", () { |
| 1419 | |
| 1420 var mock = new HttpServerMock(); | 1584 var mock = new HttpServerMock(); |
| 1421 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1585 api.PartnersDevicesResourceApi res = |
| 1586 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1422 var arg_request = buildUpdateDeviceMetadataRequest(); | 1587 var arg_request = buildUpdateDeviceMetadataRequest(); |
| 1423 var arg_metadataOwnerId = "foo"; | 1588 var arg_metadataOwnerId = "foo"; |
| 1424 var arg_deviceId = "foo"; | 1589 var arg_deviceId = "foo"; |
| 1425 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1590 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1426 var obj = new api.UpdateDeviceMetadataRequest.fromJson(json); | 1591 var obj = new api.UpdateDeviceMetadataRequest.fromJson(json); |
| 1427 checkUpdateDeviceMetadataRequest(obj); | 1592 checkUpdateDeviceMetadataRequest(obj); |
| 1428 | 1593 |
| 1429 var path = (req.url).path; | 1594 var path = (req.url).path; |
| 1430 var pathOffset = 0; | 1595 var pathOffset = 0; |
| 1431 var index; | 1596 var index; |
| 1432 var subPart; | 1597 var subPart; |
| 1433 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1598 unittest.expect( |
| 1599 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1434 pathOffset += 1; | 1600 pathOffset += 1; |
| 1435 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1601 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1602 unittest.equals("v1/partners/")); |
| 1436 pathOffset += 12; | 1603 pathOffset += 12; |
| 1437 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1604 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1438 | 1605 |
| 1439 var query = (req.url).query; | 1606 var query = (req.url).query; |
| 1440 var queryOffset = 0; | 1607 var queryOffset = 0; |
| 1441 var queryMap = {}; | 1608 var queryMap = {}; |
| 1442 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1609 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1443 parseBool(n) { | 1610 parseBool(n) { |
| 1444 if (n == "true") return true; | 1611 if (n == "true") return true; |
| 1445 if (n == "false") return false; | 1612 if (n == "false") return false; |
| 1446 if (n == null) return null; | 1613 if (n == null) return null; |
| 1447 throw new core.ArgumentError("Invalid boolean: $n"); | 1614 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1448 } | 1615 } |
| 1616 |
| 1449 if (query.length > 0) { | 1617 if (query.length > 0) { |
| 1450 for (var part in query.split("&")) { | 1618 for (var part in query.split("&")) { |
| 1451 var keyvalue = part.split("="); | 1619 var keyvalue = part.split("="); |
| 1452 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1620 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1621 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1453 } | 1622 } |
| 1454 } | 1623 } |
| 1455 | 1624 |
| 1456 | |
| 1457 var h = { | 1625 var h = { |
| 1458 "content-type" : "application/json; charset=utf-8", | 1626 "content-type": "application/json; charset=utf-8", |
| 1459 }; | 1627 }; |
| 1460 var resp = convert.JSON.encode(buildDeviceMetadata()); | 1628 var resp = convert.JSON.encode(buildDeviceMetadata()); |
| 1461 return new async.Future.value(stringResponse(200, h, resp)); | 1629 return new async.Future.value(stringResponse(200, h, resp)); |
| 1462 }), true); | 1630 }), true); |
| 1463 res.metadata(arg_request, arg_metadataOwnerId, arg_deviceId).then(unittest
.expectAsync1(((api.DeviceMetadata response) { | 1631 res |
| 1632 .metadata(arg_request, arg_metadataOwnerId, arg_deviceId) |
| 1633 .then(unittest.expectAsync1(((api.DeviceMetadata response) { |
| 1464 checkDeviceMetadata(response); | 1634 checkDeviceMetadata(response); |
| 1465 }))); | 1635 }))); |
| 1466 }); | 1636 }); |
| 1467 | 1637 |
| 1468 unittest.test("method--unclaim", () { | 1638 unittest.test("method--unclaim", () { |
| 1469 | |
| 1470 var mock = new HttpServerMock(); | 1639 var mock = new HttpServerMock(); |
| 1471 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1640 api.PartnersDevicesResourceApi res = |
| 1641 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1472 var arg_request = buildUnclaimDeviceRequest(); | 1642 var arg_request = buildUnclaimDeviceRequest(); |
| 1473 var arg_partnerId = "foo"; | 1643 var arg_partnerId = "foo"; |
| 1474 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1644 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1475 var obj = new api.UnclaimDeviceRequest.fromJson(json); | 1645 var obj = new api.UnclaimDeviceRequest.fromJson(json); |
| 1476 checkUnclaimDeviceRequest(obj); | 1646 checkUnclaimDeviceRequest(obj); |
| 1477 | 1647 |
| 1478 var path = (req.url).path; | 1648 var path = (req.url).path; |
| 1479 var pathOffset = 0; | 1649 var pathOffset = 0; |
| 1480 var index; | 1650 var index; |
| 1481 var subPart; | 1651 var subPart; |
| 1482 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1652 unittest.expect( |
| 1653 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1483 pathOffset += 1; | 1654 pathOffset += 1; |
| 1484 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1655 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1656 unittest.equals("v1/partners/")); |
| 1485 pathOffset += 12; | 1657 pathOffset += 12; |
| 1486 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1658 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1487 | 1659 |
| 1488 var query = (req.url).query; | 1660 var query = (req.url).query; |
| 1489 var queryOffset = 0; | 1661 var queryOffset = 0; |
| 1490 var queryMap = {}; | 1662 var queryMap = {}; |
| 1491 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1663 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1492 parseBool(n) { | 1664 parseBool(n) { |
| 1493 if (n == "true") return true; | 1665 if (n == "true") return true; |
| 1494 if (n == "false") return false; | 1666 if (n == "false") return false; |
| 1495 if (n == null) return null; | 1667 if (n == null) return null; |
| 1496 throw new core.ArgumentError("Invalid boolean: $n"); | 1668 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1497 } | 1669 } |
| 1670 |
| 1498 if (query.length > 0) { | 1671 if (query.length > 0) { |
| 1499 for (var part in query.split("&")) { | 1672 for (var part in query.split("&")) { |
| 1500 var keyvalue = part.split("="); | 1673 var keyvalue = part.split("="); |
| 1501 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1674 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1675 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1502 } | 1676 } |
| 1503 } | 1677 } |
| 1504 | 1678 |
| 1505 | |
| 1506 var h = { | 1679 var h = { |
| 1507 "content-type" : "application/json; charset=utf-8", | 1680 "content-type": "application/json; charset=utf-8", |
| 1508 }; | 1681 }; |
| 1509 var resp = convert.JSON.encode(buildEmpty()); | 1682 var resp = convert.JSON.encode(buildEmpty()); |
| 1510 return new async.Future.value(stringResponse(200, h, resp)); | 1683 return new async.Future.value(stringResponse(200, h, resp)); |
| 1511 }), true); | 1684 }), true); |
| 1512 res.unclaim(arg_request, arg_partnerId).then(unittest.expectAsync1(((api.E
mpty response) { | 1685 res |
| 1686 .unclaim(arg_request, arg_partnerId) |
| 1687 .then(unittest.expectAsync1(((api.Empty response) { |
| 1513 checkEmpty(response); | 1688 checkEmpty(response); |
| 1514 }))); | 1689 }))); |
| 1515 }); | 1690 }); |
| 1516 | 1691 |
| 1517 unittest.test("method--unclaimAsync", () { | 1692 unittest.test("method--unclaimAsync", () { |
| 1518 | |
| 1519 var mock = new HttpServerMock(); | 1693 var mock = new HttpServerMock(); |
| 1520 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1694 api.PartnersDevicesResourceApi res = |
| 1695 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1521 var arg_request = buildUnclaimDevicesRequest(); | 1696 var arg_request = buildUnclaimDevicesRequest(); |
| 1522 var arg_partnerId = "foo"; | 1697 var arg_partnerId = "foo"; |
| 1523 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1698 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1524 var obj = new api.UnclaimDevicesRequest.fromJson(json); | 1699 var obj = new api.UnclaimDevicesRequest.fromJson(json); |
| 1525 checkUnclaimDevicesRequest(obj); | 1700 checkUnclaimDevicesRequest(obj); |
| 1526 | 1701 |
| 1527 var path = (req.url).path; | 1702 var path = (req.url).path; |
| 1528 var pathOffset = 0; | 1703 var pathOffset = 0; |
| 1529 var index; | 1704 var index; |
| 1530 var subPart; | 1705 var subPart; |
| 1531 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1706 unittest.expect( |
| 1707 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1532 pathOffset += 1; | 1708 pathOffset += 1; |
| 1533 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1709 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1710 unittest.equals("v1/partners/")); |
| 1534 pathOffset += 12; | 1711 pathOffset += 12; |
| 1535 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1712 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1536 | 1713 |
| 1537 var query = (req.url).query; | 1714 var query = (req.url).query; |
| 1538 var queryOffset = 0; | 1715 var queryOffset = 0; |
| 1539 var queryMap = {}; | 1716 var queryMap = {}; |
| 1540 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1717 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1541 parseBool(n) { | 1718 parseBool(n) { |
| 1542 if (n == "true") return true; | 1719 if (n == "true") return true; |
| 1543 if (n == "false") return false; | 1720 if (n == "false") return false; |
| 1544 if (n == null) return null; | 1721 if (n == null) return null; |
| 1545 throw new core.ArgumentError("Invalid boolean: $n"); | 1722 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1546 } | 1723 } |
| 1724 |
| 1547 if (query.length > 0) { | 1725 if (query.length > 0) { |
| 1548 for (var part in query.split("&")) { | 1726 for (var part in query.split("&")) { |
| 1549 var keyvalue = part.split("="); | 1727 var keyvalue = part.split("="); |
| 1550 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1728 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1729 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1551 } | 1730 } |
| 1552 } | 1731 } |
| 1553 | 1732 |
| 1554 | |
| 1555 var h = { | 1733 var h = { |
| 1556 "content-type" : "application/json; charset=utf-8", | 1734 "content-type": "application/json; charset=utf-8", |
| 1557 }; | 1735 }; |
| 1558 var resp = convert.JSON.encode(buildOperation()); | 1736 var resp = convert.JSON.encode(buildOperation()); |
| 1559 return new async.Future.value(stringResponse(200, h, resp)); | 1737 return new async.Future.value(stringResponse(200, h, resp)); |
| 1560 }), true); | 1738 }), true); |
| 1561 res.unclaimAsync(arg_request, arg_partnerId).then(unittest.expectAsync1(((
api.Operation response) { | 1739 res |
| 1740 .unclaimAsync(arg_request, arg_partnerId) |
| 1741 .then(unittest.expectAsync1(((api.Operation response) { |
| 1562 checkOperation(response); | 1742 checkOperation(response); |
| 1563 }))); | 1743 }))); |
| 1564 }); | 1744 }); |
| 1565 | 1745 |
| 1566 unittest.test("method--updateMetadataAsync", () { | 1746 unittest.test("method--updateMetadataAsync", () { |
| 1567 | |
| 1568 var mock = new HttpServerMock(); | 1747 var mock = new HttpServerMock(); |
| 1569 api.PartnersDevicesResourceApi res = new api.AndroiddeviceprovisioningApi(
mock).partners.devices; | 1748 api.PartnersDevicesResourceApi res = |
| 1749 new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
| 1570 var arg_request = buildUpdateDeviceMetadataInBatchRequest(); | 1750 var arg_request = buildUpdateDeviceMetadataInBatchRequest(); |
| 1571 var arg_partnerId = "foo"; | 1751 var arg_partnerId = "foo"; |
| 1572 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1752 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1573 var obj = new api.UpdateDeviceMetadataInBatchRequest.fromJson(json); | 1753 var obj = new api.UpdateDeviceMetadataInBatchRequest.fromJson(json); |
| 1574 checkUpdateDeviceMetadataInBatchRequest(obj); | 1754 checkUpdateDeviceMetadataInBatchRequest(obj); |
| 1575 | 1755 |
| 1576 var path = (req.url).path; | 1756 var path = (req.url).path; |
| 1577 var pathOffset = 0; | 1757 var pathOffset = 0; |
| 1578 var index; | 1758 var index; |
| 1579 var subPart; | 1759 var subPart; |
| 1580 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1760 unittest.expect( |
| 1761 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1581 pathOffset += 1; | 1762 pathOffset += 1; |
| 1582 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("v1/partners/")); | 1763 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1764 unittest.equals("v1/partners/")); |
| 1583 pathOffset += 12; | 1765 pathOffset += 12; |
| 1584 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1766 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1585 | 1767 |
| 1586 var query = (req.url).query; | 1768 var query = (req.url).query; |
| 1587 var queryOffset = 0; | 1769 var queryOffset = 0; |
| 1588 var queryMap = {}; | 1770 var queryMap = {}; |
| 1589 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1771 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1590 parseBool(n) { | 1772 parseBool(n) { |
| 1591 if (n == "true") return true; | 1773 if (n == "true") return true; |
| 1592 if (n == "false") return false; | 1774 if (n == "false") return false; |
| 1593 if (n == null) return null; | 1775 if (n == null) return null; |
| 1594 throw new core.ArgumentError("Invalid boolean: $n"); | 1776 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1595 } | 1777 } |
| 1778 |
| 1596 if (query.length > 0) { | 1779 if (query.length > 0) { |
| 1597 for (var part in query.split("&")) { | 1780 for (var part in query.split("&")) { |
| 1598 var keyvalue = part.split("="); | 1781 var keyvalue = part.split("="); |
| 1599 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1782 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1783 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1600 } | 1784 } |
| 1601 } | 1785 } |
| 1602 | 1786 |
| 1603 | |
| 1604 var h = { | 1787 var h = { |
| 1605 "content-type" : "application/json; charset=utf-8", | 1788 "content-type": "application/json; charset=utf-8", |
| 1606 }; | 1789 }; |
| 1607 var resp = convert.JSON.encode(buildOperation()); | 1790 var resp = convert.JSON.encode(buildOperation()); |
| 1608 return new async.Future.value(stringResponse(200, h, resp)); | 1791 return new async.Future.value(stringResponse(200, h, resp)); |
| 1609 }), true); | 1792 }), true); |
| 1610 res.updateMetadataAsync(arg_request, arg_partnerId).then(unittest.expectAs
ync1(((api.Operation response) { | 1793 res |
| 1794 .updateMetadataAsync(arg_request, arg_partnerId) |
| 1795 .then(unittest.expectAsync1(((api.Operation response) { |
| 1611 checkOperation(response); | 1796 checkOperation(response); |
| 1612 }))); | 1797 }))); |
| 1613 }); | 1798 }); |
| 1614 | |
| 1615 }); | 1799 }); |
| 1616 | |
| 1617 | |
| 1618 } | 1800 } |
| 1619 | |
| OLD | NEW |