| OLD | NEW |
| 1 library googleapis.firebasedynamiclinks.v1.test; | 1 library googleapis.firebasedynamiclinks.v1.test; |
| 2 | 2 |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; | |
| 5 import "dart:async" as async; | 4 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
| 7 | 6 |
| 8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; | |
| 10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
| 11 | 9 |
| 12 import 'package:googleapis/firebasedynamiclinks/v1.dart' as api; | 10 import 'package:googleapis/firebasedynamiclinks/v1.dart' as api; |
| 13 | 11 |
| 14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 13 core.Function _callback; |
| 16 core.bool _expectJson; | 14 core.bool _expectJson; |
| 17 | 15 |
| 18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 17 _callback = callback; |
| 20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
| 21 } | 19 } |
| 22 | 20 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { | 22 if (_expectJson) { |
| 25 return request.finalize() | 23 return request |
| 24 .finalize() |
| 26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
| 27 .join('') | 26 .join('') |
| 28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); | 29 return _callback(request, null); |
| 31 } else { | 30 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } | 32 } |
| 34 }); | 33 }); |
| 35 } else { | 34 } else { |
| 36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
| 37 if (stream == null) { | 36 if (stream == null) { |
| 38 return _callback(request, []); | 37 return _callback(request, []); |
| 39 } else { | 38 } else { |
| 40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 40 return _callback(request, data); |
| 42 }); | 41 }); |
| 43 } | 42 } |
| 44 } | 43 } |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 | 46 |
| 48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
| 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 51 } |
| 53 | 52 |
| 54 core.int buildCounterAnalyticsInfo = 0; | 53 core.int buildCounterAnalyticsInfo = 0; |
| 55 buildAnalyticsInfo() { | 54 buildAnalyticsInfo() { |
| 56 var o = new api.AnalyticsInfo(); | 55 var o = new api.AnalyticsInfo(); |
| 57 buildCounterAnalyticsInfo++; | 56 buildCounterAnalyticsInfo++; |
| 58 if (buildCounterAnalyticsInfo < 3) { | 57 if (buildCounterAnalyticsInfo < 3) { |
| 59 o.googlePlayAnalytics = buildGooglePlayAnalytics(); | 58 o.googlePlayAnalytics = buildGooglePlayAnalytics(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 checkCreateShortDynamicLinkRequest(api.CreateShortDynamicLinkRequest o) { | 112 checkCreateShortDynamicLinkRequest(api.CreateShortDynamicLinkRequest o) { |
| 114 buildCounterCreateShortDynamicLinkRequest++; | 113 buildCounterCreateShortDynamicLinkRequest++; |
| 115 if (buildCounterCreateShortDynamicLinkRequest < 3) { | 114 if (buildCounterCreateShortDynamicLinkRequest < 3) { |
| 116 checkDynamicLinkInfo(o.dynamicLinkInfo); | 115 checkDynamicLinkInfo(o.dynamicLinkInfo); |
| 117 unittest.expect(o.longDynamicLink, unittest.equals('foo')); | 116 unittest.expect(o.longDynamicLink, unittest.equals('foo')); |
| 118 checkSuffix(o.suffix); | 117 checkSuffix(o.suffix); |
| 119 } | 118 } |
| 120 buildCounterCreateShortDynamicLinkRequest--; | 119 buildCounterCreateShortDynamicLinkRequest--; |
| 121 } | 120 } |
| 122 | 121 |
| 123 buildUnnamed2192() { | 122 buildUnnamed2179() { |
| 124 var o = new core.List<api.DynamicLinkWarning>(); | 123 var o = new core.List<api.DynamicLinkWarning>(); |
| 125 o.add(buildDynamicLinkWarning()); | 124 o.add(buildDynamicLinkWarning()); |
| 126 o.add(buildDynamicLinkWarning()); | 125 o.add(buildDynamicLinkWarning()); |
| 127 return o; | 126 return o; |
| 128 } | 127 } |
| 129 | 128 |
| 130 checkUnnamed2192(core.List<api.DynamicLinkWarning> o) { | 129 checkUnnamed2179(core.List<api.DynamicLinkWarning> o) { |
| 131 unittest.expect(o, unittest.hasLength(2)); | 130 unittest.expect(o, unittest.hasLength(2)); |
| 132 checkDynamicLinkWarning(o[0]); | 131 checkDynamicLinkWarning(o[0]); |
| 133 checkDynamicLinkWarning(o[1]); | 132 checkDynamicLinkWarning(o[1]); |
| 134 } | 133 } |
| 135 | 134 |
| 136 core.int buildCounterCreateShortDynamicLinkResponse = 0; | 135 core.int buildCounterCreateShortDynamicLinkResponse = 0; |
| 137 buildCreateShortDynamicLinkResponse() { | 136 buildCreateShortDynamicLinkResponse() { |
| 138 var o = new api.CreateShortDynamicLinkResponse(); | 137 var o = new api.CreateShortDynamicLinkResponse(); |
| 139 buildCounterCreateShortDynamicLinkResponse++; | 138 buildCounterCreateShortDynamicLinkResponse++; |
| 140 if (buildCounterCreateShortDynamicLinkResponse < 3) { | 139 if (buildCounterCreateShortDynamicLinkResponse < 3) { |
| 141 o.previewLink = "foo"; | 140 o.previewLink = "foo"; |
| 142 o.shortLink = "foo"; | 141 o.shortLink = "foo"; |
| 143 o.warning = buildUnnamed2192(); | 142 o.warning = buildUnnamed2179(); |
| 144 } | 143 } |
| 145 buildCounterCreateShortDynamicLinkResponse--; | 144 buildCounterCreateShortDynamicLinkResponse--; |
| 146 return o; | 145 return o; |
| 147 } | 146 } |
| 148 | 147 |
| 149 checkCreateShortDynamicLinkResponse(api.CreateShortDynamicLinkResponse o) { | 148 checkCreateShortDynamicLinkResponse(api.CreateShortDynamicLinkResponse o) { |
| 150 buildCounterCreateShortDynamicLinkResponse++; | 149 buildCounterCreateShortDynamicLinkResponse++; |
| 151 if (buildCounterCreateShortDynamicLinkResponse < 3) { | 150 if (buildCounterCreateShortDynamicLinkResponse < 3) { |
| 152 unittest.expect(o.previewLink, unittest.equals('foo')); | 151 unittest.expect(o.previewLink, unittest.equals('foo')); |
| 153 unittest.expect(o.shortLink, unittest.equals('foo')); | 152 unittest.expect(o.shortLink, unittest.equals('foo')); |
| 154 checkUnnamed2192(o.warning); | 153 checkUnnamed2179(o.warning); |
| 155 } | 154 } |
| 156 buildCounterCreateShortDynamicLinkResponse--; | 155 buildCounterCreateShortDynamicLinkResponse--; |
| 157 } | 156 } |
| 158 | 157 |
| 158 core.int buildCounterDeviceInfo = 0; |
| 159 buildDeviceInfo() { |
| 160 var o = new api.DeviceInfo(); |
| 161 buildCounterDeviceInfo++; |
| 162 if (buildCounterDeviceInfo < 3) { |
| 163 o.deviceModelName = "foo"; |
| 164 o.languageCode = "foo"; |
| 165 o.screenResolutionHeight = "foo"; |
| 166 o.screenResolutionWidth = "foo"; |
| 167 o.timezone = "foo"; |
| 168 } |
| 169 buildCounterDeviceInfo--; |
| 170 return o; |
| 171 } |
| 172 |
| 173 checkDeviceInfo(api.DeviceInfo o) { |
| 174 buildCounterDeviceInfo++; |
| 175 if (buildCounterDeviceInfo < 3) { |
| 176 unittest.expect(o.deviceModelName, unittest.equals('foo')); |
| 177 unittest.expect(o.languageCode, unittest.equals('foo')); |
| 178 unittest.expect(o.screenResolutionHeight, unittest.equals('foo')); |
| 179 unittest.expect(o.screenResolutionWidth, unittest.equals('foo')); |
| 180 unittest.expect(o.timezone, unittest.equals('foo')); |
| 181 } |
| 182 buildCounterDeviceInfo--; |
| 183 } |
| 184 |
| 159 core.int buildCounterDynamicLinkEventStat = 0; | 185 core.int buildCounterDynamicLinkEventStat = 0; |
| 160 buildDynamicLinkEventStat() { | 186 buildDynamicLinkEventStat() { |
| 161 var o = new api.DynamicLinkEventStat(); | 187 var o = new api.DynamicLinkEventStat(); |
| 162 buildCounterDynamicLinkEventStat++; | 188 buildCounterDynamicLinkEventStat++; |
| 163 if (buildCounterDynamicLinkEventStat < 3) { | 189 if (buildCounterDynamicLinkEventStat < 3) { |
| 164 o.count = "foo"; | 190 o.count = "foo"; |
| 165 o.event = "foo"; | 191 o.event = "foo"; |
| 166 o.platform = "foo"; | 192 o.platform = "foo"; |
| 167 } | 193 } |
| 168 buildCounterDynamicLinkEventStat--; | 194 buildCounterDynamicLinkEventStat--; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 checkAndroidInfo(o.androidInfo); | 229 checkAndroidInfo(o.androidInfo); |
| 204 unittest.expect(o.dynamicLinkDomain, unittest.equals('foo')); | 230 unittest.expect(o.dynamicLinkDomain, unittest.equals('foo')); |
| 205 checkIosInfo(o.iosInfo); | 231 checkIosInfo(o.iosInfo); |
| 206 unittest.expect(o.link, unittest.equals('foo')); | 232 unittest.expect(o.link, unittest.equals('foo')); |
| 207 checkNavigationInfo(o.navigationInfo); | 233 checkNavigationInfo(o.navigationInfo); |
| 208 checkSocialMetaTagInfo(o.socialMetaTagInfo); | 234 checkSocialMetaTagInfo(o.socialMetaTagInfo); |
| 209 } | 235 } |
| 210 buildCounterDynamicLinkInfo--; | 236 buildCounterDynamicLinkInfo--; |
| 211 } | 237 } |
| 212 | 238 |
| 213 buildUnnamed2193() { | 239 buildUnnamed2180() { |
| 214 var o = new core.List<api.DynamicLinkEventStat>(); | 240 var o = new core.List<api.DynamicLinkEventStat>(); |
| 215 o.add(buildDynamicLinkEventStat()); | 241 o.add(buildDynamicLinkEventStat()); |
| 216 o.add(buildDynamicLinkEventStat()); | 242 o.add(buildDynamicLinkEventStat()); |
| 217 return o; | 243 return o; |
| 218 } | 244 } |
| 219 | 245 |
| 220 checkUnnamed2193(core.List<api.DynamicLinkEventStat> o) { | 246 checkUnnamed2180(core.List<api.DynamicLinkEventStat> o) { |
| 221 unittest.expect(o, unittest.hasLength(2)); | 247 unittest.expect(o, unittest.hasLength(2)); |
| 222 checkDynamicLinkEventStat(o[0]); | 248 checkDynamicLinkEventStat(o[0]); |
| 223 checkDynamicLinkEventStat(o[1]); | 249 checkDynamicLinkEventStat(o[1]); |
| 224 } | 250 } |
| 225 | 251 |
| 226 core.int buildCounterDynamicLinkStats = 0; | 252 core.int buildCounterDynamicLinkStats = 0; |
| 227 buildDynamicLinkStats() { | 253 buildDynamicLinkStats() { |
| 228 var o = new api.DynamicLinkStats(); | 254 var o = new api.DynamicLinkStats(); |
| 229 buildCounterDynamicLinkStats++; | 255 buildCounterDynamicLinkStats++; |
| 230 if (buildCounterDynamicLinkStats < 3) { | 256 if (buildCounterDynamicLinkStats < 3) { |
| 231 o.linkEventStats = buildUnnamed2193(); | 257 o.linkEventStats = buildUnnamed2180(); |
| 232 } | 258 } |
| 233 buildCounterDynamicLinkStats--; | 259 buildCounterDynamicLinkStats--; |
| 234 return o; | 260 return o; |
| 235 } | 261 } |
| 236 | 262 |
| 237 checkDynamicLinkStats(api.DynamicLinkStats o) { | 263 checkDynamicLinkStats(api.DynamicLinkStats o) { |
| 238 buildCounterDynamicLinkStats++; | 264 buildCounterDynamicLinkStats++; |
| 239 if (buildCounterDynamicLinkStats < 3) { | 265 if (buildCounterDynamicLinkStats < 3) { |
| 240 checkUnnamed2193(o.linkEventStats); | 266 checkUnnamed2180(o.linkEventStats); |
| 241 } | 267 } |
| 242 buildCounterDynamicLinkStats--; | 268 buildCounterDynamicLinkStats--; |
| 243 } | 269 } |
| 244 | 270 |
| 245 core.int buildCounterDynamicLinkWarning = 0; | 271 core.int buildCounterDynamicLinkWarning = 0; |
| 246 buildDynamicLinkWarning() { | 272 buildDynamicLinkWarning() { |
| 247 var o = new api.DynamicLinkWarning(); | 273 var o = new api.DynamicLinkWarning(); |
| 248 buildCounterDynamicLinkWarning++; | 274 buildCounterDynamicLinkWarning++; |
| 249 if (buildCounterDynamicLinkWarning < 3) { | 275 if (buildCounterDynamicLinkWarning < 3) { |
| 250 o.warningCode = "foo"; | 276 o.warningCode = "foo"; |
| 251 o.warningDocumentLink = "foo"; | 277 o.warningDocumentLink = "foo"; |
| 252 o.warningMessage = "foo"; | 278 o.warningMessage = "foo"; |
| 253 } | 279 } |
| 254 buildCounterDynamicLinkWarning--; | 280 buildCounterDynamicLinkWarning--; |
| 255 return o; | 281 return o; |
| 256 } | 282 } |
| 257 | 283 |
| 258 checkDynamicLinkWarning(api.DynamicLinkWarning o) { | 284 checkDynamicLinkWarning(api.DynamicLinkWarning o) { |
| 259 buildCounterDynamicLinkWarning++; | 285 buildCounterDynamicLinkWarning++; |
| 260 if (buildCounterDynamicLinkWarning < 3) { | 286 if (buildCounterDynamicLinkWarning < 3) { |
| 261 unittest.expect(o.warningCode, unittest.equals('foo')); | 287 unittest.expect(o.warningCode, unittest.equals('foo')); |
| 262 unittest.expect(o.warningDocumentLink, unittest.equals('foo')); | 288 unittest.expect(o.warningDocumentLink, unittest.equals('foo')); |
| 263 unittest.expect(o.warningMessage, unittest.equals('foo')); | 289 unittest.expect(o.warningMessage, unittest.equals('foo')); |
| 264 } | 290 } |
| 265 buildCounterDynamicLinkWarning--; | 291 buildCounterDynamicLinkWarning--; |
| 266 } | 292 } |
| 267 | 293 |
| 294 core.int buildCounterGetIosPostInstallAttributionRequest = 0; |
| 295 buildGetIosPostInstallAttributionRequest() { |
| 296 var o = new api.GetIosPostInstallAttributionRequest(); |
| 297 buildCounterGetIosPostInstallAttributionRequest++; |
| 298 if (buildCounterGetIosPostInstallAttributionRequest < 3) { |
| 299 o.appInstallationTime = "foo"; |
| 300 o.bundleId = "foo"; |
| 301 o.device = buildDeviceInfo(); |
| 302 o.iosVersion = "foo"; |
| 303 o.retrievalMethod = "foo"; |
| 304 o.sdkVersion = "foo"; |
| 305 o.uniqueMatchLinkToCheck = "foo"; |
| 306 o.visualStyle = "foo"; |
| 307 } |
| 308 buildCounterGetIosPostInstallAttributionRequest--; |
| 309 return o; |
| 310 } |
| 311 |
| 312 checkGetIosPostInstallAttributionRequest( |
| 313 api.GetIosPostInstallAttributionRequest o) { |
| 314 buildCounterGetIosPostInstallAttributionRequest++; |
| 315 if (buildCounterGetIosPostInstallAttributionRequest < 3) { |
| 316 unittest.expect(o.appInstallationTime, unittest.equals('foo')); |
| 317 unittest.expect(o.bundleId, unittest.equals('foo')); |
| 318 checkDeviceInfo(o.device); |
| 319 unittest.expect(o.iosVersion, unittest.equals('foo')); |
| 320 unittest.expect(o.retrievalMethod, unittest.equals('foo')); |
| 321 unittest.expect(o.sdkVersion, unittest.equals('foo')); |
| 322 unittest.expect(o.uniqueMatchLinkToCheck, unittest.equals('foo')); |
| 323 unittest.expect(o.visualStyle, unittest.equals('foo')); |
| 324 } |
| 325 buildCounterGetIosPostInstallAttributionRequest--; |
| 326 } |
| 327 |
| 328 core.int buildCounterGetIosPostInstallAttributionResponse = 0; |
| 329 buildGetIosPostInstallAttributionResponse() { |
| 330 var o = new api.GetIosPostInstallAttributionResponse(); |
| 331 buildCounterGetIosPostInstallAttributionResponse++; |
| 332 if (buildCounterGetIosPostInstallAttributionResponse < 3) { |
| 333 o.appMinimumVersion = "foo"; |
| 334 o.attributionConfidence = "foo"; |
| 335 o.deepLink = "foo"; |
| 336 o.externalBrowserDestinationLink = "foo"; |
| 337 o.fallbackLink = "foo"; |
| 338 o.invitationId = "foo"; |
| 339 o.isStrongMatchExecutable = true; |
| 340 o.matchMessage = "foo"; |
| 341 o.requestedLink = "foo"; |
| 342 o.resolvedLink = "foo"; |
| 343 o.utmCampaign = "foo"; |
| 344 o.utmMedium = "foo"; |
| 345 o.utmSource = "foo"; |
| 346 } |
| 347 buildCounterGetIosPostInstallAttributionResponse--; |
| 348 return o; |
| 349 } |
| 350 |
| 351 checkGetIosPostInstallAttributionResponse( |
| 352 api.GetIosPostInstallAttributionResponse o) { |
| 353 buildCounterGetIosPostInstallAttributionResponse++; |
| 354 if (buildCounterGetIosPostInstallAttributionResponse < 3) { |
| 355 unittest.expect(o.appMinimumVersion, unittest.equals('foo')); |
| 356 unittest.expect(o.attributionConfidence, unittest.equals('foo')); |
| 357 unittest.expect(o.deepLink, unittest.equals('foo')); |
| 358 unittest.expect(o.externalBrowserDestinationLink, unittest.equals('foo')); |
| 359 unittest.expect(o.fallbackLink, unittest.equals('foo')); |
| 360 unittest.expect(o.invitationId, unittest.equals('foo')); |
| 361 unittest.expect(o.isStrongMatchExecutable, unittest.isTrue); |
| 362 unittest.expect(o.matchMessage, unittest.equals('foo')); |
| 363 unittest.expect(o.requestedLink, unittest.equals('foo')); |
| 364 unittest.expect(o.resolvedLink, unittest.equals('foo')); |
| 365 unittest.expect(o.utmCampaign, unittest.equals('foo')); |
| 366 unittest.expect(o.utmMedium, unittest.equals('foo')); |
| 367 unittest.expect(o.utmSource, unittest.equals('foo')); |
| 368 } |
| 369 buildCounterGetIosPostInstallAttributionResponse--; |
| 370 } |
| 371 |
| 268 core.int buildCounterGooglePlayAnalytics = 0; | 372 core.int buildCounterGooglePlayAnalytics = 0; |
| 269 buildGooglePlayAnalytics() { | 373 buildGooglePlayAnalytics() { |
| 270 var o = new api.GooglePlayAnalytics(); | 374 var o = new api.GooglePlayAnalytics(); |
| 271 buildCounterGooglePlayAnalytics++; | 375 buildCounterGooglePlayAnalytics++; |
| 272 if (buildCounterGooglePlayAnalytics < 3) { | 376 if (buildCounterGooglePlayAnalytics < 3) { |
| 273 o.gclid = "foo"; | 377 o.gclid = "foo"; |
| 274 o.utmCampaign = "foo"; | 378 o.utmCampaign = "foo"; |
| 275 o.utmContent = "foo"; | 379 o.utmContent = "foo"; |
| 276 o.utmMedium = "foo"; | 380 o.utmMedium = "foo"; |
| 277 o.utmSource = "foo"; | 381 o.utmSource = "foo"; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 506 } |
| 403 | 507 |
| 404 checkSuffix(api.Suffix o) { | 508 checkSuffix(api.Suffix o) { |
| 405 buildCounterSuffix++; | 509 buildCounterSuffix++; |
| 406 if (buildCounterSuffix < 3) { | 510 if (buildCounterSuffix < 3) { |
| 407 unittest.expect(o.option, unittest.equals('foo')); | 511 unittest.expect(o.option, unittest.equals('foo')); |
| 408 } | 512 } |
| 409 buildCounterSuffix--; | 513 buildCounterSuffix--; |
| 410 } | 514 } |
| 411 | 515 |
| 412 | |
| 413 main() { | 516 main() { |
| 414 unittest.group("obj-schema-AnalyticsInfo", () { | 517 unittest.group("obj-schema-AnalyticsInfo", () { |
| 415 unittest.test("to-json--from-json", () { | 518 unittest.test("to-json--from-json", () { |
| 416 var o = buildAnalyticsInfo(); | 519 var o = buildAnalyticsInfo(); |
| 417 var od = new api.AnalyticsInfo.fromJson(o.toJson()); | 520 var od = new api.AnalyticsInfo.fromJson(o.toJson()); |
| 418 checkAnalyticsInfo(od); | 521 checkAnalyticsInfo(od); |
| 419 }); | 522 }); |
| 420 }); | 523 }); |
| 421 | 524 |
| 422 | |
| 423 unittest.group("obj-schema-AndroidInfo", () { | 525 unittest.group("obj-schema-AndroidInfo", () { |
| 424 unittest.test("to-json--from-json", () { | 526 unittest.test("to-json--from-json", () { |
| 425 var o = buildAndroidInfo(); | 527 var o = buildAndroidInfo(); |
| 426 var od = new api.AndroidInfo.fromJson(o.toJson()); | 528 var od = new api.AndroidInfo.fromJson(o.toJson()); |
| 427 checkAndroidInfo(od); | 529 checkAndroidInfo(od); |
| 428 }); | 530 }); |
| 429 }); | 531 }); |
| 430 | 532 |
| 431 | |
| 432 unittest.group("obj-schema-CreateShortDynamicLinkRequest", () { | 533 unittest.group("obj-schema-CreateShortDynamicLinkRequest", () { |
| 433 unittest.test("to-json--from-json", () { | 534 unittest.test("to-json--from-json", () { |
| 434 var o = buildCreateShortDynamicLinkRequest(); | 535 var o = buildCreateShortDynamicLinkRequest(); |
| 435 var od = new api.CreateShortDynamicLinkRequest.fromJson(o.toJson()); | 536 var od = new api.CreateShortDynamicLinkRequest.fromJson(o.toJson()); |
| 436 checkCreateShortDynamicLinkRequest(od); | 537 checkCreateShortDynamicLinkRequest(od); |
| 437 }); | 538 }); |
| 438 }); | 539 }); |
| 439 | 540 |
| 440 | |
| 441 unittest.group("obj-schema-CreateShortDynamicLinkResponse", () { | 541 unittest.group("obj-schema-CreateShortDynamicLinkResponse", () { |
| 442 unittest.test("to-json--from-json", () { | 542 unittest.test("to-json--from-json", () { |
| 443 var o = buildCreateShortDynamicLinkResponse(); | 543 var o = buildCreateShortDynamicLinkResponse(); |
| 444 var od = new api.CreateShortDynamicLinkResponse.fromJson(o.toJson()); | 544 var od = new api.CreateShortDynamicLinkResponse.fromJson(o.toJson()); |
| 445 checkCreateShortDynamicLinkResponse(od); | 545 checkCreateShortDynamicLinkResponse(od); |
| 446 }); | 546 }); |
| 447 }); | 547 }); |
| 448 | 548 |
| 549 unittest.group("obj-schema-DeviceInfo", () { |
| 550 unittest.test("to-json--from-json", () { |
| 551 var o = buildDeviceInfo(); |
| 552 var od = new api.DeviceInfo.fromJson(o.toJson()); |
| 553 checkDeviceInfo(od); |
| 554 }); |
| 555 }); |
| 449 | 556 |
| 450 unittest.group("obj-schema-DynamicLinkEventStat", () { | 557 unittest.group("obj-schema-DynamicLinkEventStat", () { |
| 451 unittest.test("to-json--from-json", () { | 558 unittest.test("to-json--from-json", () { |
| 452 var o = buildDynamicLinkEventStat(); | 559 var o = buildDynamicLinkEventStat(); |
| 453 var od = new api.DynamicLinkEventStat.fromJson(o.toJson()); | 560 var od = new api.DynamicLinkEventStat.fromJson(o.toJson()); |
| 454 checkDynamicLinkEventStat(od); | 561 checkDynamicLinkEventStat(od); |
| 455 }); | 562 }); |
| 456 }); | 563 }); |
| 457 | 564 |
| 458 | |
| 459 unittest.group("obj-schema-DynamicLinkInfo", () { | 565 unittest.group("obj-schema-DynamicLinkInfo", () { |
| 460 unittest.test("to-json--from-json", () { | 566 unittest.test("to-json--from-json", () { |
| 461 var o = buildDynamicLinkInfo(); | 567 var o = buildDynamicLinkInfo(); |
| 462 var od = new api.DynamicLinkInfo.fromJson(o.toJson()); | 568 var od = new api.DynamicLinkInfo.fromJson(o.toJson()); |
| 463 checkDynamicLinkInfo(od); | 569 checkDynamicLinkInfo(od); |
| 464 }); | 570 }); |
| 465 }); | 571 }); |
| 466 | 572 |
| 467 | |
| 468 unittest.group("obj-schema-DynamicLinkStats", () { | 573 unittest.group("obj-schema-DynamicLinkStats", () { |
| 469 unittest.test("to-json--from-json", () { | 574 unittest.test("to-json--from-json", () { |
| 470 var o = buildDynamicLinkStats(); | 575 var o = buildDynamicLinkStats(); |
| 471 var od = new api.DynamicLinkStats.fromJson(o.toJson()); | 576 var od = new api.DynamicLinkStats.fromJson(o.toJson()); |
| 472 checkDynamicLinkStats(od); | 577 checkDynamicLinkStats(od); |
| 473 }); | 578 }); |
| 474 }); | 579 }); |
| 475 | 580 |
| 476 | |
| 477 unittest.group("obj-schema-DynamicLinkWarning", () { | 581 unittest.group("obj-schema-DynamicLinkWarning", () { |
| 478 unittest.test("to-json--from-json", () { | 582 unittest.test("to-json--from-json", () { |
| 479 var o = buildDynamicLinkWarning(); | 583 var o = buildDynamicLinkWarning(); |
| 480 var od = new api.DynamicLinkWarning.fromJson(o.toJson()); | 584 var od = new api.DynamicLinkWarning.fromJson(o.toJson()); |
| 481 checkDynamicLinkWarning(od); | 585 checkDynamicLinkWarning(od); |
| 482 }); | 586 }); |
| 483 }); | 587 }); |
| 484 | 588 |
| 589 unittest.group("obj-schema-GetIosPostInstallAttributionRequest", () { |
| 590 unittest.test("to-json--from-json", () { |
| 591 var o = buildGetIosPostInstallAttributionRequest(); |
| 592 var od = new api.GetIosPostInstallAttributionRequest.fromJson(o.toJson()); |
| 593 checkGetIosPostInstallAttributionRequest(od); |
| 594 }); |
| 595 }); |
| 596 |
| 597 unittest.group("obj-schema-GetIosPostInstallAttributionResponse", () { |
| 598 unittest.test("to-json--from-json", () { |
| 599 var o = buildGetIosPostInstallAttributionResponse(); |
| 600 var od = |
| 601 new api.GetIosPostInstallAttributionResponse.fromJson(o.toJson()); |
| 602 checkGetIosPostInstallAttributionResponse(od); |
| 603 }); |
| 604 }); |
| 485 | 605 |
| 486 unittest.group("obj-schema-GooglePlayAnalytics", () { | 606 unittest.group("obj-schema-GooglePlayAnalytics", () { |
| 487 unittest.test("to-json--from-json", () { | 607 unittest.test("to-json--from-json", () { |
| 488 var o = buildGooglePlayAnalytics(); | 608 var o = buildGooglePlayAnalytics(); |
| 489 var od = new api.GooglePlayAnalytics.fromJson(o.toJson()); | 609 var od = new api.GooglePlayAnalytics.fromJson(o.toJson()); |
| 490 checkGooglePlayAnalytics(od); | 610 checkGooglePlayAnalytics(od); |
| 491 }); | 611 }); |
| 492 }); | 612 }); |
| 493 | 613 |
| 494 | |
| 495 unittest.group("obj-schema-ITunesConnectAnalytics", () { | 614 unittest.group("obj-schema-ITunesConnectAnalytics", () { |
| 496 unittest.test("to-json--from-json", () { | 615 unittest.test("to-json--from-json", () { |
| 497 var o = buildITunesConnectAnalytics(); | 616 var o = buildITunesConnectAnalytics(); |
| 498 var od = new api.ITunesConnectAnalytics.fromJson(o.toJson()); | 617 var od = new api.ITunesConnectAnalytics.fromJson(o.toJson()); |
| 499 checkITunesConnectAnalytics(od); | 618 checkITunesConnectAnalytics(od); |
| 500 }); | 619 }); |
| 501 }); | 620 }); |
| 502 | 621 |
| 503 | |
| 504 unittest.group("obj-schema-IosInfo", () { | 622 unittest.group("obj-schema-IosInfo", () { |
| 505 unittest.test("to-json--from-json", () { | 623 unittest.test("to-json--from-json", () { |
| 506 var o = buildIosInfo(); | 624 var o = buildIosInfo(); |
| 507 var od = new api.IosInfo.fromJson(o.toJson()); | 625 var od = new api.IosInfo.fromJson(o.toJson()); |
| 508 checkIosInfo(od); | 626 checkIosInfo(od); |
| 509 }); | 627 }); |
| 510 }); | 628 }); |
| 511 | 629 |
| 512 | |
| 513 unittest.group("obj-schema-NavigationInfo", () { | 630 unittest.group("obj-schema-NavigationInfo", () { |
| 514 unittest.test("to-json--from-json", () { | 631 unittest.test("to-json--from-json", () { |
| 515 var o = buildNavigationInfo(); | 632 var o = buildNavigationInfo(); |
| 516 var od = new api.NavigationInfo.fromJson(o.toJson()); | 633 var od = new api.NavigationInfo.fromJson(o.toJson()); |
| 517 checkNavigationInfo(od); | 634 checkNavigationInfo(od); |
| 518 }); | 635 }); |
| 519 }); | 636 }); |
| 520 | 637 |
| 521 | |
| 522 unittest.group("obj-schema-SocialMetaTagInfo", () { | 638 unittest.group("obj-schema-SocialMetaTagInfo", () { |
| 523 unittest.test("to-json--from-json", () { | 639 unittest.test("to-json--from-json", () { |
| 524 var o = buildSocialMetaTagInfo(); | 640 var o = buildSocialMetaTagInfo(); |
| 525 var od = new api.SocialMetaTagInfo.fromJson(o.toJson()); | 641 var od = new api.SocialMetaTagInfo.fromJson(o.toJson()); |
| 526 checkSocialMetaTagInfo(od); | 642 checkSocialMetaTagInfo(od); |
| 527 }); | 643 }); |
| 528 }); | 644 }); |
| 529 | 645 |
| 530 | |
| 531 unittest.group("obj-schema-Suffix", () { | 646 unittest.group("obj-schema-Suffix", () { |
| 532 unittest.test("to-json--from-json", () { | 647 unittest.test("to-json--from-json", () { |
| 533 var o = buildSuffix(); | 648 var o = buildSuffix(); |
| 534 var od = new api.Suffix.fromJson(o.toJson()); | 649 var od = new api.Suffix.fromJson(o.toJson()); |
| 535 checkSuffix(od); | 650 checkSuffix(od); |
| 536 }); | 651 }); |
| 537 }); | 652 }); |
| 538 | 653 |
| 539 | |
| 540 unittest.group("resource-ShortLinksResourceApi", () { | 654 unittest.group("resource-ShortLinksResourceApi", () { |
| 541 unittest.test("method--create", () { | 655 unittest.test("method--create", () { |
| 542 | |
| 543 var mock = new HttpServerMock(); | 656 var mock = new HttpServerMock(); |
| 544 api.ShortLinksResourceApi res = new api.FirebasedynamiclinksApi(mock).shor
tLinks; | 657 api.ShortLinksResourceApi res = |
| 658 new api.FirebasedynamiclinksApi(mock).shortLinks; |
| 545 var arg_request = buildCreateShortDynamicLinkRequest(); | 659 var arg_request = buildCreateShortDynamicLinkRequest(); |
| 546 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 660 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 547 var obj = new api.CreateShortDynamicLinkRequest.fromJson(json); | 661 var obj = new api.CreateShortDynamicLinkRequest.fromJson(json); |
| 548 checkCreateShortDynamicLinkRequest(obj); | 662 checkCreateShortDynamicLinkRequest(obj); |
| 549 | 663 |
| 550 var path = (req.url).path; | 664 var path = (req.url).path; |
| 551 var pathOffset = 0; | 665 var pathOffset = 0; |
| 552 var index; | 666 var index; |
| 553 var subPart; | 667 var subPart; |
| 554 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 668 unittest.expect( |
| 669 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 555 pathOffset += 1; | 670 pathOffset += 1; |
| 556 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("v1/shortLinks")); | 671 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 672 unittest.equals("v1/shortLinks")); |
| 557 pathOffset += 13; | 673 pathOffset += 13; |
| 558 | 674 |
| 559 var query = (req.url).query; | 675 var query = (req.url).query; |
| 560 var queryOffset = 0; | 676 var queryOffset = 0; |
| 561 var queryMap = {}; | 677 var queryMap = {}; |
| 562 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 678 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 563 parseBool(n) { | 679 parseBool(n) { |
| 564 if (n == "true") return true; | 680 if (n == "true") return true; |
| 565 if (n == "false") return false; | 681 if (n == "false") return false; |
| 566 if (n == null) return null; | 682 if (n == null) return null; |
| 567 throw new core.ArgumentError("Invalid boolean: $n"); | 683 throw new core.ArgumentError("Invalid boolean: $n"); |
| 568 } | 684 } |
| 685 |
| 569 if (query.length > 0) { | 686 if (query.length > 0) { |
| 570 for (var part in query.split("&")) { | 687 for (var part in query.split("&")) { |
| 571 var keyvalue = part.split("="); | 688 var keyvalue = part.split("="); |
| 572 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 689 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 690 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 573 } | 691 } |
| 574 } | 692 } |
| 575 | 693 |
| 576 | |
| 577 var h = { | 694 var h = { |
| 578 "content-type" : "application/json; charset=utf-8", | 695 "content-type": "application/json; charset=utf-8", |
| 579 }; | 696 }; |
| 580 var resp = convert.JSON.encode(buildCreateShortDynamicLinkResponse()); | 697 var resp = convert.JSON.encode(buildCreateShortDynamicLinkResponse()); |
| 581 return new async.Future.value(stringResponse(200, h, resp)); | 698 return new async.Future.value(stringResponse(200, h, resp)); |
| 582 }), true); | 699 }), true); |
| 583 res.create(arg_request).then(unittest.expectAsync1(((api.CreateShortDynami
cLinkResponse response) { | 700 res.create(arg_request).then( |
| 701 unittest.expectAsync1(((api.CreateShortDynamicLinkResponse response) { |
| 584 checkCreateShortDynamicLinkResponse(response); | 702 checkCreateShortDynamicLinkResponse(response); |
| 585 }))); | 703 }))); |
| 586 }); | 704 }); |
| 587 | |
| 588 }); | 705 }); |
| 589 | 706 |
| 590 | |
| 591 unittest.group("resource-V1ResourceApi", () { | 707 unittest.group("resource-V1ResourceApi", () { |
| 592 unittest.test("method--getLinkStats", () { | 708 unittest.test("method--getLinkStats", () { |
| 593 | |
| 594 var mock = new HttpServerMock(); | 709 var mock = new HttpServerMock(); |
| 595 api.V1ResourceApi res = new api.FirebasedynamiclinksApi(mock).v1; | 710 api.V1ResourceApi res = new api.FirebasedynamiclinksApi(mock).v1; |
| 596 var arg_dynamicLink = "foo"; | 711 var arg_dynamicLink = "foo"; |
| 597 var arg_durationDays = "foo"; | 712 var arg_durationDays = "foo"; |
| 598 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 713 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 599 var path = (req.url).path; | 714 var path = (req.url).path; |
| 600 var pathOffset = 0; | 715 var pathOffset = 0; |
| 601 var index; | 716 var index; |
| 602 var subPart; | 717 var subPart; |
| 603 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 718 unittest.expect( |
| 719 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 604 pathOffset += 1; | 720 pathOffset += 1; |
| 605 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 721 unittest.expect( |
| 722 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
| 606 pathOffset += 3; | 723 pathOffset += 3; |
| 607 index = path.indexOf("/linkStats", pathOffset); | 724 index = path.indexOf("/linkStats", pathOffset); |
| 608 unittest.expect(index >= 0, unittest.isTrue); | 725 unittest.expect(index >= 0, unittest.isTrue); |
| 609 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 726 subPart = |
| 727 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 610 pathOffset = index; | 728 pathOffset = index; |
| 611 unittest.expect(subPart, unittest.equals("$arg_dynamicLink")); | 729 unittest.expect(subPart, unittest.equals("$arg_dynamicLink")); |
| 612 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq
uals("/linkStats")); | 730 unittest.expect(path.substring(pathOffset, pathOffset + 10), |
| 731 unittest.equals("/linkStats")); |
| 613 pathOffset += 10; | 732 pathOffset += 10; |
| 614 | 733 |
| 615 var query = (req.url).query; | 734 var query = (req.url).query; |
| 616 var queryOffset = 0; | 735 var queryOffset = 0; |
| 617 var queryMap = {}; | 736 var queryMap = {}; |
| 618 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 737 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 619 parseBool(n) { | 738 parseBool(n) { |
| 620 if (n == "true") return true; | 739 if (n == "true") return true; |
| 621 if (n == "false") return false; | 740 if (n == "false") return false; |
| 622 if (n == null) return null; | 741 if (n == null) return null; |
| 623 throw new core.ArgumentError("Invalid boolean: $n"); | 742 throw new core.ArgumentError("Invalid boolean: $n"); |
| 624 } | 743 } |
| 744 |
| 625 if (query.length > 0) { | 745 if (query.length > 0) { |
| 626 for (var part in query.split("&")) { | 746 for (var part in query.split("&")) { |
| 627 var keyvalue = part.split("="); | 747 var keyvalue = part.split("="); |
| 628 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 748 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 749 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 629 } | 750 } |
| 630 } | 751 } |
| 631 unittest.expect(queryMap["durationDays"].first, unittest.equals(arg_dura
tionDays)); | 752 unittest.expect( |
| 632 | 753 queryMap["durationDays"].first, unittest.equals(arg_durationDays)); |
| 633 | 754 |
| 634 var h = { | 755 var h = { |
| 635 "content-type" : "application/json; charset=utf-8", | 756 "content-type": "application/json; charset=utf-8", |
| 636 }; | 757 }; |
| 637 var resp = convert.JSON.encode(buildDynamicLinkStats()); | 758 var resp = convert.JSON.encode(buildDynamicLinkStats()); |
| 638 return new async.Future.value(stringResponse(200, h, resp)); | 759 return new async.Future.value(stringResponse(200, h, resp)); |
| 639 }), true); | 760 }), true); |
| 640 res.getLinkStats(arg_dynamicLink, durationDays: arg_durationDays).then(uni
ttest.expectAsync1(((api.DynamicLinkStats response) { | 761 res |
| 762 .getLinkStats(arg_dynamicLink, durationDays: arg_durationDays) |
| 763 .then(unittest.expectAsync1(((api.DynamicLinkStats response) { |
| 641 checkDynamicLinkStats(response); | 764 checkDynamicLinkStats(response); |
| 642 }))); | 765 }))); |
| 643 }); | 766 }); |
| 644 | 767 |
| 768 unittest.test("method--installAttribution", () { |
| 769 var mock = new HttpServerMock(); |
| 770 api.V1ResourceApi res = new api.FirebasedynamiclinksApi(mock).v1; |
| 771 var arg_request = buildGetIosPostInstallAttributionRequest(); |
| 772 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 773 var obj = new api.GetIosPostInstallAttributionRequest.fromJson(json); |
| 774 checkGetIosPostInstallAttributionRequest(obj); |
| 775 |
| 776 var path = (req.url).path; |
| 777 var pathOffset = 0; |
| 778 var index; |
| 779 var subPart; |
| 780 unittest.expect( |
| 781 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 782 pathOffset += 1; |
| 783 unittest.expect(path.substring(pathOffset, pathOffset + 21), |
| 784 unittest.equals("v1/installAttribution")); |
| 785 pathOffset += 21; |
| 786 |
| 787 var query = (req.url).query; |
| 788 var queryOffset = 0; |
| 789 var queryMap = {}; |
| 790 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 791 parseBool(n) { |
| 792 if (n == "true") return true; |
| 793 if (n == "false") return false; |
| 794 if (n == null) return null; |
| 795 throw new core.ArgumentError("Invalid boolean: $n"); |
| 796 } |
| 797 |
| 798 if (query.length > 0) { |
| 799 for (var part in query.split("&")) { |
| 800 var keyvalue = part.split("="); |
| 801 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 802 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 803 } |
| 804 } |
| 805 |
| 806 var h = { |
| 807 "content-type": "application/json; charset=utf-8", |
| 808 }; |
| 809 var resp = |
| 810 convert.JSON.encode(buildGetIosPostInstallAttributionResponse()); |
| 811 return new async.Future.value(stringResponse(200, h, resp)); |
| 812 }), true); |
| 813 res.installAttribution(arg_request).then(unittest |
| 814 .expectAsync1(((api.GetIosPostInstallAttributionResponse response) { |
| 815 checkGetIosPostInstallAttributionResponse(response); |
| 816 }))); |
| 817 }); |
| 645 }); | 818 }); |
| 646 | |
| 647 | |
| 648 } | 819 } |
| 649 | |
| OLD | NEW |