| OLD | NEW |
| 1 library googleapis.translate.v2.test; | 1 library googleapis.translate.v2.test; |
| 2 | 2 |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; | 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
| 7 | 7 |
| 8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
| 10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
| 11 import 'package:googleapis/common/common.dart' as common; | 11 import 'package:googleapis/common/common.dart' as common; |
| 12 import 'package:googleapis/src/common_internal.dart' as common_internal; | 12 import 'package:googleapis/src/common_internal.dart' as common_internal; |
| 13 import '../common/common_internal_test.dart' as common_test; | 13 import '../common/common_internal_test.dart' as common_test; |
| 14 | 14 |
| 15 import 'package:googleapis/translate/v2.dart' as api; | 15 import 'package:googleapis/translate/v2.dart' as api; |
| 16 | 16 |
| 17 | 17 |
| 18 | 18 |
| 19 buildUnnamed792() { | 19 buildUnnamed441() { |
| 20 var o = new core.List<api.DetectionsResource>(); | 20 var o = new core.List<api.DetectionsResource>(); |
| 21 o.add(buildDetectionsResource()); | 21 o.add(buildDetectionsResource()); |
| 22 o.add(buildDetectionsResource()); | 22 o.add(buildDetectionsResource()); |
| 23 return o; | 23 return o; |
| 24 } | 24 } |
| 25 | 25 |
| 26 checkUnnamed792(core.List<api.DetectionsResource> o) { | 26 checkUnnamed441(core.List<api.DetectionsResource> o) { |
| 27 unittest.expect(o, unittest.hasLength(2)); | 27 unittest.expect(o, unittest.hasLength(2)); |
| 28 checkDetectionsResource(o[0]); | 28 checkDetectionsResource(o[0]); |
| 29 checkDetectionsResource(o[1]); | 29 checkDetectionsResource(o[1]); |
| 30 } | 30 } |
| 31 | 31 |
| 32 core.int buildCounterDetectionsListResponse = 0; | 32 core.int buildCounterDetectionsListResponse = 0; |
| 33 buildDetectionsListResponse() { | 33 buildDetectionsListResponse() { |
| 34 var o = new api.DetectionsListResponse(); | 34 var o = new api.DetectionsListResponse(); |
| 35 buildCounterDetectionsListResponse++; | 35 buildCounterDetectionsListResponse++; |
| 36 if (buildCounterDetectionsListResponse < 3) { | 36 if (buildCounterDetectionsListResponse < 3) { |
| 37 o.detections = buildUnnamed792(); | 37 o.detections = buildUnnamed441(); |
| 38 } | 38 } |
| 39 buildCounterDetectionsListResponse--; | 39 buildCounterDetectionsListResponse--; |
| 40 return o; | 40 return o; |
| 41 } | 41 } |
| 42 | 42 |
| 43 checkDetectionsListResponse(api.DetectionsListResponse o) { | 43 checkDetectionsListResponse(api.DetectionsListResponse o) { |
| 44 buildCounterDetectionsListResponse++; | 44 buildCounterDetectionsListResponse++; |
| 45 if (buildCounterDetectionsListResponse < 3) { | 45 if (buildCounterDetectionsListResponse < 3) { |
| 46 checkUnnamed792(o.detections); | 46 checkUnnamed441(o.detections); |
| 47 } | 47 } |
| 48 buildCounterDetectionsListResponse--; | 48 buildCounterDetectionsListResponse--; |
| 49 } | 49 } |
| 50 | 50 |
| 51 core.int buildCounterDetectionsResourceElement = 0; | 51 core.int buildCounterDetectionsResourceElement = 0; |
| 52 buildDetectionsResourceElement() { | 52 buildDetectionsResourceElement() { |
| 53 var o = new api.DetectionsResourceElement(); | 53 var o = new api.DetectionsResourceElement(); |
| 54 buildCounterDetectionsResourceElement++; | 54 buildCounterDetectionsResourceElement++; |
| 55 if (buildCounterDetectionsResourceElement < 3) { | 55 if (buildCounterDetectionsResourceElement < 3) { |
| 56 o.confidence = 42.0; | 56 o.confidence = 42.0; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 o.add(buildDetectionsResourceElement()); | 77 o.add(buildDetectionsResourceElement()); |
| 78 return o; | 78 return o; |
| 79 } | 79 } |
| 80 | 80 |
| 81 checkDetectionsResource(api.DetectionsResource o) { | 81 checkDetectionsResource(api.DetectionsResource o) { |
| 82 unittest.expect(o, unittest.hasLength(2)); | 82 unittest.expect(o, unittest.hasLength(2)); |
| 83 checkDetectionsResourceElement(o[0]); | 83 checkDetectionsResourceElement(o[0]); |
| 84 checkDetectionsResourceElement(o[1]); | 84 checkDetectionsResourceElement(o[1]); |
| 85 } | 85 } |
| 86 | 86 |
| 87 buildUnnamed793() { | 87 buildUnnamed442() { |
| 88 var o = new core.List<api.LanguagesResource>(); | 88 var o = new core.List<api.LanguagesResource>(); |
| 89 o.add(buildLanguagesResource()); | 89 o.add(buildLanguagesResource()); |
| 90 o.add(buildLanguagesResource()); | 90 o.add(buildLanguagesResource()); |
| 91 return o; | 91 return o; |
| 92 } | 92 } |
| 93 | 93 |
| 94 checkUnnamed793(core.List<api.LanguagesResource> o) { | 94 checkUnnamed442(core.List<api.LanguagesResource> o) { |
| 95 unittest.expect(o, unittest.hasLength(2)); | 95 unittest.expect(o, unittest.hasLength(2)); |
| 96 checkLanguagesResource(o[0]); | 96 checkLanguagesResource(o[0]); |
| 97 checkLanguagesResource(o[1]); | 97 checkLanguagesResource(o[1]); |
| 98 } | 98 } |
| 99 | 99 |
| 100 core.int buildCounterLanguagesListResponse = 0; | 100 core.int buildCounterLanguagesListResponse = 0; |
| 101 buildLanguagesListResponse() { | 101 buildLanguagesListResponse() { |
| 102 var o = new api.LanguagesListResponse(); | 102 var o = new api.LanguagesListResponse(); |
| 103 buildCounterLanguagesListResponse++; | 103 buildCounterLanguagesListResponse++; |
| 104 if (buildCounterLanguagesListResponse < 3) { | 104 if (buildCounterLanguagesListResponse < 3) { |
| 105 o.languages = buildUnnamed793(); | 105 o.languages = buildUnnamed442(); |
| 106 } | 106 } |
| 107 buildCounterLanguagesListResponse--; | 107 buildCounterLanguagesListResponse--; |
| 108 return o; | 108 return o; |
| 109 } | 109 } |
| 110 | 110 |
| 111 checkLanguagesListResponse(api.LanguagesListResponse o) { | 111 checkLanguagesListResponse(api.LanguagesListResponse o) { |
| 112 buildCounterLanguagesListResponse++; | 112 buildCounterLanguagesListResponse++; |
| 113 if (buildCounterLanguagesListResponse < 3) { | 113 if (buildCounterLanguagesListResponse < 3) { |
| 114 checkUnnamed793(o.languages); | 114 checkUnnamed442(o.languages); |
| 115 } | 115 } |
| 116 buildCounterLanguagesListResponse--; | 116 buildCounterLanguagesListResponse--; |
| 117 } | 117 } |
| 118 | 118 |
| 119 core.int buildCounterLanguagesResource = 0; | 119 core.int buildCounterLanguagesResource = 0; |
| 120 buildLanguagesResource() { | 120 buildLanguagesResource() { |
| 121 var o = new api.LanguagesResource(); | 121 var o = new api.LanguagesResource(); |
| 122 buildCounterLanguagesResource++; | 122 buildCounterLanguagesResource++; |
| 123 if (buildCounterLanguagesResource < 3) { | 123 if (buildCounterLanguagesResource < 3) { |
| 124 o.language = "foo"; | 124 o.language = "foo"; |
| 125 o.name = "foo"; | 125 o.name = "foo"; |
| 126 } | 126 } |
| 127 buildCounterLanguagesResource--; | 127 buildCounterLanguagesResource--; |
| 128 return o; | 128 return o; |
| 129 } | 129 } |
| 130 | 130 |
| 131 checkLanguagesResource(api.LanguagesResource o) { | 131 checkLanguagesResource(api.LanguagesResource o) { |
| 132 buildCounterLanguagesResource++; | 132 buildCounterLanguagesResource++; |
| 133 if (buildCounterLanguagesResource < 3) { | 133 if (buildCounterLanguagesResource < 3) { |
| 134 unittest.expect(o.language, unittest.equals('foo')); | 134 unittest.expect(o.language, unittest.equals('foo')); |
| 135 unittest.expect(o.name, unittest.equals('foo')); | 135 unittest.expect(o.name, unittest.equals('foo')); |
| 136 } | 136 } |
| 137 buildCounterLanguagesResource--; | 137 buildCounterLanguagesResource--; |
| 138 } | 138 } |
| 139 | 139 |
| 140 buildUnnamed794() { | 140 buildUnnamed443() { |
| 141 var o = new core.List<api.TranslationsResource>(); | 141 var o = new core.List<api.TranslationsResource>(); |
| 142 o.add(buildTranslationsResource()); | 142 o.add(buildTranslationsResource()); |
| 143 o.add(buildTranslationsResource()); | 143 o.add(buildTranslationsResource()); |
| 144 return o; | 144 return o; |
| 145 } | 145 } |
| 146 | 146 |
| 147 checkUnnamed794(core.List<api.TranslationsResource> o) { | 147 checkUnnamed443(core.List<api.TranslationsResource> o) { |
| 148 unittest.expect(o, unittest.hasLength(2)); | 148 unittest.expect(o, unittest.hasLength(2)); |
| 149 checkTranslationsResource(o[0]); | 149 checkTranslationsResource(o[0]); |
| 150 checkTranslationsResource(o[1]); | 150 checkTranslationsResource(o[1]); |
| 151 } | 151 } |
| 152 | 152 |
| 153 core.int buildCounterTranslationsListResponse = 0; | 153 core.int buildCounterTranslationsListResponse = 0; |
| 154 buildTranslationsListResponse() { | 154 buildTranslationsListResponse() { |
| 155 var o = new api.TranslationsListResponse(); | 155 var o = new api.TranslationsListResponse(); |
| 156 buildCounterTranslationsListResponse++; | 156 buildCounterTranslationsListResponse++; |
| 157 if (buildCounterTranslationsListResponse < 3) { | 157 if (buildCounterTranslationsListResponse < 3) { |
| 158 o.translations = buildUnnamed794(); | 158 o.translations = buildUnnamed443(); |
| 159 } | 159 } |
| 160 buildCounterTranslationsListResponse--; | 160 buildCounterTranslationsListResponse--; |
| 161 return o; | 161 return o; |
| 162 } | 162 } |
| 163 | 163 |
| 164 checkTranslationsListResponse(api.TranslationsListResponse o) { | 164 checkTranslationsListResponse(api.TranslationsListResponse o) { |
| 165 buildCounterTranslationsListResponse++; | 165 buildCounterTranslationsListResponse++; |
| 166 if (buildCounterTranslationsListResponse < 3) { | 166 if (buildCounterTranslationsListResponse < 3) { |
| 167 checkUnnamed794(o.translations); | 167 checkUnnamed443(o.translations); |
| 168 } | 168 } |
| 169 buildCounterTranslationsListResponse--; | 169 buildCounterTranslationsListResponse--; |
| 170 } | 170 } |
| 171 | 171 |
| 172 core.int buildCounterTranslationsResource = 0; | 172 core.int buildCounterTranslationsResource = 0; |
| 173 buildTranslationsResource() { | 173 buildTranslationsResource() { |
| 174 var o = new api.TranslationsResource(); | 174 var o = new api.TranslationsResource(); |
| 175 buildCounterTranslationsResource++; | 175 buildCounterTranslationsResource++; |
| 176 if (buildCounterTranslationsResource < 3) { | 176 if (buildCounterTranslationsResource < 3) { |
| 177 o.detectedSourceLanguage = "foo"; | 177 o.detectedSourceLanguage = "foo"; |
| 178 o.translatedText = "foo"; | 178 o.translatedText = "foo"; |
| 179 } | 179 } |
| 180 buildCounterTranslationsResource--; | 180 buildCounterTranslationsResource--; |
| 181 return o; | 181 return o; |
| 182 } | 182 } |
| 183 | 183 |
| 184 checkTranslationsResource(api.TranslationsResource o) { | 184 checkTranslationsResource(api.TranslationsResource o) { |
| 185 buildCounterTranslationsResource++; | 185 buildCounterTranslationsResource++; |
| 186 if (buildCounterTranslationsResource < 3) { | 186 if (buildCounterTranslationsResource < 3) { |
| 187 unittest.expect(o.detectedSourceLanguage, unittest.equals('foo')); | 187 unittest.expect(o.detectedSourceLanguage, unittest.equals('foo')); |
| 188 unittest.expect(o.translatedText, unittest.equals('foo')); | 188 unittest.expect(o.translatedText, unittest.equals('foo')); |
| 189 } | 189 } |
| 190 buildCounterTranslationsResource--; | 190 buildCounterTranslationsResource--; |
| 191 } | 191 } |
| 192 | 192 |
| 193 buildUnnamed795() { | 193 buildUnnamed444() { |
| 194 var o = new core.List<core.String>(); | 194 var o = new core.List<core.String>(); |
| 195 o.add("foo"); | 195 o.add("foo"); |
| 196 o.add("foo"); | 196 o.add("foo"); |
| 197 return o; | 197 return o; |
| 198 } | 198 } |
| 199 | 199 |
| 200 checkUnnamed795(core.List<core.String> o) { | 200 checkUnnamed444(core.List<core.String> o) { |
| 201 unittest.expect(o, unittest.hasLength(2)); | 201 unittest.expect(o, unittest.hasLength(2)); |
| 202 unittest.expect(o[0], unittest.equals('foo')); | 202 unittest.expect(o[0], unittest.equals('foo')); |
| 203 unittest.expect(o[1], unittest.equals('foo')); | 203 unittest.expect(o[1], unittest.equals('foo')); |
| 204 } | 204 } |
| 205 | 205 |
| 206 buildUnnamed796() { | 206 buildUnnamed445() { |
| 207 var o = new core.List<core.String>(); | 207 var o = new core.List<core.String>(); |
| 208 o.add("foo"); | 208 o.add("foo"); |
| 209 o.add("foo"); | 209 o.add("foo"); |
| 210 return o; | 210 return o; |
| 211 } | 211 } |
| 212 | 212 |
| 213 checkUnnamed796(core.List<core.String> o) { | 213 checkUnnamed445(core.List<core.String> o) { |
| 214 unittest.expect(o, unittest.hasLength(2)); | 214 unittest.expect(o, unittest.hasLength(2)); |
| 215 unittest.expect(o[0], unittest.equals('foo')); | 215 unittest.expect(o[0], unittest.equals('foo')); |
| 216 unittest.expect(o[1], unittest.equals('foo')); | 216 unittest.expect(o[1], unittest.equals('foo')); |
| 217 } | 217 } |
| 218 | 218 |
| 219 buildUnnamed797() { | 219 buildUnnamed446() { |
| 220 var o = new core.List<core.String>(); | 220 var o = new core.List<core.String>(); |
| 221 o.add("foo"); | 221 o.add("foo"); |
| 222 o.add("foo"); | 222 o.add("foo"); |
| 223 return o; | 223 return o; |
| 224 } | 224 } |
| 225 | 225 |
| 226 checkUnnamed797(core.List<core.String> o) { | 226 checkUnnamed446(core.List<core.String> o) { |
| 227 unittest.expect(o, unittest.hasLength(2)); | 227 unittest.expect(o, unittest.hasLength(2)); |
| 228 unittest.expect(o[0], unittest.equals('foo')); | 228 unittest.expect(o[0], unittest.equals('foo')); |
| 229 unittest.expect(o[1], unittest.equals('foo')); | 229 unittest.expect(o[1], unittest.equals('foo')); |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 main() { | 233 main() { |
| 234 unittest.group("obj-schema-DetectionsListResponse", () { | 234 unittest.group("obj-schema-DetectionsListResponse", () { |
| 235 unittest.test("to-json--from-json", () { | 235 unittest.test("to-json--from-json", () { |
| 236 var o = buildDetectionsListResponse(); | 236 var o = buildDetectionsListResponse(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 checkTranslationsResource(od); | 292 checkTranslationsResource(od); |
| 293 }); | 293 }); |
| 294 }); | 294 }); |
| 295 | 295 |
| 296 | 296 |
| 297 unittest.group("resource-DetectionsResourceApi", () { | 297 unittest.group("resource-DetectionsResourceApi", () { |
| 298 unittest.test("method--list", () { | 298 unittest.test("method--list", () { |
| 299 | 299 |
| 300 var mock = new common_test.HttpServerMock(); | 300 var mock = new common_test.HttpServerMock(); |
| 301 api.DetectionsResourceApi res = new api.TranslateApi(mock).detections; | 301 api.DetectionsResourceApi res = new api.TranslateApi(mock).detections; |
| 302 var arg_q = buildUnnamed795(); | 302 var arg_q = buildUnnamed444(); |
| 303 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 303 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 304 var path = (req.url).path; | 304 var path = (req.url).path; |
| 305 var pathOffset = 0; | 305 var pathOffset = 0; |
| 306 var index; | 306 var index; |
| 307 var subPart; | 307 var subPart; |
| 308 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 308 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 309 pathOffset += 1; | 309 pathOffset += 1; |
| 310 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("language/translate/")); | 310 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("language/translate/")); |
| 311 pathOffset += 19; | 311 pathOffset += 19; |
| 312 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("v2/detect")); | 312 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("v2/detect")); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 }); | 394 }); |
| 395 | 395 |
| 396 }); | 396 }); |
| 397 | 397 |
| 398 | 398 |
| 399 unittest.group("resource-TranslationsResourceApi", () { | 399 unittest.group("resource-TranslationsResourceApi", () { |
| 400 unittest.test("method--list", () { | 400 unittest.test("method--list", () { |
| 401 | 401 |
| 402 var mock = new common_test.HttpServerMock(); | 402 var mock = new common_test.HttpServerMock(); |
| 403 api.TranslationsResourceApi res = new api.TranslateApi(mock).translations; | 403 api.TranslationsResourceApi res = new api.TranslateApi(mock).translations; |
| 404 var arg_q = buildUnnamed796(); | 404 var arg_q = buildUnnamed445(); |
| 405 var arg_target = "foo"; | 405 var arg_target = "foo"; |
| 406 var arg_cid = buildUnnamed797(); | 406 var arg_cid = buildUnnamed446(); |
| 407 var arg_format = "foo"; | 407 var arg_format = "foo"; |
| 408 var arg_source = "foo"; | 408 var arg_source = "foo"; |
| 409 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 409 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 410 var path = (req.url).path; | 410 var path = (req.url).path; |
| 411 var pathOffset = 0; | 411 var pathOffset = 0; |
| 412 var index; | 412 var index; |
| 413 var subPart; | 413 var subPart; |
| 414 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 414 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 415 pathOffset += 1; | 415 pathOffset += 1; |
| 416 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("language/translate/")); | 416 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("language/translate/")); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 res.list(arg_q, arg_target, cid: arg_cid, format: arg_format, source: arg_
source).then(unittest.expectAsync(((api.TranslationsListResponse response) { | 450 res.list(arg_q, arg_target, cid: arg_cid, format: arg_format, source: arg_
source).then(unittest.expectAsync(((api.TranslationsListResponse response) { |
| 451 checkTranslationsListResponse(response); | 451 checkTranslationsListResponse(response); |
| 452 }))); | 452 }))); |
| 453 }); | 453 }); |
| 454 | 454 |
| 455 }); | 455 }); |
| 456 | 456 |
| 457 | 457 |
| 458 } | 458 } |
| 459 | 459 |
| OLD | NEW |