Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1 | library googleapis.androiddeviceprovisioning.v1.test; |
| 2 | |
| 3 | import "dart:core" as core; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 4 | import "dart:async" as async; |
| 5 | import "dart:convert" as convert; |
| 6 | |
| 7 | import 'package:http/http.dart' as http; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 8 | import 'package:test/test.dart' as unittest; |
| 9 | |
| 10 | import 'package:googleapis/androiddeviceprovisioning/v1.dart' as api; |
| 11 | |
| 12 | class HttpServerMock extends http.BaseClient { |
| 13 | core.Function _callback; |
| 14 | core.bool _expectJson; |
| 15 | |
| 16 | void register(core.Function callback, core.bool expectJson) { |
| 17 | _callback = callback; |
| 18 | _expectJson = expectJson; |
| 19 | } |
| 20 | |
| 21 | async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 22 | if (_expectJson) { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 23 | return request |
| 24 | .finalize() |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 25 | .transform(convert.UTF8.decoder) |
| 26 | .join('') |
| 27 | .then((core.String jsonString) { |
| 28 | if (jsonString.isEmpty) { |
| 29 | return _callback(request, null); |
| 30 | } else { |
| 31 | return _callback(request, convert.JSON.decode(jsonString)); |
| 32 | } |
| 33 | }); |
| 34 | } else { |
| 35 | var stream = request.finalize(); |
| 36 | if (stream == null) { |
| 37 | return _callback(request, []); |
| 38 | } else { |
| 39 | return stream.toBytes().then((data) { |
| 40 | return _callback(request, data); |
| 41 | }); |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 47 | http.StreamedResponse stringResponse(core.int status, |
| 48 | core.Map<core.String, core.String> headers, core.String body) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 49 | var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 50 | return new http.StreamedResponse(stream, status, headers: headers); |
| 51 | } |
| 52 | |
| 53 | core.int buildCounterClaimDeviceRequest = 0; |
| 54 | buildClaimDeviceRequest() { |
| 55 | var o = new api.ClaimDeviceRequest(); |
| 56 | buildCounterClaimDeviceRequest++; |
| 57 | if (buildCounterClaimDeviceRequest < 3) { |
| 58 | o.customerId = "foo"; |
| 59 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 60 | o.sectionType = "foo"; |
| 61 | } |
| 62 | buildCounterClaimDeviceRequest--; |
| 63 | return o; |
| 64 | } |
| 65 | |
| 66 | checkClaimDeviceRequest(api.ClaimDeviceRequest o) { |
| 67 | buildCounterClaimDeviceRequest++; |
| 68 | if (buildCounterClaimDeviceRequest < 3) { |
| 69 | unittest.expect(o.customerId, unittest.equals('foo')); |
| 70 | checkDeviceIdentifier(o.deviceIdentifier); |
| 71 | unittest.expect(o.sectionType, unittest.equals('foo')); |
| 72 | } |
| 73 | buildCounterClaimDeviceRequest--; |
| 74 | } |
| 75 | |
| 76 | core.int buildCounterClaimDeviceResponse = 0; |
| 77 | buildClaimDeviceResponse() { |
| 78 | var o = new api.ClaimDeviceResponse(); |
| 79 | buildCounterClaimDeviceResponse++; |
| 80 | if (buildCounterClaimDeviceResponse < 3) { |
| 81 | o.deviceId = "foo"; |
| 82 | o.deviceName = "foo"; |
| 83 | } |
| 84 | buildCounterClaimDeviceResponse--; |
| 85 | return o; |
| 86 | } |
| 87 | |
| 88 | checkClaimDeviceResponse(api.ClaimDeviceResponse o) { |
| 89 | buildCounterClaimDeviceResponse++; |
| 90 | if (buildCounterClaimDeviceResponse < 3) { |
| 91 | unittest.expect(o.deviceId, unittest.equals('foo')); |
| 92 | unittest.expect(o.deviceName, unittest.equals('foo')); |
| 93 | } |
| 94 | buildCounterClaimDeviceResponse--; |
| 95 | } |
| 96 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 97 | buildUnnamed31() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 98 | var o = new core.List<api.PartnerClaim>(); |
| 99 | o.add(buildPartnerClaim()); |
| 100 | o.add(buildPartnerClaim()); |
| 101 | return o; |
| 102 | } |
| 103 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 104 | checkUnnamed31(core.List<api.PartnerClaim> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 105 | unittest.expect(o, unittest.hasLength(2)); |
| 106 | checkPartnerClaim(o[0]); |
| 107 | checkPartnerClaim(o[1]); |
| 108 | } |
| 109 | |
| 110 | core.int buildCounterClaimDevicesRequest = 0; |
| 111 | buildClaimDevicesRequest() { |
| 112 | var o = new api.ClaimDevicesRequest(); |
| 113 | buildCounterClaimDevicesRequest++; |
| 114 | if (buildCounterClaimDevicesRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 115 | o.claims = buildUnnamed31(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 116 | } |
| 117 | buildCounterClaimDevicesRequest--; |
| 118 | return o; |
| 119 | } |
| 120 | |
| 121 | checkClaimDevicesRequest(api.ClaimDevicesRequest o) { |
| 122 | buildCounterClaimDevicesRequest++; |
| 123 | if (buildCounterClaimDevicesRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 124 | checkUnnamed31(o.claims); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 125 | } |
| 126 | buildCounterClaimDevicesRequest--; |
| 127 | } |
| 128 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 129 | buildUnnamed32() { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 130 | var o = new core.List<core.String>(); |
| 131 | o.add("foo"); |
| 132 | o.add("foo"); |
| 133 | return o; |
| 134 | } |
| 135 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 136 | checkUnnamed32(core.List<core.String> o) { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 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 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 142 | buildUnnamed33() { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 143 | var o = new core.List<core.String>(); |
| 144 | o.add("foo"); |
| 145 | o.add("foo"); |
| 146 | return o; |
| 147 | } |
| 148 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 149 | checkUnnamed33(core.List<core.String> o) { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 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 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 155 | core.int buildCounterCompany = 0; |
| 156 | buildCompany() { |
| 157 | var o = new api.Company(); |
| 158 | buildCounterCompany++; |
| 159 | if (buildCounterCompany < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 160 | o.adminEmails = buildUnnamed32(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 161 | o.companyId = "foo"; |
| 162 | o.companyName = "foo"; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 163 | o.name = "foo"; |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 164 | o.ownerEmails = buildUnnamed33(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 165 | } |
| 166 | buildCounterCompany--; |
| 167 | return o; |
| 168 | } |
| 169 | |
| 170 | checkCompany(api.Company o) { |
| 171 | buildCounterCompany++; |
| 172 | if (buildCounterCompany < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 173 | checkUnnamed32(o.adminEmails); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 174 | unittest.expect(o.companyId, unittest.equals('foo')); |
| 175 | unittest.expect(o.companyName, unittest.equals('foo')); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 176 | unittest.expect(o.name, unittest.equals('foo')); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 177 | checkUnnamed33(o.ownerEmails); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 178 | } |
| 179 | buildCounterCompany--; |
| 180 | } |
| 181 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 182 | core.int buildCounterConfiguration = 0; |
| 183 | buildConfiguration() { |
| 184 | var o = new api.Configuration(); |
| 185 | buildCounterConfiguration++; |
| 186 | if (buildCounterConfiguration < 3) { |
| 187 | o.companyName = "foo"; |
| 188 | o.configurationId = "foo"; |
| 189 | o.configurationName = "foo"; |
| 190 | o.contactEmail = "foo"; |
| 191 | o.contactPhone = "foo"; |
| 192 | o.customMessage = "foo"; |
| 193 | o.dpcExtras = "foo"; |
| 194 | o.dpcResourcePath = "foo"; |
| 195 | o.isDefault = true; |
| 196 | o.name = "foo"; |
| 197 | } |
| 198 | buildCounterConfiguration--; |
| 199 | return o; |
| 200 | } |
| 201 | |
| 202 | checkConfiguration(api.Configuration o) { |
| 203 | buildCounterConfiguration++; |
| 204 | if (buildCounterConfiguration < 3) { |
| 205 | unittest.expect(o.companyName, unittest.equals('foo')); |
| 206 | unittest.expect(o.configurationId, unittest.equals('foo')); |
| 207 | unittest.expect(o.configurationName, unittest.equals('foo')); |
| 208 | unittest.expect(o.contactEmail, unittest.equals('foo')); |
| 209 | unittest.expect(o.contactPhone, unittest.equals('foo')); |
| 210 | unittest.expect(o.customMessage, unittest.equals('foo')); |
| 211 | unittest.expect(o.dpcExtras, unittest.equals('foo')); |
| 212 | unittest.expect(o.dpcResourcePath, unittest.equals('foo')); |
| 213 | unittest.expect(o.isDefault, unittest.isTrue); |
| 214 | unittest.expect(o.name, unittest.equals('foo')); |
| 215 | } |
| 216 | buildCounterConfiguration--; |
| 217 | } |
| 218 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 219 | core.int buildCounterCreateCustomerRequest = 0; |
| 220 | buildCreateCustomerRequest() { |
| 221 | var o = new api.CreateCustomerRequest(); |
| 222 | buildCounterCreateCustomerRequest++; |
| 223 | if (buildCounterCreateCustomerRequest < 3) { |
| 224 | o.customer = buildCompany(); |
| 225 | } |
| 226 | buildCounterCreateCustomerRequest--; |
| 227 | return o; |
| 228 | } |
| 229 | |
| 230 | checkCreateCustomerRequest(api.CreateCustomerRequest o) { |
| 231 | buildCounterCreateCustomerRequest++; |
| 232 | if (buildCounterCreateCustomerRequest < 3) { |
| 233 | checkCompany(o.customer); |
| 234 | } |
| 235 | buildCounterCreateCustomerRequest--; |
| 236 | } |
| 237 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 238 | core.int buildCounterCustomerApplyConfigurationRequest = 0; |
| 239 | buildCustomerApplyConfigurationRequest() { |
| 240 | var o = new api.CustomerApplyConfigurationRequest(); |
| 241 | buildCounterCustomerApplyConfigurationRequest++; |
| 242 | if (buildCounterCustomerApplyConfigurationRequest < 3) { |
| 243 | o.configuration = "foo"; |
| 244 | o.device = buildDeviceReference(); |
| 245 | } |
| 246 | buildCounterCustomerApplyConfigurationRequest--; |
| 247 | return o; |
| 248 | } |
| 249 | |
| 250 | checkCustomerApplyConfigurationRequest( |
| 251 | api.CustomerApplyConfigurationRequest o) { |
| 252 | buildCounterCustomerApplyConfigurationRequest++; |
| 253 | if (buildCounterCustomerApplyConfigurationRequest < 3) { |
| 254 | unittest.expect(o.configuration, unittest.equals('foo')); |
| 255 | checkDeviceReference(o.device); |
| 256 | } |
| 257 | buildCounterCustomerApplyConfigurationRequest--; |
| 258 | } |
| 259 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 260 | buildUnnamed34() { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 261 | var o = new core.List<api.Configuration>(); |
| 262 | o.add(buildConfiguration()); |
| 263 | o.add(buildConfiguration()); |
| 264 | return o; |
| 265 | } |
| 266 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 267 | checkUnnamed34(core.List<api.Configuration> o) { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 268 | unittest.expect(o, unittest.hasLength(2)); |
| 269 | checkConfiguration(o[0]); |
| 270 | checkConfiguration(o[1]); |
| 271 | } |
| 272 | |
| 273 | core.int buildCounterCustomerListConfigurationsResponse = 0; |
| 274 | buildCustomerListConfigurationsResponse() { |
| 275 | var o = new api.CustomerListConfigurationsResponse(); |
| 276 | buildCounterCustomerListConfigurationsResponse++; |
| 277 | if (buildCounterCustomerListConfigurationsResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 278 | o.configurations = buildUnnamed34(); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 279 | } |
| 280 | buildCounterCustomerListConfigurationsResponse--; |
| 281 | return o; |
| 282 | } |
| 283 | |
| 284 | checkCustomerListConfigurationsResponse( |
| 285 | api.CustomerListConfigurationsResponse o) { |
| 286 | buildCounterCustomerListConfigurationsResponse++; |
| 287 | if (buildCounterCustomerListConfigurationsResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 288 | checkUnnamed34(o.configurations); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 289 | } |
| 290 | buildCounterCustomerListConfigurationsResponse--; |
| 291 | } |
| 292 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 293 | buildUnnamed35() { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 294 | var o = new core.List<api.Company>(); |
| 295 | o.add(buildCompany()); |
| 296 | o.add(buildCompany()); |
| 297 | return o; |
| 298 | } |
| 299 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 300 | checkUnnamed35(core.List<api.Company> o) { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 301 | unittest.expect(o, unittest.hasLength(2)); |
| 302 | checkCompany(o[0]); |
| 303 | checkCompany(o[1]); |
| 304 | } |
| 305 | |
| 306 | core.int buildCounterCustomerListCustomersResponse = 0; |
| 307 | buildCustomerListCustomersResponse() { |
| 308 | var o = new api.CustomerListCustomersResponse(); |
| 309 | buildCounterCustomerListCustomersResponse++; |
| 310 | if (buildCounterCustomerListCustomersResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 311 | o.customers = buildUnnamed35(); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 312 | o.nextPageToken = "foo"; |
| 313 | } |
| 314 | buildCounterCustomerListCustomersResponse--; |
| 315 | return o; |
| 316 | } |
| 317 | |
| 318 | checkCustomerListCustomersResponse(api.CustomerListCustomersResponse o) { |
| 319 | buildCounterCustomerListCustomersResponse++; |
| 320 | if (buildCounterCustomerListCustomersResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 321 | checkUnnamed35(o.customers); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 322 | unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 323 | } |
| 324 | buildCounterCustomerListCustomersResponse--; |
| 325 | } |
| 326 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 327 | buildUnnamed36() { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 328 | var o = new core.List<api.Device>(); |
| 329 | o.add(buildDevice()); |
| 330 | o.add(buildDevice()); |
| 331 | return o; |
| 332 | } |
| 333 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 334 | checkUnnamed36(core.List<api.Device> o) { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 335 | unittest.expect(o, unittest.hasLength(2)); |
| 336 | checkDevice(o[0]); |
| 337 | checkDevice(o[1]); |
| 338 | } |
| 339 | |
| 340 | core.int buildCounterCustomerListDevicesResponse = 0; |
| 341 | buildCustomerListDevicesResponse() { |
| 342 | var o = new api.CustomerListDevicesResponse(); |
| 343 | buildCounterCustomerListDevicesResponse++; |
| 344 | if (buildCounterCustomerListDevicesResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 345 | o.devices = buildUnnamed36(); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 346 | o.nextPageToken = "foo"; |
| 347 | } |
| 348 | buildCounterCustomerListDevicesResponse--; |
| 349 | return o; |
| 350 | } |
| 351 | |
| 352 | checkCustomerListDevicesResponse(api.CustomerListDevicesResponse o) { |
| 353 | buildCounterCustomerListDevicesResponse++; |
| 354 | if (buildCounterCustomerListDevicesResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 355 | checkUnnamed36(o.devices); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 356 | unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 357 | } |
| 358 | buildCounterCustomerListDevicesResponse--; |
| 359 | } |
| 360 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 361 | buildUnnamed37() { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 362 | var o = new core.List<api.Dpc>(); |
| 363 | o.add(buildDpc()); |
| 364 | o.add(buildDpc()); |
| 365 | return o; |
| 366 | } |
| 367 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 368 | checkUnnamed37(core.List<api.Dpc> o) { |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 369 | unittest.expect(o, unittest.hasLength(2)); |
| 370 | checkDpc(o[0]); |
| 371 | checkDpc(o[1]); |
| 372 | } |
| 373 | |
| 374 | core.int buildCounterCustomerListDpcsResponse = 0; |
| 375 | buildCustomerListDpcsResponse() { |
| 376 | var o = new api.CustomerListDpcsResponse(); |
| 377 | buildCounterCustomerListDpcsResponse++; |
| 378 | if (buildCounterCustomerListDpcsResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 379 | o.dpcs = buildUnnamed37(); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 380 | } |
| 381 | buildCounterCustomerListDpcsResponse--; |
| 382 | return o; |
| 383 | } |
| 384 | |
| 385 | checkCustomerListDpcsResponse(api.CustomerListDpcsResponse o) { |
| 386 | buildCounterCustomerListDpcsResponse++; |
| 387 | if (buildCounterCustomerListDpcsResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 388 | checkUnnamed37(o.dpcs); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 389 | } |
| 390 | buildCounterCustomerListDpcsResponse--; |
| 391 | } |
| 392 | |
| 393 | core.int buildCounterCustomerRemoveConfigurationRequest = 0; |
| 394 | buildCustomerRemoveConfigurationRequest() { |
| 395 | var o = new api.CustomerRemoveConfigurationRequest(); |
| 396 | buildCounterCustomerRemoveConfigurationRequest++; |
| 397 | if (buildCounterCustomerRemoveConfigurationRequest < 3) { |
| 398 | o.device = buildDeviceReference(); |
| 399 | } |
| 400 | buildCounterCustomerRemoveConfigurationRequest--; |
| 401 | return o; |
| 402 | } |
| 403 | |
| 404 | checkCustomerRemoveConfigurationRequest( |
| 405 | api.CustomerRemoveConfigurationRequest o) { |
| 406 | buildCounterCustomerRemoveConfigurationRequest++; |
| 407 | if (buildCounterCustomerRemoveConfigurationRequest < 3) { |
| 408 | checkDeviceReference(o.device); |
| 409 | } |
| 410 | buildCounterCustomerRemoveConfigurationRequest--; |
| 411 | } |
| 412 | |
| 413 | core.int buildCounterCustomerUnclaimDeviceRequest = 0; |
| 414 | buildCustomerUnclaimDeviceRequest() { |
| 415 | var o = new api.CustomerUnclaimDeviceRequest(); |
| 416 | buildCounterCustomerUnclaimDeviceRequest++; |
| 417 | if (buildCounterCustomerUnclaimDeviceRequest < 3) { |
| 418 | o.device = buildDeviceReference(); |
| 419 | } |
| 420 | buildCounterCustomerUnclaimDeviceRequest--; |
| 421 | return o; |
| 422 | } |
| 423 | |
| 424 | checkCustomerUnclaimDeviceRequest(api.CustomerUnclaimDeviceRequest o) { |
| 425 | buildCounterCustomerUnclaimDeviceRequest++; |
| 426 | if (buildCounterCustomerUnclaimDeviceRequest < 3) { |
| 427 | checkDeviceReference(o.device); |
| 428 | } |
| 429 | buildCounterCustomerUnclaimDeviceRequest--; |
| 430 | } |
| 431 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 432 | buildUnnamed38() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 433 | var o = new core.List<api.DeviceClaim>(); |
| 434 | o.add(buildDeviceClaim()); |
| 435 | o.add(buildDeviceClaim()); |
| 436 | return o; |
| 437 | } |
| 438 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 439 | checkUnnamed38(core.List<api.DeviceClaim> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 440 | unittest.expect(o, unittest.hasLength(2)); |
| 441 | checkDeviceClaim(o[0]); |
| 442 | checkDeviceClaim(o[1]); |
| 443 | } |
| 444 | |
| 445 | core.int buildCounterDevice = 0; |
| 446 | buildDevice() { |
| 447 | var o = new api.Device(); |
| 448 | buildCounterDevice++; |
| 449 | if (buildCounterDevice < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 450 | o.claims = buildUnnamed38(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 451 | o.configuration = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 452 | o.deviceId = "foo"; |
| 453 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 454 | o.deviceMetadata = buildDeviceMetadata(); |
| 455 | o.name = "foo"; |
| 456 | } |
| 457 | buildCounterDevice--; |
| 458 | return o; |
| 459 | } |
| 460 | |
| 461 | checkDevice(api.Device o) { |
| 462 | buildCounterDevice++; |
| 463 | if (buildCounterDevice < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 464 | checkUnnamed38(o.claims); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 465 | unittest.expect(o.configuration, unittest.equals('foo')); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 466 | unittest.expect(o.deviceId, unittest.equals('foo')); |
| 467 | checkDeviceIdentifier(o.deviceIdentifier); |
| 468 | checkDeviceMetadata(o.deviceMetadata); |
| 469 | unittest.expect(o.name, unittest.equals('foo')); |
| 470 | } |
| 471 | buildCounterDevice--; |
| 472 | } |
| 473 | |
| 474 | core.int buildCounterDeviceClaim = 0; |
| 475 | buildDeviceClaim() { |
| 476 | var o = new api.DeviceClaim(); |
| 477 | buildCounterDeviceClaim++; |
| 478 | if (buildCounterDeviceClaim < 3) { |
| 479 | o.ownerCompanyId = "foo"; |
| 480 | o.sectionType = "foo"; |
| 481 | } |
| 482 | buildCounterDeviceClaim--; |
| 483 | return o; |
| 484 | } |
| 485 | |
| 486 | checkDeviceClaim(api.DeviceClaim o) { |
| 487 | buildCounterDeviceClaim++; |
| 488 | if (buildCounterDeviceClaim < 3) { |
| 489 | unittest.expect(o.ownerCompanyId, unittest.equals('foo')); |
| 490 | unittest.expect(o.sectionType, unittest.equals('foo')); |
| 491 | } |
| 492 | buildCounterDeviceClaim--; |
| 493 | } |
| 494 | |
| 495 | core.int buildCounterDeviceIdentifier = 0; |
| 496 | buildDeviceIdentifier() { |
| 497 | var o = new api.DeviceIdentifier(); |
| 498 | buildCounterDeviceIdentifier++; |
| 499 | if (buildCounterDeviceIdentifier < 3) { |
| 500 | o.imei = "foo"; |
| 501 | o.manufacturer = "foo"; |
| 502 | o.meid = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 503 | o.serialNumber = "foo"; |
| 504 | } |
| 505 | buildCounterDeviceIdentifier--; |
| 506 | return o; |
| 507 | } |
| 508 | |
| 509 | checkDeviceIdentifier(api.DeviceIdentifier o) { |
| 510 | buildCounterDeviceIdentifier++; |
| 511 | if (buildCounterDeviceIdentifier < 3) { |
| 512 | unittest.expect(o.imei, unittest.equals('foo')); |
| 513 | unittest.expect(o.manufacturer, unittest.equals('foo')); |
| 514 | unittest.expect(o.meid, unittest.equals('foo')); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 515 | unittest.expect(o.serialNumber, unittest.equals('foo')); |
| 516 | } |
| 517 | buildCounterDeviceIdentifier--; |
| 518 | } |
| 519 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 520 | buildUnnamed39() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 521 | var o = new core.Map<core.String, core.String>(); |
| 522 | o["x"] = "foo"; |
| 523 | o["y"] = "foo"; |
| 524 | return o; |
| 525 | } |
| 526 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 527 | checkUnnamed39(core.Map<core.String, core.String> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 528 | unittest.expect(o, unittest.hasLength(2)); |
| 529 | unittest.expect(o["x"], unittest.equals('foo')); |
| 530 | unittest.expect(o["y"], unittest.equals('foo')); |
| 531 | } |
| 532 | |
| 533 | core.int buildCounterDeviceMetadata = 0; |
| 534 | buildDeviceMetadata() { |
| 535 | var o = new api.DeviceMetadata(); |
| 536 | buildCounterDeviceMetadata++; |
| 537 | if (buildCounterDeviceMetadata < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 538 | o.entries = buildUnnamed39(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 539 | } |
| 540 | buildCounterDeviceMetadata--; |
| 541 | return o; |
| 542 | } |
| 543 | |
| 544 | checkDeviceMetadata(api.DeviceMetadata o) { |
| 545 | buildCounterDeviceMetadata++; |
| 546 | if (buildCounterDeviceMetadata < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 547 | checkUnnamed39(o.entries); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 548 | } |
| 549 | buildCounterDeviceMetadata--; |
| 550 | } |
| 551 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 552 | core.int buildCounterDeviceReference = 0; |
| 553 | buildDeviceReference() { |
| 554 | var o = new api.DeviceReference(); |
| 555 | buildCounterDeviceReference++; |
| 556 | if (buildCounterDeviceReference < 3) { |
| 557 | o.deviceId = "foo"; |
| 558 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 559 | } |
| 560 | buildCounterDeviceReference--; |
| 561 | return o; |
| 562 | } |
| 563 | |
| 564 | checkDeviceReference(api.DeviceReference o) { |
| 565 | buildCounterDeviceReference++; |
| 566 | if (buildCounterDeviceReference < 3) { |
| 567 | unittest.expect(o.deviceId, unittest.equals('foo')); |
| 568 | checkDeviceIdentifier(o.deviceIdentifier); |
| 569 | } |
| 570 | buildCounterDeviceReference--; |
| 571 | } |
| 572 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 573 | core.int buildCounterDevicesLongRunningOperationMetadata = 0; |
| 574 | buildDevicesLongRunningOperationMetadata() { |
| 575 | var o = new api.DevicesLongRunningOperationMetadata(); |
| 576 | buildCounterDevicesLongRunningOperationMetadata++; |
| 577 | if (buildCounterDevicesLongRunningOperationMetadata < 3) { |
| 578 | o.devicesCount = 42; |
| 579 | o.processingStatus = "foo"; |
| 580 | o.progress = 42; |
| 581 | } |
| 582 | buildCounterDevicesLongRunningOperationMetadata--; |
| 583 | return o; |
| 584 | } |
| 585 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 586 | checkDevicesLongRunningOperationMetadata( |
| 587 | api.DevicesLongRunningOperationMetadata o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 588 | buildCounterDevicesLongRunningOperationMetadata++; |
| 589 | if (buildCounterDevicesLongRunningOperationMetadata < 3) { |
| 590 | unittest.expect(o.devicesCount, unittest.equals(42)); |
| 591 | unittest.expect(o.processingStatus, unittest.equals('foo')); |
| 592 | unittest.expect(o.progress, unittest.equals(42)); |
| 593 | } |
| 594 | buildCounterDevicesLongRunningOperationMetadata--; |
| 595 | } |
| 596 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 597 | buildUnnamed40() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 598 | var o = new core.List<api.OperationPerDevice>(); |
| 599 | o.add(buildOperationPerDevice()); |
| 600 | o.add(buildOperationPerDevice()); |
| 601 | return o; |
| 602 | } |
| 603 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 604 | checkUnnamed40(core.List<api.OperationPerDevice> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 605 | unittest.expect(o, unittest.hasLength(2)); |
| 606 | checkOperationPerDevice(o[0]); |
| 607 | checkOperationPerDevice(o[1]); |
| 608 | } |
| 609 | |
| 610 | core.int buildCounterDevicesLongRunningOperationResponse = 0; |
| 611 | buildDevicesLongRunningOperationResponse() { |
| 612 | var o = new api.DevicesLongRunningOperationResponse(); |
| 613 | buildCounterDevicesLongRunningOperationResponse++; |
| 614 | if (buildCounterDevicesLongRunningOperationResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 615 | o.perDeviceStatus = buildUnnamed40(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 616 | o.successCount = 42; |
| 617 | } |
| 618 | buildCounterDevicesLongRunningOperationResponse--; |
| 619 | return o; |
| 620 | } |
| 621 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 622 | checkDevicesLongRunningOperationResponse( |
| 623 | api.DevicesLongRunningOperationResponse o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 624 | buildCounterDevicesLongRunningOperationResponse++; |
| 625 | if (buildCounterDevicesLongRunningOperationResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 626 | checkUnnamed40(o.perDeviceStatus); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 627 | unittest.expect(o.successCount, unittest.equals(42)); |
| 628 | } |
| 629 | buildCounterDevicesLongRunningOperationResponse--; |
| 630 | } |
| 631 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 632 | core.int buildCounterDpc = 0; |
| 633 | buildDpc() { |
| 634 | var o = new api.Dpc(); |
| 635 | buildCounterDpc++; |
| 636 | if (buildCounterDpc < 3) { |
| 637 | o.dpcName = "foo"; |
| 638 | o.name = "foo"; |
| 639 | o.packageName = "foo"; |
| 640 | } |
| 641 | buildCounterDpc--; |
| 642 | return o; |
| 643 | } |
| 644 | |
| 645 | checkDpc(api.Dpc o) { |
| 646 | buildCounterDpc++; |
| 647 | if (buildCounterDpc < 3) { |
| 648 | unittest.expect(o.dpcName, unittest.equals('foo')); |
| 649 | unittest.expect(o.name, unittest.equals('foo')); |
| 650 | unittest.expect(o.packageName, unittest.equals('foo')); |
| 651 | } |
| 652 | buildCounterDpc--; |
| 653 | } |
| 654 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 655 | core.int buildCounterEmpty = 0; |
| 656 | buildEmpty() { |
| 657 | var o = new api.Empty(); |
| 658 | buildCounterEmpty++; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 659 | if (buildCounterEmpty < 3) {} |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 660 | buildCounterEmpty--; |
| 661 | return o; |
| 662 | } |
| 663 | |
| 664 | checkEmpty(api.Empty o) { |
| 665 | buildCounterEmpty++; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 666 | if (buildCounterEmpty < 3) {} |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 667 | buildCounterEmpty--; |
| 668 | } |
| 669 | |
| 670 | core.int buildCounterFindDevicesByDeviceIdentifierRequest = 0; |
| 671 | buildFindDevicesByDeviceIdentifierRequest() { |
| 672 | var o = new api.FindDevicesByDeviceIdentifierRequest(); |
| 673 | buildCounterFindDevicesByDeviceIdentifierRequest++; |
| 674 | if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) { |
| 675 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 676 | o.limit = "foo"; |
| 677 | o.pageToken = "foo"; |
| 678 | } |
| 679 | buildCounterFindDevicesByDeviceIdentifierRequest--; |
| 680 | return o; |
| 681 | } |
| 682 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 683 | checkFindDevicesByDeviceIdentifierRequest( |
| 684 | api.FindDevicesByDeviceIdentifierRequest o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 685 | buildCounterFindDevicesByDeviceIdentifierRequest++; |
| 686 | if (buildCounterFindDevicesByDeviceIdentifierRequest < 3) { |
| 687 | checkDeviceIdentifier(o.deviceIdentifier); |
| 688 | unittest.expect(o.limit, unittest.equals('foo')); |
| 689 | unittest.expect(o.pageToken, unittest.equals('foo')); |
| 690 | } |
| 691 | buildCounterFindDevicesByDeviceIdentifierRequest--; |
| 692 | } |
| 693 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 694 | buildUnnamed41() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 695 | var o = new core.List<api.Device>(); |
| 696 | o.add(buildDevice()); |
| 697 | o.add(buildDevice()); |
| 698 | return o; |
| 699 | } |
| 700 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 701 | checkUnnamed41(core.List<api.Device> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 702 | unittest.expect(o, unittest.hasLength(2)); |
| 703 | checkDevice(o[0]); |
| 704 | checkDevice(o[1]); |
| 705 | } |
| 706 | |
| 707 | core.int buildCounterFindDevicesByDeviceIdentifierResponse = 0; |
| 708 | buildFindDevicesByDeviceIdentifierResponse() { |
| 709 | var o = new api.FindDevicesByDeviceIdentifierResponse(); |
| 710 | buildCounterFindDevicesByDeviceIdentifierResponse++; |
| 711 | if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 712 | o.devices = buildUnnamed41(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 713 | o.nextPageToken = "foo"; |
| 714 | } |
| 715 | buildCounterFindDevicesByDeviceIdentifierResponse--; |
| 716 | return o; |
| 717 | } |
| 718 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 719 | checkFindDevicesByDeviceIdentifierResponse( |
| 720 | api.FindDevicesByDeviceIdentifierResponse o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 721 | buildCounterFindDevicesByDeviceIdentifierResponse++; |
| 722 | if (buildCounterFindDevicesByDeviceIdentifierResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 723 | checkUnnamed41(o.devices); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 724 | unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 725 | } |
| 726 | buildCounterFindDevicesByDeviceIdentifierResponse--; |
| 727 | } |
| 728 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 729 | buildUnnamed42() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 730 | var o = new core.List<core.String>(); |
| 731 | o.add("foo"); |
| 732 | o.add("foo"); |
| 733 | return o; |
| 734 | } |
| 735 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 736 | checkUnnamed42(core.List<core.String> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 737 | unittest.expect(o, unittest.hasLength(2)); |
| 738 | unittest.expect(o[0], unittest.equals('foo')); |
| 739 | unittest.expect(o[1], unittest.equals('foo')); |
| 740 | } |
| 741 | |
| 742 | core.int buildCounterFindDevicesByOwnerRequest = 0; |
| 743 | buildFindDevicesByOwnerRequest() { |
| 744 | var o = new api.FindDevicesByOwnerRequest(); |
| 745 | buildCounterFindDevicesByOwnerRequest++; |
| 746 | if (buildCounterFindDevicesByOwnerRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 747 | o.customerId = buildUnnamed42(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 748 | o.limit = "foo"; |
| 749 | o.pageToken = "foo"; |
| 750 | o.sectionType = "foo"; |
| 751 | } |
| 752 | buildCounterFindDevicesByOwnerRequest--; |
| 753 | return o; |
| 754 | } |
| 755 | |
| 756 | checkFindDevicesByOwnerRequest(api.FindDevicesByOwnerRequest o) { |
| 757 | buildCounterFindDevicesByOwnerRequest++; |
| 758 | if (buildCounterFindDevicesByOwnerRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 759 | checkUnnamed42(o.customerId); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 760 | unittest.expect(o.limit, unittest.equals('foo')); |
| 761 | unittest.expect(o.pageToken, unittest.equals('foo')); |
| 762 | unittest.expect(o.sectionType, unittest.equals('foo')); |
| 763 | } |
| 764 | buildCounterFindDevicesByOwnerRequest--; |
| 765 | } |
| 766 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 767 | buildUnnamed43() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 768 | var o = new core.List<api.Device>(); |
| 769 | o.add(buildDevice()); |
| 770 | o.add(buildDevice()); |
| 771 | return o; |
| 772 | } |
| 773 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 774 | checkUnnamed43(core.List<api.Device> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 775 | unittest.expect(o, unittest.hasLength(2)); |
| 776 | checkDevice(o[0]); |
| 777 | checkDevice(o[1]); |
| 778 | } |
| 779 | |
| 780 | core.int buildCounterFindDevicesByOwnerResponse = 0; |
| 781 | buildFindDevicesByOwnerResponse() { |
| 782 | var o = new api.FindDevicesByOwnerResponse(); |
| 783 | buildCounterFindDevicesByOwnerResponse++; |
| 784 | if (buildCounterFindDevicesByOwnerResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 785 | o.devices = buildUnnamed43(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 786 | o.nextPageToken = "foo"; |
| 787 | } |
| 788 | buildCounterFindDevicesByOwnerResponse--; |
| 789 | return o; |
| 790 | } |
| 791 | |
| 792 | checkFindDevicesByOwnerResponse(api.FindDevicesByOwnerResponse o) { |
| 793 | buildCounterFindDevicesByOwnerResponse++; |
| 794 | if (buildCounterFindDevicesByOwnerResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 795 | checkUnnamed43(o.devices); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 796 | unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 797 | } |
| 798 | buildCounterFindDevicesByOwnerResponse--; |
| 799 | } |
| 800 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 801 | buildUnnamed44() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 802 | var o = new core.List<api.Company>(); |
| 803 | o.add(buildCompany()); |
| 804 | o.add(buildCompany()); |
| 805 | return o; |
| 806 | } |
| 807 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 808 | checkUnnamed44(core.List<api.Company> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 809 | unittest.expect(o, unittest.hasLength(2)); |
| 810 | checkCompany(o[0]); |
| 811 | checkCompany(o[1]); |
| 812 | } |
| 813 | |
| 814 | core.int buildCounterListCustomersResponse = 0; |
| 815 | buildListCustomersResponse() { |
| 816 | var o = new api.ListCustomersResponse(); |
| 817 | buildCounterListCustomersResponse++; |
| 818 | if (buildCounterListCustomersResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 819 | o.customers = buildUnnamed44(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 820 | } |
| 821 | buildCounterListCustomersResponse--; |
| 822 | return o; |
| 823 | } |
| 824 | |
| 825 | checkListCustomersResponse(api.ListCustomersResponse o) { |
| 826 | buildCounterListCustomersResponse++; |
| 827 | if (buildCounterListCustomersResponse < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 828 | checkUnnamed44(o.customers); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 829 | } |
| 830 | buildCounterListCustomersResponse--; |
| 831 | } |
| 832 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 833 | buildUnnamed45() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 834 | var o = new core.Map<core.String, core.Object>(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 835 | o["x"] = { |
| 836 | 'list': [1, 2, 3], |
| 837 | 'bool': true, |
| 838 | 'string': 'foo' |
| 839 | }; |
| 840 | o["y"] = { |
| 841 | 'list': [1, 2, 3], |
| 842 | 'bool': true, |
| 843 | 'string': 'foo' |
| 844 | }; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 845 | return o; |
| 846 | } |
| 847 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 848 | checkUnnamed45(core.Map<core.String, core.Object> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 849 | unittest.expect(o, unittest.hasLength(2)); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 850 | var casted1 = (o["x"]) as core.Map; |
| 851 | unittest.expect(casted1, unittest.hasLength(3)); |
| 852 | unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); |
| 853 | unittest.expect(casted1["bool"], unittest.equals(true)); |
| 854 | unittest.expect(casted1["string"], unittest.equals('foo')); |
| 855 | var casted2 = (o["y"]) as core.Map; |
| 856 | unittest.expect(casted2, unittest.hasLength(3)); |
| 857 | unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); |
| 858 | unittest.expect(casted2["bool"], unittest.equals(true)); |
| 859 | unittest.expect(casted2["string"], unittest.equals('foo')); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 860 | } |
| 861 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 862 | buildUnnamed46() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 863 | var o = new core.Map<core.String, core.Object>(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 864 | o["x"] = { |
| 865 | 'list': [1, 2, 3], |
| 866 | 'bool': true, |
| 867 | 'string': 'foo' |
| 868 | }; |
| 869 | o["y"] = { |
| 870 | 'list': [1, 2, 3], |
| 871 | 'bool': true, |
| 872 | 'string': 'foo' |
| 873 | }; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 874 | return o; |
| 875 | } |
| 876 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 877 | checkUnnamed46(core.Map<core.String, core.Object> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 878 | unittest.expect(o, unittest.hasLength(2)); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 879 | var casted3 = (o["x"]) as core.Map; |
| 880 | unittest.expect(casted3, unittest.hasLength(3)); |
| 881 | unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); |
| 882 | unittest.expect(casted3["bool"], unittest.equals(true)); |
| 883 | unittest.expect(casted3["string"], unittest.equals('foo')); |
| 884 | var casted4 = (o["y"]) as core.Map; |
| 885 | unittest.expect(casted4, unittest.hasLength(3)); |
| 886 | unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); |
| 887 | unittest.expect(casted4["bool"], unittest.equals(true)); |
| 888 | unittest.expect(casted4["string"], unittest.equals('foo')); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | core.int buildCounterOperation = 0; |
| 892 | buildOperation() { |
| 893 | var o = new api.Operation(); |
| 894 | buildCounterOperation++; |
| 895 | if (buildCounterOperation < 3) { |
| 896 | o.done = true; |
| 897 | o.error = buildStatus(); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 898 | o.metadata = buildUnnamed45(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 899 | o.name = "foo"; |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 900 | o.response = buildUnnamed46(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 901 | } |
| 902 | buildCounterOperation--; |
| 903 | return o; |
| 904 | } |
| 905 | |
| 906 | checkOperation(api.Operation o) { |
| 907 | buildCounterOperation++; |
| 908 | if (buildCounterOperation < 3) { |
| 909 | unittest.expect(o.done, unittest.isTrue); |
| 910 | checkStatus(o.error); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 911 | checkUnnamed45(o.metadata); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 912 | unittest.expect(o.name, unittest.equals('foo')); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 913 | checkUnnamed46(o.response); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 914 | } |
| 915 | buildCounterOperation--; |
| 916 | } |
| 917 | |
| 918 | core.int buildCounterOperationPerDevice = 0; |
| 919 | buildOperationPerDevice() { |
| 920 | var o = new api.OperationPerDevice(); |
| 921 | buildCounterOperationPerDevice++; |
| 922 | if (buildCounterOperationPerDevice < 3) { |
| 923 | o.claim = buildPartnerClaim(); |
| 924 | o.result = buildPerDeviceStatusInBatch(); |
| 925 | o.unclaim = buildPartnerUnclaim(); |
| 926 | o.updateMetadata = buildUpdateMetadataArguments(); |
| 927 | } |
| 928 | buildCounterOperationPerDevice--; |
| 929 | return o; |
| 930 | } |
| 931 | |
| 932 | checkOperationPerDevice(api.OperationPerDevice o) { |
| 933 | buildCounterOperationPerDevice++; |
| 934 | if (buildCounterOperationPerDevice < 3) { |
| 935 | checkPartnerClaim(o.claim); |
| 936 | checkPerDeviceStatusInBatch(o.result); |
| 937 | checkPartnerUnclaim(o.unclaim); |
| 938 | checkUpdateMetadataArguments(o.updateMetadata); |
| 939 | } |
| 940 | buildCounterOperationPerDevice--; |
| 941 | } |
| 942 | |
| 943 | core.int buildCounterPartnerClaim = 0; |
| 944 | buildPartnerClaim() { |
| 945 | var o = new api.PartnerClaim(); |
| 946 | buildCounterPartnerClaim++; |
| 947 | if (buildCounterPartnerClaim < 3) { |
| 948 | o.customerId = "foo"; |
| 949 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 950 | o.deviceMetadata = buildDeviceMetadata(); |
| 951 | o.sectionType = "foo"; |
| 952 | } |
| 953 | buildCounterPartnerClaim--; |
| 954 | return o; |
| 955 | } |
| 956 | |
| 957 | checkPartnerClaim(api.PartnerClaim o) { |
| 958 | buildCounterPartnerClaim++; |
| 959 | if (buildCounterPartnerClaim < 3) { |
| 960 | unittest.expect(o.customerId, unittest.equals('foo')); |
| 961 | checkDeviceIdentifier(o.deviceIdentifier); |
| 962 | checkDeviceMetadata(o.deviceMetadata); |
| 963 | unittest.expect(o.sectionType, unittest.equals('foo')); |
| 964 | } |
| 965 | buildCounterPartnerClaim--; |
| 966 | } |
| 967 | |
| 968 | core.int buildCounterPartnerUnclaim = 0; |
| 969 | buildPartnerUnclaim() { |
| 970 | var o = new api.PartnerUnclaim(); |
| 971 | buildCounterPartnerUnclaim++; |
| 972 | if (buildCounterPartnerUnclaim < 3) { |
| 973 | o.deviceId = "foo"; |
| 974 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 975 | o.sectionType = "foo"; |
| 976 | } |
| 977 | buildCounterPartnerUnclaim--; |
| 978 | return o; |
| 979 | } |
| 980 | |
| 981 | checkPartnerUnclaim(api.PartnerUnclaim o) { |
| 982 | buildCounterPartnerUnclaim++; |
| 983 | if (buildCounterPartnerUnclaim < 3) { |
| 984 | unittest.expect(o.deviceId, unittest.equals('foo')); |
| 985 | checkDeviceIdentifier(o.deviceIdentifier); |
| 986 | unittest.expect(o.sectionType, unittest.equals('foo')); |
| 987 | } |
| 988 | buildCounterPartnerUnclaim--; |
| 989 | } |
| 990 | |
| 991 | core.int buildCounterPerDeviceStatusInBatch = 0; |
| 992 | buildPerDeviceStatusInBatch() { |
| 993 | var o = new api.PerDeviceStatusInBatch(); |
| 994 | buildCounterPerDeviceStatusInBatch++; |
| 995 | if (buildCounterPerDeviceStatusInBatch < 3) { |
| 996 | o.deviceId = "foo"; |
| 997 | o.errorIdentifier = "foo"; |
| 998 | o.errorMessage = "foo"; |
| 999 | o.status = "foo"; |
| 1000 | } |
| 1001 | buildCounterPerDeviceStatusInBatch--; |
| 1002 | return o; |
| 1003 | } |
| 1004 | |
| 1005 | checkPerDeviceStatusInBatch(api.PerDeviceStatusInBatch o) { |
| 1006 | buildCounterPerDeviceStatusInBatch++; |
| 1007 | if (buildCounterPerDeviceStatusInBatch < 3) { |
| 1008 | unittest.expect(o.deviceId, unittest.equals('foo')); |
| 1009 | unittest.expect(o.errorIdentifier, unittest.equals('foo')); |
| 1010 | unittest.expect(o.errorMessage, unittest.equals('foo')); |
| 1011 | unittest.expect(o.status, unittest.equals('foo')); |
| 1012 | } |
| 1013 | buildCounterPerDeviceStatusInBatch--; |
| 1014 | } |
| 1015 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1016 | buildUnnamed47() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1017 | var o = new core.Map<core.String, core.Object>(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 1018 | o["x"] = { |
| 1019 | 'list': [1, 2, 3], |
| 1020 | 'bool': true, |
| 1021 | 'string': 'foo' |
| 1022 | }; |
| 1023 | o["y"] = { |
| 1024 | 'list': [1, 2, 3], |
| 1025 | 'bool': true, |
| 1026 | 'string': 'foo' |
| 1027 | }; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1028 | return o; |
| 1029 | } |
| 1030 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1031 | checkUnnamed47(core.Map<core.String, core.Object> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1032 | unittest.expect(o, unittest.hasLength(2)); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 1033 | var casted5 = (o["x"]) as core.Map; |
| 1034 | unittest.expect(casted5, unittest.hasLength(3)); |
| 1035 | unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); |
| 1036 | unittest.expect(casted5["bool"], unittest.equals(true)); |
| 1037 | unittest.expect(casted5["string"], unittest.equals('foo')); |
| 1038 | var casted6 = (o["y"]) as core.Map; |
| 1039 | unittest.expect(casted6, unittest.hasLength(3)); |
| 1040 | unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); |
| 1041 | unittest.expect(casted6["bool"], unittest.equals(true)); |
| 1042 | unittest.expect(casted6["string"], unittest.equals('foo')); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1043 | } |
| 1044 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1045 | buildUnnamed48() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1046 | var o = new core.List<core.Map<core.String, core.Object>>(); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1047 | o.add(buildUnnamed47()); |
| 1048 | o.add(buildUnnamed47()); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1049 | return o; |
| 1050 | } |
| 1051 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1052 | checkUnnamed48(core.List<core.Map<core.String, core.Object>> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1053 | unittest.expect(o, unittest.hasLength(2)); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1054 | checkUnnamed47(o[0]); |
| 1055 | checkUnnamed47(o[1]); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1056 | } |
| 1057 | |
| 1058 | core.int buildCounterStatus = 0; |
| 1059 | buildStatus() { |
| 1060 | var o = new api.Status(); |
| 1061 | buildCounterStatus++; |
| 1062 | if (buildCounterStatus < 3) { |
| 1063 | o.code = 42; |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1064 | o.details = buildUnnamed48(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1065 | o.message = "foo"; |
| 1066 | } |
| 1067 | buildCounterStatus--; |
| 1068 | return o; |
| 1069 | } |
| 1070 | |
| 1071 | checkStatus(api.Status o) { |
| 1072 | buildCounterStatus++; |
| 1073 | if (buildCounterStatus < 3) { |
| 1074 | unittest.expect(o.code, unittest.equals(42)); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1075 | checkUnnamed48(o.details); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1076 | unittest.expect(o.message, unittest.equals('foo')); |
| 1077 | } |
| 1078 | buildCounterStatus--; |
| 1079 | } |
| 1080 | |
| 1081 | core.int buildCounterUnclaimDeviceRequest = 0; |
| 1082 | buildUnclaimDeviceRequest() { |
| 1083 | var o = new api.UnclaimDeviceRequest(); |
| 1084 | buildCounterUnclaimDeviceRequest++; |
| 1085 | if (buildCounterUnclaimDeviceRequest < 3) { |
| 1086 | o.deviceId = "foo"; |
| 1087 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 1088 | o.sectionType = "foo"; |
| 1089 | } |
| 1090 | buildCounterUnclaimDeviceRequest--; |
| 1091 | return o; |
| 1092 | } |
| 1093 | |
| 1094 | checkUnclaimDeviceRequest(api.UnclaimDeviceRequest o) { |
| 1095 | buildCounterUnclaimDeviceRequest++; |
| 1096 | if (buildCounterUnclaimDeviceRequest < 3) { |
| 1097 | unittest.expect(o.deviceId, unittest.equals('foo')); |
| 1098 | checkDeviceIdentifier(o.deviceIdentifier); |
| 1099 | unittest.expect(o.sectionType, unittest.equals('foo')); |
| 1100 | } |
| 1101 | buildCounterUnclaimDeviceRequest--; |
| 1102 | } |
| 1103 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1104 | buildUnnamed49() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1105 | var o = new core.List<api.PartnerUnclaim>(); |
| 1106 | o.add(buildPartnerUnclaim()); |
| 1107 | o.add(buildPartnerUnclaim()); |
| 1108 | return o; |
| 1109 | } |
| 1110 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1111 | checkUnnamed49(core.List<api.PartnerUnclaim> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1112 | unittest.expect(o, unittest.hasLength(2)); |
| 1113 | checkPartnerUnclaim(o[0]); |
| 1114 | checkPartnerUnclaim(o[1]); |
| 1115 | } |
| 1116 | |
| 1117 | core.int buildCounterUnclaimDevicesRequest = 0; |
| 1118 | buildUnclaimDevicesRequest() { |
| 1119 | var o = new api.UnclaimDevicesRequest(); |
| 1120 | buildCounterUnclaimDevicesRequest++; |
| 1121 | if (buildCounterUnclaimDevicesRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1122 | o.unclaims = buildUnnamed49(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1123 | } |
| 1124 | buildCounterUnclaimDevicesRequest--; |
| 1125 | return o; |
| 1126 | } |
| 1127 | |
| 1128 | checkUnclaimDevicesRequest(api.UnclaimDevicesRequest o) { |
| 1129 | buildCounterUnclaimDevicesRequest++; |
| 1130 | if (buildCounterUnclaimDevicesRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1131 | checkUnnamed49(o.unclaims); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1132 | } |
| 1133 | buildCounterUnclaimDevicesRequest--; |
| 1134 | } |
| 1135 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1136 | buildUnnamed50() { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1137 | var o = new core.List<api.UpdateMetadataArguments>(); |
| 1138 | o.add(buildUpdateMetadataArguments()); |
| 1139 | o.add(buildUpdateMetadataArguments()); |
| 1140 | return o; |
| 1141 | } |
| 1142 | |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1143 | checkUnnamed50(core.List<api.UpdateMetadataArguments> o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1144 | unittest.expect(o, unittest.hasLength(2)); |
| 1145 | checkUpdateMetadataArguments(o[0]); |
| 1146 | checkUpdateMetadataArguments(o[1]); |
| 1147 | } |
| 1148 | |
| 1149 | core.int buildCounterUpdateDeviceMetadataInBatchRequest = 0; |
| 1150 | buildUpdateDeviceMetadataInBatchRequest() { |
| 1151 | var o = new api.UpdateDeviceMetadataInBatchRequest(); |
| 1152 | buildCounterUpdateDeviceMetadataInBatchRequest++; |
| 1153 | if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1154 | o.updates = buildUnnamed50(); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1155 | } |
| 1156 | buildCounterUpdateDeviceMetadataInBatchRequest--; |
| 1157 | return o; |
| 1158 | } |
| 1159 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 1160 | checkUpdateDeviceMetadataInBatchRequest( |
| 1161 | api.UpdateDeviceMetadataInBatchRequest o) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1162 | buildCounterUpdateDeviceMetadataInBatchRequest++; |
| 1163 | if (buildCounterUpdateDeviceMetadataInBatchRequest < 3) { |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1164 | checkUnnamed50(o.updates); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1165 | } |
| 1166 | buildCounterUpdateDeviceMetadataInBatchRequest--; |
| 1167 | } |
| 1168 | |
| 1169 | core.int buildCounterUpdateDeviceMetadataRequest = 0; |
| 1170 | buildUpdateDeviceMetadataRequest() { |
| 1171 | var o = new api.UpdateDeviceMetadataRequest(); |
| 1172 | buildCounterUpdateDeviceMetadataRequest++; |
| 1173 | if (buildCounterUpdateDeviceMetadataRequest < 3) { |
| 1174 | o.deviceMetadata = buildDeviceMetadata(); |
| 1175 | } |
| 1176 | buildCounterUpdateDeviceMetadataRequest--; |
| 1177 | return o; |
| 1178 | } |
| 1179 | |
| 1180 | checkUpdateDeviceMetadataRequest(api.UpdateDeviceMetadataRequest o) { |
| 1181 | buildCounterUpdateDeviceMetadataRequest++; |
| 1182 | if (buildCounterUpdateDeviceMetadataRequest < 3) { |
| 1183 | checkDeviceMetadata(o.deviceMetadata); |
| 1184 | } |
| 1185 | buildCounterUpdateDeviceMetadataRequest--; |
| 1186 | } |
| 1187 | |
| 1188 | core.int buildCounterUpdateMetadataArguments = 0; |
| 1189 | buildUpdateMetadataArguments() { |
| 1190 | var o = new api.UpdateMetadataArguments(); |
| 1191 | buildCounterUpdateMetadataArguments++; |
| 1192 | if (buildCounterUpdateMetadataArguments < 3) { |
| 1193 | o.deviceId = "foo"; |
| 1194 | o.deviceIdentifier = buildDeviceIdentifier(); |
| 1195 | o.deviceMetadata = buildDeviceMetadata(); |
| 1196 | } |
| 1197 | buildCounterUpdateMetadataArguments--; |
| 1198 | return o; |
| 1199 | } |
| 1200 | |
| 1201 | checkUpdateMetadataArguments(api.UpdateMetadataArguments o) { |
| 1202 | buildCounterUpdateMetadataArguments++; |
| 1203 | if (buildCounterUpdateMetadataArguments < 3) { |
| 1204 | unittest.expect(o.deviceId, unittest.equals('foo')); |
| 1205 | checkDeviceIdentifier(o.deviceIdentifier); |
| 1206 | checkDeviceMetadata(o.deviceMetadata); |
| 1207 | } |
| 1208 | buildCounterUpdateMetadataArguments--; |
| 1209 | } |
| 1210 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1211 | main() { |
| 1212 | unittest.group("obj-schema-ClaimDeviceRequest", () { |
| 1213 | unittest.test("to-json--from-json", () { |
| 1214 | var o = buildClaimDeviceRequest(); |
| 1215 | var od = new api.ClaimDeviceRequest.fromJson(o.toJson()); |
| 1216 | checkClaimDeviceRequest(od); |
| 1217 | }); |
| 1218 | }); |
| 1219 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1220 | unittest.group("obj-schema-ClaimDeviceResponse", () { |
| 1221 | unittest.test("to-json--from-json", () { |
| 1222 | var o = buildClaimDeviceResponse(); |
| 1223 | var od = new api.ClaimDeviceResponse.fromJson(o.toJson()); |
| 1224 | checkClaimDeviceResponse(od); |
| 1225 | }); |
| 1226 | }); |
| 1227 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1228 | unittest.group("obj-schema-ClaimDevicesRequest", () { |
| 1229 | unittest.test("to-json--from-json", () { |
| 1230 | var o = buildClaimDevicesRequest(); |
| 1231 | var od = new api.ClaimDevicesRequest.fromJson(o.toJson()); |
| 1232 | checkClaimDevicesRequest(od); |
| 1233 | }); |
| 1234 | }); |
| 1235 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1236 | unittest.group("obj-schema-Company", () { |
| 1237 | unittest.test("to-json--from-json", () { |
| 1238 | var o = buildCompany(); |
| 1239 | var od = new api.Company.fromJson(o.toJson()); |
| 1240 | checkCompany(od); |
| 1241 | }); |
| 1242 | }); |
| 1243 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1244 | unittest.group("obj-schema-Configuration", () { |
| 1245 | unittest.test("to-json--from-json", () { |
| 1246 | var o = buildConfiguration(); |
| 1247 | var od = new api.Configuration.fromJson(o.toJson()); |
| 1248 | checkConfiguration(od); |
| 1249 | }); |
| 1250 | }); |
| 1251 | |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 1252 | unittest.group("obj-schema-CreateCustomerRequest", () { |
| 1253 | unittest.test("to-json--from-json", () { |
| 1254 | var o = buildCreateCustomerRequest(); |
| 1255 | var od = new api.CreateCustomerRequest.fromJson(o.toJson()); |
| 1256 | checkCreateCustomerRequest(od); |
| 1257 | }); |
| 1258 | }); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1259 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1260 | unittest.group("obj-schema-CustomerApplyConfigurationRequest", () { |
| 1261 | unittest.test("to-json--from-json", () { |
| 1262 | var o = buildCustomerApplyConfigurationRequest(); |
| 1263 | var od = new api.CustomerApplyConfigurationRequest.fromJson(o.toJson()); |
| 1264 | checkCustomerApplyConfigurationRequest(od); |
| 1265 | }); |
| 1266 | }); |
| 1267 | |
| 1268 | unittest.group("obj-schema-CustomerListConfigurationsResponse", () { |
| 1269 | unittest.test("to-json--from-json", () { |
| 1270 | var o = buildCustomerListConfigurationsResponse(); |
| 1271 | var od = new api.CustomerListConfigurationsResponse.fromJson(o.toJson()); |
| 1272 | checkCustomerListConfigurationsResponse(od); |
| 1273 | }); |
| 1274 | }); |
| 1275 | |
| 1276 | unittest.group("obj-schema-CustomerListCustomersResponse", () { |
| 1277 | unittest.test("to-json--from-json", () { |
| 1278 | var o = buildCustomerListCustomersResponse(); |
| 1279 | var od = new api.CustomerListCustomersResponse.fromJson(o.toJson()); |
| 1280 | checkCustomerListCustomersResponse(od); |
| 1281 | }); |
| 1282 | }); |
| 1283 | |
| 1284 | unittest.group("obj-schema-CustomerListDevicesResponse", () { |
| 1285 | unittest.test("to-json--from-json", () { |
| 1286 | var o = buildCustomerListDevicesResponse(); |
| 1287 | var od = new api.CustomerListDevicesResponse.fromJson(o.toJson()); |
| 1288 | checkCustomerListDevicesResponse(od); |
| 1289 | }); |
| 1290 | }); |
| 1291 | |
| 1292 | unittest.group("obj-schema-CustomerListDpcsResponse", () { |
| 1293 | unittest.test("to-json--from-json", () { |
| 1294 | var o = buildCustomerListDpcsResponse(); |
| 1295 | var od = new api.CustomerListDpcsResponse.fromJson(o.toJson()); |
| 1296 | checkCustomerListDpcsResponse(od); |
| 1297 | }); |
| 1298 | }); |
| 1299 | |
| 1300 | unittest.group("obj-schema-CustomerRemoveConfigurationRequest", () { |
| 1301 | unittest.test("to-json--from-json", () { |
| 1302 | var o = buildCustomerRemoveConfigurationRequest(); |
| 1303 | var od = new api.CustomerRemoveConfigurationRequest.fromJson(o.toJson()); |
| 1304 | checkCustomerRemoveConfigurationRequest(od); |
| 1305 | }); |
| 1306 | }); |
| 1307 | |
| 1308 | unittest.group("obj-schema-CustomerUnclaimDeviceRequest", () { |
| 1309 | unittest.test("to-json--from-json", () { |
| 1310 | var o = buildCustomerUnclaimDeviceRequest(); |
| 1311 | var od = new api.CustomerUnclaimDeviceRequest.fromJson(o.toJson()); |
| 1312 | checkCustomerUnclaimDeviceRequest(od); |
| 1313 | }); |
| 1314 | }); |
| 1315 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1316 | unittest.group("obj-schema-Device", () { |
| 1317 | unittest.test("to-json--from-json", () { |
| 1318 | var o = buildDevice(); |
| 1319 | var od = new api.Device.fromJson(o.toJson()); |
| 1320 | checkDevice(od); |
| 1321 | }); |
| 1322 | }); |
| 1323 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1324 | unittest.group("obj-schema-DeviceClaim", () { |
| 1325 | unittest.test("to-json--from-json", () { |
| 1326 | var o = buildDeviceClaim(); |
| 1327 | var od = new api.DeviceClaim.fromJson(o.toJson()); |
| 1328 | checkDeviceClaim(od); |
| 1329 | }); |
| 1330 | }); |
| 1331 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1332 | unittest.group("obj-schema-DeviceIdentifier", () { |
| 1333 | unittest.test("to-json--from-json", () { |
| 1334 | var o = buildDeviceIdentifier(); |
| 1335 | var od = new api.DeviceIdentifier.fromJson(o.toJson()); |
| 1336 | checkDeviceIdentifier(od); |
| 1337 | }); |
| 1338 | }); |
| 1339 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1340 | unittest.group("obj-schema-DeviceMetadata", () { |
| 1341 | unittest.test("to-json--from-json", () { |
| 1342 | var o = buildDeviceMetadata(); |
| 1343 | var od = new api.DeviceMetadata.fromJson(o.toJson()); |
| 1344 | checkDeviceMetadata(od); |
| 1345 | }); |
| 1346 | }); |
| 1347 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1348 | unittest.group("obj-schema-DeviceReference", () { |
| 1349 | unittest.test("to-json--from-json", () { |
| 1350 | var o = buildDeviceReference(); |
| 1351 | var od = new api.DeviceReference.fromJson(o.toJson()); |
| 1352 | checkDeviceReference(od); |
| 1353 | }); |
| 1354 | }); |
| 1355 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1356 | unittest.group("obj-schema-DevicesLongRunningOperationMetadata", () { |
| 1357 | unittest.test("to-json--from-json", () { |
| 1358 | var o = buildDevicesLongRunningOperationMetadata(); |
| 1359 | var od = new api.DevicesLongRunningOperationMetadata.fromJson(o.toJson()); |
| 1360 | checkDevicesLongRunningOperationMetadata(od); |
| 1361 | }); |
| 1362 | }); |
| 1363 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1364 | unittest.group("obj-schema-DevicesLongRunningOperationResponse", () { |
| 1365 | unittest.test("to-json--from-json", () { |
| 1366 | var o = buildDevicesLongRunningOperationResponse(); |
| 1367 | var od = new api.DevicesLongRunningOperationResponse.fromJson(o.toJson()); |
| 1368 | checkDevicesLongRunningOperationResponse(od); |
| 1369 | }); |
| 1370 | }); |
| 1371 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1372 | unittest.group("obj-schema-Dpc", () { |
| 1373 | unittest.test("to-json--from-json", () { |
| 1374 | var o = buildDpc(); |
| 1375 | var od = new api.Dpc.fromJson(o.toJson()); |
| 1376 | checkDpc(od); |
| 1377 | }); |
| 1378 | }); |
| 1379 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1380 | unittest.group("obj-schema-Empty", () { |
| 1381 | unittest.test("to-json--from-json", () { |
| 1382 | var o = buildEmpty(); |
| 1383 | var od = new api.Empty.fromJson(o.toJson()); |
| 1384 | checkEmpty(od); |
| 1385 | }); |
| 1386 | }); |
| 1387 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1388 | unittest.group("obj-schema-FindDevicesByDeviceIdentifierRequest", () { |
| 1389 | unittest.test("to-json--from-json", () { |
| 1390 | var o = buildFindDevicesByDeviceIdentifierRequest(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 1391 | var od = |
| 1392 | new api.FindDevicesByDeviceIdentifierRequest.fromJson(o.toJson()); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1393 | checkFindDevicesByDeviceIdentifierRequest(od); |
| 1394 | }); |
| 1395 | }); |
| 1396 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1397 | unittest.group("obj-schema-FindDevicesByDeviceIdentifierResponse", () { |
| 1398 | unittest.test("to-json--from-json", () { |
| 1399 | var o = buildFindDevicesByDeviceIdentifierResponse(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 1400 | var od = |
| 1401 | new api.FindDevicesByDeviceIdentifierResponse.fromJson(o.toJson()); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1402 | checkFindDevicesByDeviceIdentifierResponse(od); |
| 1403 | }); |
| 1404 | }); |
| 1405 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1406 | unittest.group("obj-schema-FindDevicesByOwnerRequest", () { |
| 1407 | unittest.test("to-json--from-json", () { |
| 1408 | var o = buildFindDevicesByOwnerRequest(); |
| 1409 | var od = new api.FindDevicesByOwnerRequest.fromJson(o.toJson()); |
| 1410 | checkFindDevicesByOwnerRequest(od); |
| 1411 | }); |
| 1412 | }); |
| 1413 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1414 | unittest.group("obj-schema-FindDevicesByOwnerResponse", () { |
| 1415 | unittest.test("to-json--from-json", () { |
| 1416 | var o = buildFindDevicesByOwnerResponse(); |
| 1417 | var od = new api.FindDevicesByOwnerResponse.fromJson(o.toJson()); |
| 1418 | checkFindDevicesByOwnerResponse(od); |
| 1419 | }); |
| 1420 | }); |
| 1421 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1422 | unittest.group("obj-schema-ListCustomersResponse", () { |
| 1423 | unittest.test("to-json--from-json", () { |
| 1424 | var o = buildListCustomersResponse(); |
| 1425 | var od = new api.ListCustomersResponse.fromJson(o.toJson()); |
| 1426 | checkListCustomersResponse(od); |
| 1427 | }); |
| 1428 | }); |
| 1429 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1430 | unittest.group("obj-schema-Operation", () { |
| 1431 | unittest.test("to-json--from-json", () { |
| 1432 | var o = buildOperation(); |
| 1433 | var od = new api.Operation.fromJson(o.toJson()); |
| 1434 | checkOperation(od); |
| 1435 | }); |
| 1436 | }); |
| 1437 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1438 | unittest.group("obj-schema-OperationPerDevice", () { |
| 1439 | unittest.test("to-json--from-json", () { |
| 1440 | var o = buildOperationPerDevice(); |
| 1441 | var od = new api.OperationPerDevice.fromJson(o.toJson()); |
| 1442 | checkOperationPerDevice(od); |
| 1443 | }); |
| 1444 | }); |
| 1445 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1446 | unittest.group("obj-schema-PartnerClaim", () { |
| 1447 | unittest.test("to-json--from-json", () { |
| 1448 | var o = buildPartnerClaim(); |
| 1449 | var od = new api.PartnerClaim.fromJson(o.toJson()); |
| 1450 | checkPartnerClaim(od); |
| 1451 | }); |
| 1452 | }); |
| 1453 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1454 | unittest.group("obj-schema-PartnerUnclaim", () { |
| 1455 | unittest.test("to-json--from-json", () { |
| 1456 | var o = buildPartnerUnclaim(); |
| 1457 | var od = new api.PartnerUnclaim.fromJson(o.toJson()); |
| 1458 | checkPartnerUnclaim(od); |
| 1459 | }); |
| 1460 | }); |
| 1461 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1462 | unittest.group("obj-schema-PerDeviceStatusInBatch", () { |
| 1463 | unittest.test("to-json--from-json", () { |
| 1464 | var o = buildPerDeviceStatusInBatch(); |
| 1465 | var od = new api.PerDeviceStatusInBatch.fromJson(o.toJson()); |
| 1466 | checkPerDeviceStatusInBatch(od); |
| 1467 | }); |
| 1468 | }); |
| 1469 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1470 | unittest.group("obj-schema-Status", () { |
| 1471 | unittest.test("to-json--from-json", () { |
| 1472 | var o = buildStatus(); |
| 1473 | var od = new api.Status.fromJson(o.toJson()); |
| 1474 | checkStatus(od); |
| 1475 | }); |
| 1476 | }); |
| 1477 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1478 | unittest.group("obj-schema-UnclaimDeviceRequest", () { |
| 1479 | unittest.test("to-json--from-json", () { |
| 1480 | var o = buildUnclaimDeviceRequest(); |
| 1481 | var od = new api.UnclaimDeviceRequest.fromJson(o.toJson()); |
| 1482 | checkUnclaimDeviceRequest(od); |
| 1483 | }); |
| 1484 | }); |
| 1485 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1486 | unittest.group("obj-schema-UnclaimDevicesRequest", () { |
| 1487 | unittest.test("to-json--from-json", () { |
| 1488 | var o = buildUnclaimDevicesRequest(); |
| 1489 | var od = new api.UnclaimDevicesRequest.fromJson(o.toJson()); |
| 1490 | checkUnclaimDevicesRequest(od); |
| 1491 | }); |
| 1492 | }); |
| 1493 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1494 | unittest.group("obj-schema-UpdateDeviceMetadataInBatchRequest", () { |
| 1495 | unittest.test("to-json--from-json", () { |
| 1496 | var o = buildUpdateDeviceMetadataInBatchRequest(); |
| 1497 | var od = new api.UpdateDeviceMetadataInBatchRequest.fromJson(o.toJson()); |
| 1498 | checkUpdateDeviceMetadataInBatchRequest(od); |
| 1499 | }); |
| 1500 | }); |
| 1501 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1502 | unittest.group("obj-schema-UpdateDeviceMetadataRequest", () { |
| 1503 | unittest.test("to-json--from-json", () { |
| 1504 | var o = buildUpdateDeviceMetadataRequest(); |
| 1505 | var od = new api.UpdateDeviceMetadataRequest.fromJson(o.toJson()); |
| 1506 | checkUpdateDeviceMetadataRequest(od); |
| 1507 | }); |
| 1508 | }); |
| 1509 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 1510 | unittest.group("obj-schema-UpdateMetadataArguments", () { |
| 1511 | unittest.test("to-json--from-json", () { |
| 1512 | var o = buildUpdateMetadataArguments(); |
| 1513 | var od = new api.UpdateMetadataArguments.fromJson(o.toJson()); |
| 1514 | checkUpdateMetadataArguments(od); |
| 1515 | }); |
| 1516 | }); |
| 1517 | |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1518 | unittest.group("resource-CustomersResourceApi", () { |
| 1519 | unittest.test("method--list", () { |
| 1520 | var mock = new HttpServerMock(); |
| 1521 | api.CustomersResourceApi res = |
| 1522 | new api.AndroiddeviceprovisioningApi(mock).customers; |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1523 | var arg_pageSize = 42; |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1524 | var arg_pageToken = "foo"; |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1525 | var arg_$fields = "foo"; |
| 1526 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1527 | var path = (req.url).path; |
| 1528 | var pathOffset = 0; |
| 1529 | var index; |
| 1530 | var subPart; |
| 1531 | unittest.expect( |
| 1532 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1533 | pathOffset += 1; |
| 1534 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1535 | unittest.equals("v1/customers")); |
| 1536 | pathOffset += 12; |
| 1537 | |
| 1538 | var query = (req.url).query; |
| 1539 | var queryOffset = 0; |
| 1540 | var queryMap = {}; |
| 1541 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1542 | parseBool(n) { |
| 1543 | if (n == "true") return true; |
| 1544 | if (n == "false") return false; |
| 1545 | if (n == null) return null; |
| 1546 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1547 | } |
| 1548 | |
| 1549 | if (query.length > 0) { |
| 1550 | for (var part in query.split("&")) { |
| 1551 | var keyvalue = part.split("="); |
| 1552 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1553 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1554 | } |
| 1555 | } |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1556 | unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1557 | unittest.equals(arg_pageSize)); |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1558 | unittest.expect( |
| 1559 | queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1560 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1561 | |
| 1562 | var h = { |
| 1563 | "content-type": "application/json; charset=utf-8", |
| 1564 | }; |
| 1565 | var resp = convert.JSON.encode(buildCustomerListCustomersResponse()); |
| 1566 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1567 | }), true); |
| 1568 | res |
| 1569 | .list( |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1570 | pageSize: arg_pageSize, |
Martin Kustermann | 67f25a2 | 2018-01-26 23:31:34 +0100 | [diff] [blame^] | 1571 | pageToken: arg_pageToken, |
Martin Kustermann | f9109a8 | 2018-01-08 15:24:20 +0100 | [diff] [blame] | 1572 | $fields: arg_$fields) |
| 1573 | .then(unittest |
| 1574 | .expectAsync1(((api.CustomerListCustomersResponse response) { |
| 1575 | checkCustomerListCustomersResponse(response); |
| 1576 | }))); |
| 1577 | }); |
| 1578 | }); |
| 1579 | |
| 1580 | unittest.group("resource-CustomersConfigurationsResourceApi", () { |
| 1581 | unittest.test("method--create", () { |
| 1582 | var mock = new HttpServerMock(); |
| 1583 | api.CustomersConfigurationsResourceApi res = |
| 1584 | new api.AndroiddeviceprovisioningApi(mock).customers.configurations; |
| 1585 | var arg_request = buildConfiguration(); |
| 1586 | var arg_parent = "foo"; |
| 1587 | var arg_$fields = "foo"; |
| 1588 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1589 | var obj = new api.Configuration.fromJson(json); |
| 1590 | checkConfiguration(obj); |
| 1591 | |
| 1592 | var path = (req.url).path; |
| 1593 | var pathOffset = 0; |
| 1594 | var index; |
| 1595 | var subPart; |
| 1596 | unittest.expect( |
| 1597 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1598 | pathOffset += 1; |
| 1599 | unittest.expect( |
| 1600 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1601 | pathOffset += 3; |
| 1602 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1603 | |
| 1604 | var query = (req.url).query; |
| 1605 | var queryOffset = 0; |
| 1606 | var queryMap = {}; |
| 1607 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1608 | parseBool(n) { |
| 1609 | if (n == "true") return true; |
| 1610 | if (n == "false") return false; |
| 1611 | if (n == null) return null; |
| 1612 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1613 | } |
| 1614 | |
| 1615 | if (query.length > 0) { |
| 1616 | for (var part in query.split("&")) { |
| 1617 | var keyvalue = part.split("="); |
| 1618 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1619 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1620 | } |
| 1621 | } |
| 1622 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1623 | |
| 1624 | var h = { |
| 1625 | "content-type": "application/json; charset=utf-8", |
| 1626 | }; |
| 1627 | var resp = convert.JSON.encode(buildConfiguration()); |
| 1628 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1629 | }), true); |
| 1630 | res |
| 1631 | .create(arg_request, arg_parent, $fields: arg_$fields) |
| 1632 | .then(unittest.expectAsync1(((api.Configuration response) { |
| 1633 | checkConfiguration(response); |
| 1634 | }))); |
| 1635 | }); |
| 1636 | |
| 1637 | unittest.test("method--delete", () { |
| 1638 | var mock = new HttpServerMock(); |
| 1639 | api.CustomersConfigurationsResourceApi res = |
| 1640 | new api.AndroiddeviceprovisioningApi(mock).customers.configurations; |
| 1641 | var arg_name = "foo"; |
| 1642 | var arg_$fields = "foo"; |
| 1643 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1644 | var path = (req.url).path; |
| 1645 | var pathOffset = 0; |
| 1646 | var index; |
| 1647 | var subPart; |
| 1648 | unittest.expect( |
| 1649 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1650 | pathOffset += 1; |
| 1651 | unittest.expect( |
| 1652 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1653 | pathOffset += 3; |
| 1654 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1655 | |
| 1656 | var query = (req.url).query; |
| 1657 | var queryOffset = 0; |
| 1658 | var queryMap = {}; |
| 1659 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1660 | parseBool(n) { |
| 1661 | if (n == "true") return true; |
| 1662 | if (n == "false") return false; |
| 1663 | if (n == null) return null; |
| 1664 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1665 | } |
| 1666 | |
| 1667 | if (query.length > 0) { |
| 1668 | for (var part in query.split("&")) { |
| 1669 | var keyvalue = part.split("="); |
| 1670 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1671 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1672 | } |
| 1673 | } |
| 1674 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1675 | |
| 1676 | var h = { |
| 1677 | "content-type": "application/json; charset=utf-8", |
| 1678 | }; |
| 1679 | var resp = convert.JSON.encode(buildEmpty()); |
| 1680 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1681 | }), true); |
| 1682 | res |
| 1683 | .delete(arg_name, $fields: arg_$fields) |
| 1684 | .then(unittest.expectAsync1(((api.Empty response) { |
| 1685 | checkEmpty(response); |
| 1686 | }))); |
| 1687 | }); |
| 1688 | |
| 1689 | unittest.test("method--get", () { |
| 1690 | var mock = new HttpServerMock(); |
| 1691 | api.CustomersConfigurationsResourceApi res = |
| 1692 | new api.AndroiddeviceprovisioningApi(mock).customers.configurations; |
| 1693 | var arg_name = "foo"; |
| 1694 | var arg_$fields = "foo"; |
| 1695 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1696 | var path = (req.url).path; |
| 1697 | var pathOffset = 0; |
| 1698 | var index; |
| 1699 | var subPart; |
| 1700 | unittest.expect( |
| 1701 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1702 | pathOffset += 1; |
| 1703 | unittest.expect( |
| 1704 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1705 | pathOffset += 3; |
| 1706 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1707 | |
| 1708 | var query = (req.url).query; |
| 1709 | var queryOffset = 0; |
| 1710 | var queryMap = {}; |
| 1711 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1712 | parseBool(n) { |
| 1713 | if (n == "true") return true; |
| 1714 | if (n == "false") return false; |
| 1715 | if (n == null) return null; |
| 1716 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1717 | } |
| 1718 | |
| 1719 | if (query.length > 0) { |
| 1720 | for (var part in query.split("&")) { |
| 1721 | var keyvalue = part.split("="); |
| 1722 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1723 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1724 | } |
| 1725 | } |
| 1726 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1727 | |
| 1728 | var h = { |
| 1729 | "content-type": "application/json; charset=utf-8", |
| 1730 | }; |
| 1731 | var resp = convert.JSON.encode(buildConfiguration()); |
| 1732 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1733 | }), true); |
| 1734 | res |
| 1735 | .get(arg_name, $fields: arg_$fields) |
| 1736 | .then(unittest.expectAsync1(((api.Configuration response) { |
| 1737 | checkConfiguration(response); |
| 1738 | }))); |
| 1739 | }); |
| 1740 | |
| 1741 | unittest.test("method--list", () { |
| 1742 | var mock = new HttpServerMock(); |
| 1743 | api.CustomersConfigurationsResourceApi res = |
| 1744 | new api.AndroiddeviceprovisioningApi(mock).customers.configurations; |
| 1745 | var arg_parent = "foo"; |
| 1746 | var arg_$fields = "foo"; |
| 1747 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1748 | var path = (req.url).path; |
| 1749 | var pathOffset = 0; |
| 1750 | var index; |
| 1751 | var subPart; |
| 1752 | unittest.expect( |
| 1753 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1754 | pathOffset += 1; |
| 1755 | unittest.expect( |
| 1756 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1757 | pathOffset += 3; |
| 1758 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1759 | |
| 1760 | var query = (req.url).query; |
| 1761 | var queryOffset = 0; |
| 1762 | var queryMap = {}; |
| 1763 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1764 | parseBool(n) { |
| 1765 | if (n == "true") return true; |
| 1766 | if (n == "false") return false; |
| 1767 | if (n == null) return null; |
| 1768 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1769 | } |
| 1770 | |
| 1771 | if (query.length > 0) { |
| 1772 | for (var part in query.split("&")) { |
| 1773 | var keyvalue = part.split("="); |
| 1774 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1775 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1776 | } |
| 1777 | } |
| 1778 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1779 | |
| 1780 | var h = { |
| 1781 | "content-type": "application/json; charset=utf-8", |
| 1782 | }; |
| 1783 | var resp = |
| 1784 | convert.JSON.encode(buildCustomerListConfigurationsResponse()); |
| 1785 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1786 | }), true); |
| 1787 | res.list(arg_parent, $fields: arg_$fields).then(unittest |
| 1788 | .expectAsync1(((api.CustomerListConfigurationsResponse response) { |
| 1789 | checkCustomerListConfigurationsResponse(response); |
| 1790 | }))); |
| 1791 | }); |
| 1792 | |
| 1793 | unittest.test("method--patch", () { |
| 1794 | var mock = new HttpServerMock(); |
| 1795 | api.CustomersConfigurationsResourceApi res = |
| 1796 | new api.AndroiddeviceprovisioningApi(mock).customers.configurations; |
| 1797 | var arg_request = buildConfiguration(); |
| 1798 | var arg_name = "foo"; |
| 1799 | var arg_updateMask = "foo"; |
| 1800 | var arg_$fields = "foo"; |
| 1801 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1802 | var obj = new api.Configuration.fromJson(json); |
| 1803 | checkConfiguration(obj); |
| 1804 | |
| 1805 | var path = (req.url).path; |
| 1806 | var pathOffset = 0; |
| 1807 | var index; |
| 1808 | var subPart; |
| 1809 | unittest.expect( |
| 1810 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1811 | pathOffset += 1; |
| 1812 | unittest.expect( |
| 1813 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1814 | pathOffset += 3; |
| 1815 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1816 | |
| 1817 | var query = (req.url).query; |
| 1818 | var queryOffset = 0; |
| 1819 | var queryMap = {}; |
| 1820 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1821 | parseBool(n) { |
| 1822 | if (n == "true") return true; |
| 1823 | if (n == "false") return false; |
| 1824 | if (n == null) return null; |
| 1825 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1826 | } |
| 1827 | |
| 1828 | if (query.length > 0) { |
| 1829 | for (var part in query.split("&")) { |
| 1830 | var keyvalue = part.split("="); |
| 1831 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1832 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1833 | } |
| 1834 | } |
| 1835 | unittest.expect( |
| 1836 | queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
| 1837 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1838 | |
| 1839 | var h = { |
| 1840 | "content-type": "application/json; charset=utf-8", |
| 1841 | }; |
| 1842 | var resp = convert.JSON.encode(buildConfiguration()); |
| 1843 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1844 | }), true); |
| 1845 | res |
| 1846 | .patch(arg_request, arg_name, |
| 1847 | updateMask: arg_updateMask, $fields: arg_$fields) |
| 1848 | .then(unittest.expectAsync1(((api.Configuration response) { |
| 1849 | checkConfiguration(response); |
| 1850 | }))); |
| 1851 | }); |
| 1852 | }); |
| 1853 | |
| 1854 | unittest.group("resource-CustomersDevicesResourceApi", () { |
| 1855 | unittest.test("method--applyConfiguration", () { |
| 1856 | var mock = new HttpServerMock(); |
| 1857 | api.CustomersDevicesResourceApi res = |
| 1858 | new api.AndroiddeviceprovisioningApi(mock).customers.devices; |
| 1859 | var arg_request = buildCustomerApplyConfigurationRequest(); |
| 1860 | var arg_parent = "foo"; |
| 1861 | var arg_$fields = "foo"; |
| 1862 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1863 | var obj = new api.CustomerApplyConfigurationRequest.fromJson(json); |
| 1864 | checkCustomerApplyConfigurationRequest(obj); |
| 1865 | |
| 1866 | var path = (req.url).path; |
| 1867 | var pathOffset = 0; |
| 1868 | var index; |
| 1869 | var subPart; |
| 1870 | unittest.expect( |
| 1871 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1872 | pathOffset += 1; |
| 1873 | unittest.expect( |
| 1874 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1875 | pathOffset += 3; |
| 1876 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1877 | |
| 1878 | var query = (req.url).query; |
| 1879 | var queryOffset = 0; |
| 1880 | var queryMap = {}; |
| 1881 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1882 | parseBool(n) { |
| 1883 | if (n == "true") return true; |
| 1884 | if (n == "false") return false; |
| 1885 | if (n == null) return null; |
| 1886 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1887 | } |
| 1888 | |
| 1889 | if (query.length > 0) { |
| 1890 | for (var part in query.split("&")) { |
| 1891 | var keyvalue = part.split("="); |
| 1892 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1893 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1894 | } |
| 1895 | } |
| 1896 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1897 | |
| 1898 | var h = { |
| 1899 | "content-type": "application/json; charset=utf-8", |
| 1900 | }; |
| 1901 | var resp = convert.JSON.encode(buildEmpty()); |
| 1902 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1903 | }), true); |
| 1904 | res |
| 1905 | .applyConfiguration(arg_request, arg_parent, $fields: arg_$fields) |
| 1906 | .then(unittest.expectAsync1(((api.Empty response) { |
| 1907 | checkEmpty(response); |
| 1908 | }))); |
| 1909 | }); |
| 1910 | |
| 1911 | unittest.test("method--get", () { |
| 1912 | var mock = new HttpServerMock(); |
| 1913 | api.CustomersDevicesResourceApi res = |
| 1914 | new api.AndroiddeviceprovisioningApi(mock).customers.devices; |
| 1915 | var arg_name = "foo"; |
| 1916 | var arg_$fields = "foo"; |
| 1917 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1918 | var path = (req.url).path; |
| 1919 | var pathOffset = 0; |
| 1920 | var index; |
| 1921 | var subPart; |
| 1922 | unittest.expect( |
| 1923 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1924 | pathOffset += 1; |
| 1925 | unittest.expect( |
| 1926 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1927 | pathOffset += 3; |
| 1928 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1929 | |
| 1930 | var query = (req.url).query; |
| 1931 | var queryOffset = 0; |
| 1932 | var queryMap = {}; |
| 1933 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1934 | parseBool(n) { |
| 1935 | if (n == "true") return true; |
| 1936 | if (n == "false") return false; |
| 1937 | if (n == null) return null; |
| 1938 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1939 | } |
| 1940 | |
| 1941 | if (query.length > 0) { |
| 1942 | for (var part in query.split("&")) { |
| 1943 | var keyvalue = part.split("="); |
| 1944 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1945 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1946 | } |
| 1947 | } |
| 1948 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 1949 | |
| 1950 | var h = { |
| 1951 | "content-type": "application/json; charset=utf-8", |
| 1952 | }; |
| 1953 | var resp = convert.JSON.encode(buildDevice()); |
| 1954 | return new async.Future.value(stringResponse(200, h, resp)); |
| 1955 | }), true); |
| 1956 | res |
| 1957 | .get(arg_name, $fields: arg_$fields) |
| 1958 | .then(unittest.expectAsync1(((api.Device response) { |
| 1959 | checkDevice(response); |
| 1960 | }))); |
| 1961 | }); |
| 1962 | |
| 1963 | unittest.test("method--list", () { |
| 1964 | var mock = new HttpServerMock(); |
| 1965 | api.CustomersDevicesResourceApi res = |
| 1966 | new api.AndroiddeviceprovisioningApi(mock).customers.devices; |
| 1967 | var arg_parent = "foo"; |
| 1968 | var arg_pageToken = "foo"; |
| 1969 | var arg_pageSize = "foo"; |
| 1970 | var arg_$fields = "foo"; |
| 1971 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1972 | var path = (req.url).path; |
| 1973 | var pathOffset = 0; |
| 1974 | var index; |
| 1975 | var subPart; |
| 1976 | unittest.expect( |
| 1977 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1978 | pathOffset += 1; |
| 1979 | unittest.expect( |
| 1980 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 1981 | pathOffset += 3; |
| 1982 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 1983 | |
| 1984 | var query = (req.url).query; |
| 1985 | var queryOffset = 0; |
| 1986 | var queryMap = {}; |
| 1987 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1988 | parseBool(n) { |
| 1989 | if (n == "true") return true; |
| 1990 | if (n == "false") return false; |
| 1991 | if (n == null) return null; |
| 1992 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 1993 | } |
| 1994 | |
| 1995 | if (query.length > 0) { |
| 1996 | for (var part in query.split("&")) { |
| 1997 | var keyvalue = part.split("="); |
| 1998 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1999 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 2000 | } |
| 2001 | } |
| 2002 | unittest.expect( |
| 2003 | queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 2004 | unittest.expect( |
| 2005 | queryMap["pageSize"].first, unittest.equals(arg_pageSize)); |
| 2006 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 2007 | |
| 2008 | var h = { |
| 2009 | "content-type": "application/json; charset=utf-8", |
| 2010 | }; |
| 2011 | var resp = convert.JSON.encode(buildCustomerListDevicesResponse()); |
| 2012 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2013 | }), true); |
| 2014 | res |
| 2015 | .list(arg_parent, |
| 2016 | pageToken: arg_pageToken, |
| 2017 | pageSize: arg_pageSize, |
| 2018 | $fields: arg_$fields) |
| 2019 | .then(unittest |
| 2020 | .expectAsync1(((api.CustomerListDevicesResponse response) { |
| 2021 | checkCustomerListDevicesResponse(response); |
| 2022 | }))); |
| 2023 | }); |
| 2024 | |
| 2025 | unittest.test("method--removeConfiguration", () { |
| 2026 | var mock = new HttpServerMock(); |
| 2027 | api.CustomersDevicesResourceApi res = |
| 2028 | new api.AndroiddeviceprovisioningApi(mock).customers.devices; |
| 2029 | var arg_request = buildCustomerRemoveConfigurationRequest(); |
| 2030 | var arg_parent = "foo"; |
| 2031 | var arg_$fields = "foo"; |
| 2032 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2033 | var obj = new api.CustomerRemoveConfigurationRequest.fromJson(json); |
| 2034 | checkCustomerRemoveConfigurationRequest(obj); |
| 2035 | |
| 2036 | var path = (req.url).path; |
| 2037 | var pathOffset = 0; |
| 2038 | var index; |
| 2039 | var subPart; |
| 2040 | unittest.expect( |
| 2041 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 2042 | pathOffset += 1; |
| 2043 | unittest.expect( |
| 2044 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 2045 | pathOffset += 3; |
| 2046 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2047 | |
| 2048 | var query = (req.url).query; |
| 2049 | var queryOffset = 0; |
| 2050 | var queryMap = {}; |
| 2051 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2052 | parseBool(n) { |
| 2053 | if (n == "true") return true; |
| 2054 | if (n == "false") return false; |
| 2055 | if (n == null) return null; |
| 2056 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2057 | } |
| 2058 | |
| 2059 | if (query.length > 0) { |
| 2060 | for (var part in query.split("&")) { |
| 2061 | var keyvalue = part.split("="); |
| 2062 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2063 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 2064 | } |
| 2065 | } |
| 2066 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 2067 | |
| 2068 | var h = { |
| 2069 | "content-type": "application/json; charset=utf-8", |
| 2070 | }; |
| 2071 | var resp = convert.JSON.encode(buildEmpty()); |
| 2072 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2073 | }), true); |
| 2074 | res |
| 2075 | .removeConfiguration(arg_request, arg_parent, $fields: arg_$fields) |
| 2076 | .then(unittest.expectAsync1(((api.Empty response) { |
| 2077 | checkEmpty(response); |
| 2078 | }))); |
| 2079 | }); |
| 2080 | |
| 2081 | unittest.test("method--unclaim", () { |
| 2082 | var mock = new HttpServerMock(); |
| 2083 | api.CustomersDevicesResourceApi res = |
| 2084 | new api.AndroiddeviceprovisioningApi(mock).customers.devices; |
| 2085 | var arg_request = buildCustomerUnclaimDeviceRequest(); |
| 2086 | var arg_parent = "foo"; |
| 2087 | var arg_$fields = "foo"; |
| 2088 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2089 | var obj = new api.CustomerUnclaimDeviceRequest.fromJson(json); |
| 2090 | checkCustomerUnclaimDeviceRequest(obj); |
| 2091 | |
| 2092 | var path = (req.url).path; |
| 2093 | var pathOffset = 0; |
| 2094 | var index; |
| 2095 | var subPart; |
| 2096 | unittest.expect( |
| 2097 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 2098 | pathOffset += 1; |
| 2099 | unittest.expect( |
| 2100 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 2101 | pathOffset += 3; |
| 2102 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2103 | |
| 2104 | var query = (req.url).query; |
| 2105 | var queryOffset = 0; |
| 2106 | var queryMap = {}; |
| 2107 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2108 | parseBool(n) { |
| 2109 | if (n == "true") return true; |
| 2110 | if (n == "false") return false; |
| 2111 | if (n == null) return null; |
| 2112 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2113 | } |
| 2114 | |
| 2115 | if (query.length > 0) { |
| 2116 | for (var part in query.split("&")) { |
| 2117 | var keyvalue = part.split("="); |
| 2118 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2119 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 2120 | } |
| 2121 | } |
| 2122 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 2123 | |
| 2124 | var h = { |
| 2125 | "content-type": "application/json; charset=utf-8", |
| 2126 | }; |
| 2127 | var resp = convert.JSON.encode(buildEmpty()); |
| 2128 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2129 | }), true); |
| 2130 | res |
| 2131 | .unclaim(arg_request, arg_parent, $fields: arg_$fields) |
| 2132 | .then(unittest.expectAsync1(((api.Empty response) { |
| 2133 | checkEmpty(response); |
| 2134 | }))); |
| 2135 | }); |
| 2136 | }); |
| 2137 | |
| 2138 | unittest.group("resource-CustomersDpcsResourceApi", () { |
| 2139 | unittest.test("method--list", () { |
| 2140 | var mock = new HttpServerMock(); |
| 2141 | api.CustomersDpcsResourceApi res = |
| 2142 | new api.AndroiddeviceprovisioningApi(mock).customers.dpcs; |
| 2143 | var arg_parent = "foo"; |
| 2144 | var arg_$fields = "foo"; |
| 2145 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2146 | var path = (req.url).path; |
| 2147 | var pathOffset = 0; |
| 2148 | var index; |
| 2149 | var subPart; |
| 2150 | unittest.expect( |
| 2151 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 2152 | pathOffset += 1; |
| 2153 | unittest.expect( |
| 2154 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 2155 | pathOffset += 3; |
| 2156 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2157 | |
| 2158 | var query = (req.url).query; |
| 2159 | var queryOffset = 0; |
| 2160 | var queryMap = {}; |
| 2161 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2162 | parseBool(n) { |
| 2163 | if (n == "true") return true; |
| 2164 | if (n == "false") return false; |
| 2165 | if (n == null) return null; |
| 2166 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2167 | } |
| 2168 | |
| 2169 | if (query.length > 0) { |
| 2170 | for (var part in query.split("&")) { |
| 2171 | var keyvalue = part.split("="); |
| 2172 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2173 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 2174 | } |
| 2175 | } |
| 2176 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| 2177 | |
| 2178 | var h = { |
| 2179 | "content-type": "application/json; charset=utf-8", |
| 2180 | }; |
| 2181 | var resp = convert.JSON.encode(buildCustomerListDpcsResponse()); |
| 2182 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2183 | }), true); |
| 2184 | res |
| 2185 | .list(arg_parent, $fields: arg_$fields) |
| 2186 | .then(unittest.expectAsync1(((api.CustomerListDpcsResponse response) { |
| 2187 | checkCustomerListDpcsResponse(response); |
| 2188 | }))); |
| 2189 | }); |
| 2190 | }); |
| 2191 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2192 | unittest.group("resource-OperationsResourceApi", () { |
| 2193 | unittest.test("method--get", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2194 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2195 | api.OperationsResourceApi res = |
| 2196 | new api.AndroiddeviceprovisioningApi(mock).operations; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2197 | var arg_name = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2198 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2199 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2200 | var path = (req.url).path; |
| 2201 | var pathOffset = 0; |
| 2202 | var index; |
| 2203 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2204 | unittest.expect( |
| 2205 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2206 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2207 | unittest.expect( |
| 2208 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2209 | pathOffset += 3; |
| 2210 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2211 | |
| 2212 | var query = (req.url).query; |
| 2213 | var queryOffset = 0; |
| 2214 | var queryMap = {}; |
| 2215 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2216 | parseBool(n) { |
| 2217 | if (n == "true") return true; |
| 2218 | if (n == "false") return false; |
| 2219 | if (n == null) return null; |
| 2220 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2221 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2222 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2223 | if (query.length > 0) { |
| 2224 | for (var part in query.split("&")) { |
| 2225 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2226 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2227 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2228 | } |
| 2229 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2230 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2231 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2232 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2233 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2234 | }; |
| 2235 | var resp = convert.JSON.encode(buildOperation()); |
| 2236 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2237 | }), true); |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2238 | res |
| 2239 | .get(arg_name, $fields: arg_$fields) |
| 2240 | .then(unittest.expectAsync1(((api.Operation response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2241 | checkOperation(response); |
| 2242 | }))); |
| 2243 | }); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2244 | }); |
| 2245 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2246 | unittest.group("resource-PartnersCustomersResourceApi", () { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2247 | unittest.test("method--create", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2248 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2249 | api.PartnersCustomersResourceApi res = |
| 2250 | new api.AndroiddeviceprovisioningApi(mock).partners.customers; |
| 2251 | var arg_request = buildCreateCustomerRequest(); |
| 2252 | var arg_parent = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2253 | var arg_$fields = "foo"; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2254 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2255 | var obj = new api.CreateCustomerRequest.fromJson(json); |
| 2256 | checkCreateCustomerRequest(obj); |
| 2257 | |
| 2258 | var path = (req.url).path; |
| 2259 | var pathOffset = 0; |
| 2260 | var index; |
| 2261 | var subPart; |
| 2262 | unittest.expect( |
| 2263 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 2264 | pathOffset += 1; |
| 2265 | unittest.expect( |
| 2266 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 2267 | pathOffset += 3; |
| 2268 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2269 | |
| 2270 | var query = (req.url).query; |
| 2271 | var queryOffset = 0; |
| 2272 | var queryMap = {}; |
| 2273 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2274 | parseBool(n) { |
| 2275 | if (n == "true") return true; |
| 2276 | if (n == "false") return false; |
| 2277 | if (n == null) return null; |
| 2278 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2279 | } |
| 2280 | |
| 2281 | if (query.length > 0) { |
| 2282 | for (var part in query.split("&")) { |
| 2283 | var keyvalue = part.split("="); |
| 2284 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2285 | core.Uri.decodeQueryComponent(keyvalue[1])); |
| 2286 | } |
| 2287 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2288 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2289 | |
| 2290 | var h = { |
| 2291 | "content-type": "application/json; charset=utf-8", |
| 2292 | }; |
| 2293 | var resp = convert.JSON.encode(buildCompany()); |
| 2294 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2295 | }), true); |
| 2296 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2297 | .create(arg_request, arg_parent, $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2298 | .then(unittest.expectAsync1(((api.Company response) { |
| 2299 | checkCompany(response); |
| 2300 | }))); |
| 2301 | }); |
| 2302 | |
| 2303 | unittest.test("method--list", () { |
| 2304 | var mock = new HttpServerMock(); |
| 2305 | api.PartnersCustomersResourceApi res = |
| 2306 | new api.AndroiddeviceprovisioningApi(mock).partners.customers; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2307 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2308 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2309 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2310 | var path = (req.url).path; |
| 2311 | var pathOffset = 0; |
| 2312 | var index; |
| 2313 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2314 | unittest.expect( |
| 2315 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2316 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2317 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2318 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2319 | pathOffset += 12; |
| 2320 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2321 | |
| 2322 | var query = (req.url).query; |
| 2323 | var queryOffset = 0; |
| 2324 | var queryMap = {}; |
| 2325 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2326 | parseBool(n) { |
| 2327 | if (n == "true") return true; |
| 2328 | if (n == "false") return false; |
| 2329 | if (n == null) return null; |
| 2330 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2331 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2332 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2333 | if (query.length > 0) { |
| 2334 | for (var part in query.split("&")) { |
| 2335 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2336 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2337 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2338 | } |
| 2339 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2340 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2341 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2342 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2343 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2344 | }; |
| 2345 | var resp = convert.JSON.encode(buildListCustomersResponse()); |
| 2346 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2347 | }), true); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2348 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2349 | .list(arg_partnerId, $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2350 | .then(unittest.expectAsync1(((api.ListCustomersResponse response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2351 | checkListCustomersResponse(response); |
| 2352 | }))); |
| 2353 | }); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2354 | }); |
| 2355 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2356 | unittest.group("resource-PartnersDevicesResourceApi", () { |
| 2357 | unittest.test("method--claim", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2358 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2359 | api.PartnersDevicesResourceApi res = |
| 2360 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2361 | var arg_request = buildClaimDeviceRequest(); |
| 2362 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2363 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2364 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2365 | var obj = new api.ClaimDeviceRequest.fromJson(json); |
| 2366 | checkClaimDeviceRequest(obj); |
| 2367 | |
| 2368 | var path = (req.url).path; |
| 2369 | var pathOffset = 0; |
| 2370 | var index; |
| 2371 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2372 | unittest.expect( |
| 2373 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2374 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2375 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2376 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2377 | pathOffset += 12; |
| 2378 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2379 | |
| 2380 | var query = (req.url).query; |
| 2381 | var queryOffset = 0; |
| 2382 | var queryMap = {}; |
| 2383 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2384 | parseBool(n) { |
| 2385 | if (n == "true") return true; |
| 2386 | if (n == "false") return false; |
| 2387 | if (n == null) return null; |
| 2388 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2389 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2390 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2391 | if (query.length > 0) { |
| 2392 | for (var part in query.split("&")) { |
| 2393 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2394 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2395 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2396 | } |
| 2397 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2398 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2399 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2400 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2401 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2402 | }; |
| 2403 | var resp = convert.JSON.encode(buildClaimDeviceResponse()); |
| 2404 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2405 | }), true); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2406 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2407 | .claim(arg_request, arg_partnerId, $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2408 | .then(unittest.expectAsync1(((api.ClaimDeviceResponse response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2409 | checkClaimDeviceResponse(response); |
| 2410 | }))); |
| 2411 | }); |
| 2412 | |
| 2413 | unittest.test("method--claimAsync", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2414 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2415 | api.PartnersDevicesResourceApi res = |
| 2416 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2417 | var arg_request = buildClaimDevicesRequest(); |
| 2418 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2419 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2420 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2421 | var obj = new api.ClaimDevicesRequest.fromJson(json); |
| 2422 | checkClaimDevicesRequest(obj); |
| 2423 | |
| 2424 | var path = (req.url).path; |
| 2425 | var pathOffset = 0; |
| 2426 | var index; |
| 2427 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2428 | unittest.expect( |
| 2429 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2430 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2431 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2432 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2433 | pathOffset += 12; |
| 2434 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2435 | |
| 2436 | var query = (req.url).query; |
| 2437 | var queryOffset = 0; |
| 2438 | var queryMap = {}; |
| 2439 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2440 | parseBool(n) { |
| 2441 | if (n == "true") return true; |
| 2442 | if (n == "false") return false; |
| 2443 | if (n == null) return null; |
| 2444 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2445 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2446 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2447 | if (query.length > 0) { |
| 2448 | for (var part in query.split("&")) { |
| 2449 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2450 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2451 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2452 | } |
| 2453 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2454 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2455 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2456 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2457 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2458 | }; |
| 2459 | var resp = convert.JSON.encode(buildOperation()); |
| 2460 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2461 | }), true); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2462 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2463 | .claimAsync(arg_request, arg_partnerId, $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2464 | .then(unittest.expectAsync1(((api.Operation response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2465 | checkOperation(response); |
| 2466 | }))); |
| 2467 | }); |
| 2468 | |
| 2469 | unittest.test("method--findByIdentifier", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2470 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2471 | api.PartnersDevicesResourceApi res = |
| 2472 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2473 | var arg_request = buildFindDevicesByDeviceIdentifierRequest(); |
| 2474 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2475 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2476 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2477 | var obj = new api.FindDevicesByDeviceIdentifierRequest.fromJson(json); |
| 2478 | checkFindDevicesByDeviceIdentifierRequest(obj); |
| 2479 | |
| 2480 | var path = (req.url).path; |
| 2481 | var pathOffset = 0; |
| 2482 | var index; |
| 2483 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2484 | unittest.expect( |
| 2485 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2486 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2487 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2488 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2489 | pathOffset += 12; |
| 2490 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2491 | |
| 2492 | var query = (req.url).query; |
| 2493 | var queryOffset = 0; |
| 2494 | var queryMap = {}; |
| 2495 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2496 | parseBool(n) { |
| 2497 | if (n == "true") return true; |
| 2498 | if (n == "false") return false; |
| 2499 | if (n == null) return null; |
| 2500 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2501 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2502 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2503 | if (query.length > 0) { |
| 2504 | for (var part in query.split("&")) { |
| 2505 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2506 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2507 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2508 | } |
| 2509 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2510 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2511 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2512 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2513 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2514 | }; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2515 | var resp = |
| 2516 | convert.JSON.encode(buildFindDevicesByDeviceIdentifierResponse()); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2517 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2518 | }), true); |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2519 | res |
| 2520 | .findByIdentifier(arg_request, arg_partnerId, $fields: arg_$fields) |
| 2521 | .then(unittest.expectAsync1( |
| 2522 | ((api.FindDevicesByDeviceIdentifierResponse response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2523 | checkFindDevicesByDeviceIdentifierResponse(response); |
| 2524 | }))); |
| 2525 | }); |
| 2526 | |
| 2527 | unittest.test("method--findByOwner", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2528 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2529 | api.PartnersDevicesResourceApi res = |
| 2530 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2531 | var arg_request = buildFindDevicesByOwnerRequest(); |
| 2532 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2533 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2534 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2535 | var obj = new api.FindDevicesByOwnerRequest.fromJson(json); |
| 2536 | checkFindDevicesByOwnerRequest(obj); |
| 2537 | |
| 2538 | var path = (req.url).path; |
| 2539 | var pathOffset = 0; |
| 2540 | var index; |
| 2541 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2542 | unittest.expect( |
| 2543 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2544 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2545 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2546 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2547 | pathOffset += 12; |
| 2548 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2549 | |
| 2550 | var query = (req.url).query; |
| 2551 | var queryOffset = 0; |
| 2552 | var queryMap = {}; |
| 2553 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2554 | parseBool(n) { |
| 2555 | if (n == "true") return true; |
| 2556 | if (n == "false") return false; |
| 2557 | if (n == null) return null; |
| 2558 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2559 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2560 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2561 | if (query.length > 0) { |
| 2562 | for (var part in query.split("&")) { |
| 2563 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2564 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2565 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2566 | } |
| 2567 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2568 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2569 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2570 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2571 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2572 | }; |
| 2573 | var resp = convert.JSON.encode(buildFindDevicesByOwnerResponse()); |
| 2574 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2575 | }), true); |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2576 | res.findByOwner(arg_request, arg_partnerId, $fields: arg_$fields).then( |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2577 | unittest.expectAsync1(((api.FindDevicesByOwnerResponse response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2578 | checkFindDevicesByOwnerResponse(response); |
| 2579 | }))); |
| 2580 | }); |
| 2581 | |
| 2582 | unittest.test("method--get", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2583 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2584 | api.PartnersDevicesResourceApi res = |
| 2585 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2586 | var arg_name = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2587 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2588 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2589 | var path = (req.url).path; |
| 2590 | var pathOffset = 0; |
| 2591 | var index; |
| 2592 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2593 | unittest.expect( |
| 2594 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2595 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2596 | unittest.expect( |
| 2597 | path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2598 | pathOffset += 3; |
| 2599 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2600 | |
| 2601 | var query = (req.url).query; |
| 2602 | var queryOffset = 0; |
| 2603 | var queryMap = {}; |
| 2604 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2605 | parseBool(n) { |
| 2606 | if (n == "true") return true; |
| 2607 | if (n == "false") return false; |
| 2608 | if (n == null) return null; |
| 2609 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2610 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2611 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2612 | if (query.length > 0) { |
| 2613 | for (var part in query.split("&")) { |
| 2614 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2615 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2616 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2617 | } |
| 2618 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2619 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2620 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2621 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2622 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2623 | }; |
| 2624 | var resp = convert.JSON.encode(buildDevice()); |
| 2625 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2626 | }), true); |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2627 | res |
| 2628 | .get(arg_name, $fields: arg_$fields) |
| 2629 | .then(unittest.expectAsync1(((api.Device response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2630 | checkDevice(response); |
| 2631 | }))); |
| 2632 | }); |
| 2633 | |
| 2634 | unittest.test("method--metadata", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2635 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2636 | api.PartnersDevicesResourceApi res = |
| 2637 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2638 | var arg_request = buildUpdateDeviceMetadataRequest(); |
| 2639 | var arg_metadataOwnerId = "foo"; |
| 2640 | var arg_deviceId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2641 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2642 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2643 | var obj = new api.UpdateDeviceMetadataRequest.fromJson(json); |
| 2644 | checkUpdateDeviceMetadataRequest(obj); |
| 2645 | |
| 2646 | var path = (req.url).path; |
| 2647 | var pathOffset = 0; |
| 2648 | var index; |
| 2649 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2650 | unittest.expect( |
| 2651 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2652 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2653 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2654 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2655 | pathOffset += 12; |
| 2656 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2657 | |
| 2658 | var query = (req.url).query; |
| 2659 | var queryOffset = 0; |
| 2660 | var queryMap = {}; |
| 2661 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2662 | parseBool(n) { |
| 2663 | if (n == "true") return true; |
| 2664 | if (n == "false") return false; |
| 2665 | if (n == null) return null; |
| 2666 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2667 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2668 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2669 | if (query.length > 0) { |
| 2670 | for (var part in query.split("&")) { |
| 2671 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2672 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2673 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2674 | } |
| 2675 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2676 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2677 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2678 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2679 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2680 | }; |
| 2681 | var resp = convert.JSON.encode(buildDeviceMetadata()); |
| 2682 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2683 | }), true); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2684 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2685 | .metadata(arg_request, arg_metadataOwnerId, arg_deviceId, |
| 2686 | $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2687 | .then(unittest.expectAsync1(((api.DeviceMetadata response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2688 | checkDeviceMetadata(response); |
| 2689 | }))); |
| 2690 | }); |
| 2691 | |
| 2692 | unittest.test("method--unclaim", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2693 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2694 | api.PartnersDevicesResourceApi res = |
| 2695 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2696 | var arg_request = buildUnclaimDeviceRequest(); |
| 2697 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2698 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2699 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2700 | var obj = new api.UnclaimDeviceRequest.fromJson(json); |
| 2701 | checkUnclaimDeviceRequest(obj); |
| 2702 | |
| 2703 | var path = (req.url).path; |
| 2704 | var pathOffset = 0; |
| 2705 | var index; |
| 2706 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2707 | unittest.expect( |
| 2708 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2709 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2710 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2711 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2712 | pathOffset += 12; |
| 2713 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2714 | |
| 2715 | var query = (req.url).query; |
| 2716 | var queryOffset = 0; |
| 2717 | var queryMap = {}; |
| 2718 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2719 | parseBool(n) { |
| 2720 | if (n == "true") return true; |
| 2721 | if (n == "false") return false; |
| 2722 | if (n == null) return null; |
| 2723 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2724 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2725 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2726 | if (query.length > 0) { |
| 2727 | for (var part in query.split("&")) { |
| 2728 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2729 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2730 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2731 | } |
| 2732 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2733 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2734 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2735 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2736 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2737 | }; |
| 2738 | var resp = convert.JSON.encode(buildEmpty()); |
| 2739 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2740 | }), true); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2741 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2742 | .unclaim(arg_request, arg_partnerId, $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2743 | .then(unittest.expectAsync1(((api.Empty response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2744 | checkEmpty(response); |
| 2745 | }))); |
| 2746 | }); |
| 2747 | |
| 2748 | unittest.test("method--unclaimAsync", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2749 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2750 | api.PartnersDevicesResourceApi res = |
| 2751 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2752 | var arg_request = buildUnclaimDevicesRequest(); |
| 2753 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2754 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2755 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2756 | var obj = new api.UnclaimDevicesRequest.fromJson(json); |
| 2757 | checkUnclaimDevicesRequest(obj); |
| 2758 | |
| 2759 | var path = (req.url).path; |
| 2760 | var pathOffset = 0; |
| 2761 | var index; |
| 2762 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2763 | unittest.expect( |
| 2764 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2765 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2766 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2767 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2768 | pathOffset += 12; |
| 2769 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2770 | |
| 2771 | var query = (req.url).query; |
| 2772 | var queryOffset = 0; |
| 2773 | var queryMap = {}; |
| 2774 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2775 | parseBool(n) { |
| 2776 | if (n == "true") return true; |
| 2777 | if (n == "false") return false; |
| 2778 | if (n == null) return null; |
| 2779 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2780 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2781 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2782 | if (query.length > 0) { |
| 2783 | for (var part in query.split("&")) { |
| 2784 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2785 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2786 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2787 | } |
| 2788 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2789 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2790 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2791 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2792 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2793 | }; |
| 2794 | var resp = convert.JSON.encode(buildOperation()); |
| 2795 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2796 | }), true); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2797 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2798 | .unclaimAsync(arg_request, arg_partnerId, $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2799 | .then(unittest.expectAsync1(((api.Operation response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2800 | checkOperation(response); |
| 2801 | }))); |
| 2802 | }); |
| 2803 | |
| 2804 | unittest.test("method--updateMetadataAsync", () { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2805 | var mock = new HttpServerMock(); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2806 | api.PartnersDevicesResourceApi res = |
| 2807 | new api.AndroiddeviceprovisioningApi(mock).partners.devices; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2808 | var arg_request = buildUpdateDeviceMetadataInBatchRequest(); |
| 2809 | var arg_partnerId = "foo"; |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2810 | var arg_$fields = "foo"; |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2811 | mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 2812 | var obj = new api.UpdateDeviceMetadataInBatchRequest.fromJson(json); |
| 2813 | checkUpdateDeviceMetadataInBatchRequest(obj); |
| 2814 | |
| 2815 | var path = (req.url).path; |
| 2816 | var pathOffset = 0; |
| 2817 | var index; |
| 2818 | var subPart; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2819 | unittest.expect( |
| 2820 | path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2821 | pathOffset += 1; |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2822 | unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 2823 | unittest.equals("v1/partners/")); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2824 | pathOffset += 12; |
| 2825 | // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| 2826 | |
| 2827 | var query = (req.url).query; |
| 2828 | var queryOffset = 0; |
| 2829 | var queryMap = {}; |
| 2830 | addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2831 | parseBool(n) { |
| 2832 | if (n == "true") return true; |
| 2833 | if (n == "false") return false; |
| 2834 | if (n == null) return null; |
| 2835 | throw new core.ArgumentError("Invalid boolean: $n"); |
| 2836 | } |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2837 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2838 | if (query.length > 0) { |
| 2839 | for (var part in query.split("&")) { |
| 2840 | var keyvalue = part.split("="); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2841 | addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2842 | core.Uri.decodeQueryComponent(keyvalue[1])); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2843 | } |
| 2844 | } |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2845 | unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2846 | |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2847 | var h = { |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2848 | "content-type": "application/json; charset=utf-8", |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2849 | }; |
| 2850 | var resp = convert.JSON.encode(buildOperation()); |
| 2851 | return new async.Future.value(stringResponse(200, h, resp)); |
| 2852 | }), true); |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2853 | res |
Martin Kustermann | 7a3b5f5 | 2017-10-23 11:34:19 +0200 | [diff] [blame] | 2854 | .updateMetadataAsync(arg_request, arg_partnerId, $fields: arg_$fields) |
Martin Kustermann | 5eb85c1 | 2017-09-11 12:35:54 +0200 | [diff] [blame] | 2855 | .then(unittest.expectAsync1(((api.Operation response) { |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2856 | checkOperation(response); |
| 2857 | }))); |
| 2858 | }); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2859 | }); |
Martin Kustermann | fa83e31 | 2017-07-31 12:48:45 +0200 | [diff] [blame] | 2860 | } |