| OLD | NEW |
| 1 library googleapis.freebase.v1.test; | 1 library googleapis.freebase.v1.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; | |
| 12 import 'package:googleapis/src/common_internal.dart' as common_internal; | |
| 13 import '../common/common_internal_test.dart' as common_test; | |
| 14 | 11 |
| 15 import 'package:googleapis/freebase/v1.dart' as api; | 12 import 'package:googleapis/freebase/v1.dart' as api; |
| 16 | 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 22 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 18 | 53 |
| 19 core.int buildCounterReconcileCandidateNotable = 0; | 54 core.int buildCounterReconcileCandidateNotable = 0; |
| 20 buildReconcileCandidateNotable() { | 55 buildReconcileCandidateNotable() { |
| 21 var o = new api.ReconcileCandidateNotable(); | 56 var o = new api.ReconcileCandidateNotable(); |
| 22 buildCounterReconcileCandidateNotable++; | 57 buildCounterReconcileCandidateNotable++; |
| 23 if (buildCounterReconcileCandidateNotable < 3) { | 58 if (buildCounterReconcileCandidateNotable < 3) { |
| 24 o.id = "foo"; | 59 o.id = "foo"; |
| 25 o.name = "foo"; | 60 o.name = "foo"; |
| 26 } | 61 } |
| 27 buildCounterReconcileCandidateNotable--; | 62 buildCounterReconcileCandidateNotable--; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 57 if (buildCounterReconcileCandidate < 3) { | 92 if (buildCounterReconcileCandidate < 3) { |
| 58 unittest.expect(o.confidence, unittest.equals(42.0)); | 93 unittest.expect(o.confidence, unittest.equals(42.0)); |
| 59 unittest.expect(o.lang, unittest.equals('foo')); | 94 unittest.expect(o.lang, unittest.equals('foo')); |
| 60 unittest.expect(o.mid, unittest.equals('foo')); | 95 unittest.expect(o.mid, unittest.equals('foo')); |
| 61 unittest.expect(o.name, unittest.equals('foo')); | 96 unittest.expect(o.name, unittest.equals('foo')); |
| 62 checkReconcileCandidateNotable(o.notable); | 97 checkReconcileCandidateNotable(o.notable); |
| 63 } | 98 } |
| 64 buildCounterReconcileCandidate--; | 99 buildCounterReconcileCandidate--; |
| 65 } | 100 } |
| 66 | 101 |
| 67 buildUnnamed1045() { | 102 buildUnnamed1019() { |
| 68 var o = new core.List<api.ReconcileCandidate>(); | 103 var o = new core.List<api.ReconcileCandidate>(); |
| 69 o.add(buildReconcileCandidate()); | 104 o.add(buildReconcileCandidate()); |
| 70 o.add(buildReconcileCandidate()); | 105 o.add(buildReconcileCandidate()); |
| 71 return o; | 106 return o; |
| 72 } | 107 } |
| 73 | 108 |
| 74 checkUnnamed1045(core.List<api.ReconcileCandidate> o) { | 109 checkUnnamed1019(core.List<api.ReconcileCandidate> o) { |
| 75 unittest.expect(o, unittest.hasLength(2)); | 110 unittest.expect(o, unittest.hasLength(2)); |
| 76 checkReconcileCandidate(o[0]); | 111 checkReconcileCandidate(o[0]); |
| 77 checkReconcileCandidate(o[1]); | 112 checkReconcileCandidate(o[1]); |
| 78 } | 113 } |
| 79 | 114 |
| 80 core.int buildCounterReconcileGetCosts = 0; | 115 core.int buildCounterReconcileGetCosts = 0; |
| 81 buildReconcileGetCosts() { | 116 buildReconcileGetCosts() { |
| 82 var o = new api.ReconcileGetCosts(); | 117 var o = new api.ReconcileGetCosts(); |
| 83 buildCounterReconcileGetCosts++; | 118 buildCounterReconcileGetCosts++; |
| 84 if (buildCounterReconcileGetCosts < 3) { | 119 if (buildCounterReconcileGetCosts < 3) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 114 checkReconcileGetWarning(api.ReconcileGetWarning o) { | 149 checkReconcileGetWarning(api.ReconcileGetWarning o) { |
| 115 buildCounterReconcileGetWarning++; | 150 buildCounterReconcileGetWarning++; |
| 116 if (buildCounterReconcileGetWarning < 3) { | 151 if (buildCounterReconcileGetWarning < 3) { |
| 117 unittest.expect(o.location, unittest.equals('foo')); | 152 unittest.expect(o.location, unittest.equals('foo')); |
| 118 unittest.expect(o.message, unittest.equals('foo')); | 153 unittest.expect(o.message, unittest.equals('foo')); |
| 119 unittest.expect(o.reason, unittest.equals('foo')); | 154 unittest.expect(o.reason, unittest.equals('foo')); |
| 120 } | 155 } |
| 121 buildCounterReconcileGetWarning--; | 156 buildCounterReconcileGetWarning--; |
| 122 } | 157 } |
| 123 | 158 |
| 124 buildUnnamed1046() { | 159 buildUnnamed1020() { |
| 125 var o = new core.List<api.ReconcileGetWarning>(); | 160 var o = new core.List<api.ReconcileGetWarning>(); |
| 126 o.add(buildReconcileGetWarning()); | 161 o.add(buildReconcileGetWarning()); |
| 127 o.add(buildReconcileGetWarning()); | 162 o.add(buildReconcileGetWarning()); |
| 128 return o; | 163 return o; |
| 129 } | 164 } |
| 130 | 165 |
| 131 checkUnnamed1046(core.List<api.ReconcileGetWarning> o) { | 166 checkUnnamed1020(core.List<api.ReconcileGetWarning> o) { |
| 132 unittest.expect(o, unittest.hasLength(2)); | 167 unittest.expect(o, unittest.hasLength(2)); |
| 133 checkReconcileGetWarning(o[0]); | 168 checkReconcileGetWarning(o[0]); |
| 134 checkReconcileGetWarning(o[1]); | 169 checkReconcileGetWarning(o[1]); |
| 135 } | 170 } |
| 136 | 171 |
| 137 core.int buildCounterReconcileGet = 0; | 172 core.int buildCounterReconcileGet = 0; |
| 138 buildReconcileGet() { | 173 buildReconcileGet() { |
| 139 var o = new api.ReconcileGet(); | 174 var o = new api.ReconcileGet(); |
| 140 buildCounterReconcileGet++; | 175 buildCounterReconcileGet++; |
| 141 if (buildCounterReconcileGet < 3) { | 176 if (buildCounterReconcileGet < 3) { |
| 142 o.candidate = buildUnnamed1045(); | 177 o.candidate = buildUnnamed1019(); |
| 143 o.costs = buildReconcileGetCosts(); | 178 o.costs = buildReconcileGetCosts(); |
| 144 o.match = buildReconcileCandidate(); | 179 o.match = buildReconcileCandidate(); |
| 145 o.warning = buildUnnamed1046(); | 180 o.warning = buildUnnamed1020(); |
| 146 } | 181 } |
| 147 buildCounterReconcileGet--; | 182 buildCounterReconcileGet--; |
| 148 return o; | 183 return o; |
| 149 } | 184 } |
| 150 | 185 |
| 151 checkReconcileGet(api.ReconcileGet o) { | 186 checkReconcileGet(api.ReconcileGet o) { |
| 152 buildCounterReconcileGet++; | 187 buildCounterReconcileGet++; |
| 153 if (buildCounterReconcileGet < 3) { | 188 if (buildCounterReconcileGet < 3) { |
| 154 checkUnnamed1045(o.candidate); | 189 checkUnnamed1019(o.candidate); |
| 155 checkReconcileGetCosts(o.costs); | 190 checkReconcileGetCosts(o.costs); |
| 156 checkReconcileCandidate(o.match); | 191 checkReconcileCandidate(o.match); |
| 157 checkUnnamed1046(o.warning); | 192 checkUnnamed1020(o.warning); |
| 158 } | 193 } |
| 159 buildCounterReconcileGet--; | 194 buildCounterReconcileGet--; |
| 160 } | 195 } |
| 161 | 196 |
| 162 buildUnnamed1047() { | 197 buildUnnamed1021() { |
| 163 var o = new core.List<core.String>(); | 198 var o = new core.List<core.String>(); |
| 164 o.add("foo"); | 199 o.add("foo"); |
| 165 o.add("foo"); | 200 o.add("foo"); |
| 166 return o; | 201 return o; |
| 167 } | 202 } |
| 168 | 203 |
| 169 checkUnnamed1047(core.List<core.String> o) { | 204 checkUnnamed1021(core.List<core.String> o) { |
| 170 unittest.expect(o, unittest.hasLength(2)); | 205 unittest.expect(o, unittest.hasLength(2)); |
| 171 unittest.expect(o[0], unittest.equals('foo')); | 206 unittest.expect(o[0], unittest.equals('foo')); |
| 172 unittest.expect(o[1], unittest.equals('foo')); | 207 unittest.expect(o[1], unittest.equals('foo')); |
| 173 } | 208 } |
| 174 | 209 |
| 175 buildUnnamed1048() { | 210 buildUnnamed1022() { |
| 176 var o = new core.List<core.String>(); | 211 var o = new core.List<core.String>(); |
| 177 o.add("foo"); | 212 o.add("foo"); |
| 178 o.add("foo"); | 213 o.add("foo"); |
| 179 return o; | 214 return o; |
| 180 } | 215 } |
| 181 | 216 |
| 182 checkUnnamed1048(core.List<core.String> o) { | 217 checkUnnamed1022(core.List<core.String> o) { |
| 183 unittest.expect(o, unittest.hasLength(2)); | 218 unittest.expect(o, unittest.hasLength(2)); |
| 184 unittest.expect(o[0], unittest.equals('foo')); | 219 unittest.expect(o[0], unittest.equals('foo')); |
| 185 unittest.expect(o[1], unittest.equals('foo')); | 220 unittest.expect(o[1], unittest.equals('foo')); |
| 186 } | 221 } |
| 187 | 222 |
| 188 buildUnnamed1049() { | 223 buildUnnamed1023() { |
| 189 var o = new core.List<core.String>(); | 224 var o = new core.List<core.String>(); |
| 190 o.add("foo"); | 225 o.add("foo"); |
| 191 o.add("foo"); | 226 o.add("foo"); |
| 192 return o; | 227 return o; |
| 193 } | 228 } |
| 194 | 229 |
| 195 checkUnnamed1049(core.List<core.String> o) { | 230 checkUnnamed1023(core.List<core.String> o) { |
| 196 unittest.expect(o, unittest.hasLength(2)); | 231 unittest.expect(o, unittest.hasLength(2)); |
| 197 unittest.expect(o[0], unittest.equals('foo')); | 232 unittest.expect(o[0], unittest.equals('foo')); |
| 198 unittest.expect(o[1], unittest.equals('foo')); | 233 unittest.expect(o[1], unittest.equals('foo')); |
| 199 } | 234 } |
| 200 | 235 |
| 201 buildUnnamed1050() { | 236 buildUnnamed1024() { |
| 202 var o = new core.List<core.String>(); | 237 var o = new core.List<core.String>(); |
| 203 o.add("foo"); | 238 o.add("foo"); |
| 204 o.add("foo"); | 239 o.add("foo"); |
| 205 return o; | 240 return o; |
| 206 } | 241 } |
| 207 | 242 |
| 208 checkUnnamed1050(core.List<core.String> o) { | 243 checkUnnamed1024(core.List<core.String> o) { |
| 209 unittest.expect(o, unittest.hasLength(2)); | 244 unittest.expect(o, unittest.hasLength(2)); |
| 210 unittest.expect(o[0], unittest.equals('foo')); | 245 unittest.expect(o[0], unittest.equals('foo')); |
| 211 unittest.expect(o[1], unittest.equals('foo')); | 246 unittest.expect(o[1], unittest.equals('foo')); |
| 212 } | 247 } |
| 213 | 248 |
| 214 buildUnnamed1051() { | 249 buildUnnamed1025() { |
| 215 var o = new core.List<core.String>(); | 250 var o = new core.List<core.String>(); |
| 216 o.add("foo"); | 251 o.add("foo"); |
| 217 o.add("foo"); | 252 o.add("foo"); |
| 218 return o; | 253 return o; |
| 219 } | 254 } |
| 220 | 255 |
| 221 checkUnnamed1051(core.List<core.String> o) { | 256 checkUnnamed1025(core.List<core.String> o) { |
| 222 unittest.expect(o, unittest.hasLength(2)); | 257 unittest.expect(o, unittest.hasLength(2)); |
| 223 unittest.expect(o[0], unittest.equals('foo')); | 258 unittest.expect(o[0], unittest.equals('foo')); |
| 224 unittest.expect(o[1], unittest.equals('foo')); | 259 unittest.expect(o[1], unittest.equals('foo')); |
| 225 } | 260 } |
| 226 | 261 |
| 227 buildUnnamed1052() { | 262 buildUnnamed1026() { |
| 228 var o = new core.List<core.String>(); | 263 var o = new core.List<core.String>(); |
| 229 o.add("foo"); | 264 o.add("foo"); |
| 230 o.add("foo"); | 265 o.add("foo"); |
| 231 return o; | 266 return o; |
| 232 } | 267 } |
| 233 | 268 |
| 234 checkUnnamed1052(core.List<core.String> o) { | 269 checkUnnamed1026(core.List<core.String> o) { |
| 235 unittest.expect(o, unittest.hasLength(2)); | 270 unittest.expect(o, unittest.hasLength(2)); |
| 236 unittest.expect(o[0], unittest.equals('foo')); | 271 unittest.expect(o[0], unittest.equals('foo')); |
| 237 unittest.expect(o[1], unittest.equals('foo')); | 272 unittest.expect(o[1], unittest.equals('foo')); |
| 238 } | 273 } |
| 239 | 274 |
| 240 buildUnnamed1053() { | 275 buildUnnamed1027() { |
| 241 var o = new core.List<core.String>(); | 276 var o = new core.List<core.String>(); |
| 242 o.add("foo"); | 277 o.add("foo"); |
| 243 o.add("foo"); | 278 o.add("foo"); |
| 244 return o; | 279 return o; |
| 245 } | 280 } |
| 246 | 281 |
| 247 checkUnnamed1053(core.List<core.String> o) { | 282 checkUnnamed1027(core.List<core.String> o) { |
| 248 unittest.expect(o, unittest.hasLength(2)); | 283 unittest.expect(o, unittest.hasLength(2)); |
| 249 unittest.expect(o[0], unittest.equals('foo')); | 284 unittest.expect(o[0], unittest.equals('foo')); |
| 250 unittest.expect(o[1], unittest.equals('foo')); | 285 unittest.expect(o[1], unittest.equals('foo')); |
| 251 } | 286 } |
| 252 | 287 |
| 253 buildUnnamed1054() { | 288 buildUnnamed1028() { |
| 254 var o = new core.List<core.String>(); | 289 var o = new core.List<core.String>(); |
| 255 o.add("foo"); | 290 o.add("foo"); |
| 256 o.add("foo"); | 291 o.add("foo"); |
| 257 return o; | 292 return o; |
| 258 } | 293 } |
| 259 | 294 |
| 260 checkUnnamed1054(core.List<core.String> o) { | 295 checkUnnamed1028(core.List<core.String> o) { |
| 261 unittest.expect(o, unittest.hasLength(2)); | 296 unittest.expect(o, unittest.hasLength(2)); |
| 262 unittest.expect(o[0], unittest.equals('foo')); | 297 unittest.expect(o[0], unittest.equals('foo')); |
| 263 unittest.expect(o[1], unittest.equals('foo')); | 298 unittest.expect(o[1], unittest.equals('foo')); |
| 264 } | 299 } |
| 265 | 300 |
| 266 buildUnnamed1055() { | 301 buildUnnamed1029() { |
| 267 var o = new core.List<core.String>(); | 302 var o = new core.List<core.String>(); |
| 268 o.add("foo"); | 303 o.add("foo"); |
| 269 o.add("foo"); | 304 o.add("foo"); |
| 270 return o; | 305 return o; |
| 271 } | 306 } |
| 272 | 307 |
| 273 checkUnnamed1055(core.List<core.String> o) { | 308 checkUnnamed1029(core.List<core.String> o) { |
| 274 unittest.expect(o, unittest.hasLength(2)); | 309 unittest.expect(o, unittest.hasLength(2)); |
| 275 unittest.expect(o[0], unittest.equals('foo')); | 310 unittest.expect(o[0], unittest.equals('foo')); |
| 276 unittest.expect(o[1], unittest.equals('foo')); | 311 unittest.expect(o[1], unittest.equals('foo')); |
| 277 } | 312 } |
| 278 | 313 |
| 279 buildUnnamed1056() { | 314 buildUnnamed1030() { |
| 280 var o = new core.List<core.String>(); | 315 var o = new core.List<core.String>(); |
| 281 o.add("foo"); | 316 o.add("foo"); |
| 282 o.add("foo"); | 317 o.add("foo"); |
| 283 return o; | 318 return o; |
| 284 } | 319 } |
| 285 | 320 |
| 286 checkUnnamed1056(core.List<core.String> o) { | 321 checkUnnamed1030(core.List<core.String> o) { |
| 287 unittest.expect(o, unittest.hasLength(2)); | 322 unittest.expect(o, unittest.hasLength(2)); |
| 288 unittest.expect(o[0], unittest.equals('foo')); | 323 unittest.expect(o[0], unittest.equals('foo')); |
| 289 unittest.expect(o[1], unittest.equals('foo')); | 324 unittest.expect(o[1], unittest.equals('foo')); |
| 290 } | 325 } |
| 291 | 326 |
| 292 | 327 |
| 293 main() { | 328 main() { |
| 294 unittest.group("obj-schema-ReconcileCandidateNotable", () { | 329 unittest.group("obj-schema-ReconcileCandidateNotable", () { |
| 295 unittest.test("to-json--from-json", () { | 330 unittest.test("to-json--from-json", () { |
| 296 var o = buildReconcileCandidateNotable(); | 331 var o = buildReconcileCandidateNotable(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 var o = buildReconcileGet(); | 367 var o = buildReconcileGet(); |
| 333 var od = new api.ReconcileGet.fromJson(o.toJson()); | 368 var od = new api.ReconcileGet.fromJson(o.toJson()); |
| 334 checkReconcileGet(od); | 369 checkReconcileGet(od); |
| 335 }); | 370 }); |
| 336 }); | 371 }); |
| 337 | 372 |
| 338 | 373 |
| 339 unittest.group("resource-FreebaseApi", () { | 374 unittest.group("resource-FreebaseApi", () { |
| 340 unittest.test("method--reconcile", () { | 375 unittest.test("method--reconcile", () { |
| 341 | 376 |
| 342 var mock = new common_test.HttpServerMock(); | 377 var mock = new HttpServerMock(); |
| 343 api.FreebaseApi res = new api.FreebaseApi(mock); | 378 api.FreebaseApi res = new api.FreebaseApi(mock); |
| 344 var arg_confidence = 42.0; | 379 var arg_confidence = 42.0; |
| 345 var arg_kind = buildUnnamed1047(); | 380 var arg_kind = buildUnnamed1021(); |
| 346 var arg_lang = buildUnnamed1048(); | 381 var arg_lang = buildUnnamed1022(); |
| 347 var arg_limit = 42; | 382 var arg_limit = 42; |
| 348 var arg_name = "foo"; | 383 var arg_name = "foo"; |
| 349 var arg_prop = buildUnnamed1049(); | 384 var arg_prop = buildUnnamed1023(); |
| 350 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 385 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 351 var path = (req.url).path; | 386 var path = (req.url).path; |
| 352 var pathOffset = 0; | 387 var pathOffset = 0; |
| 353 var index; | 388 var index; |
| 354 var subPart; | 389 var subPart; |
| 355 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 390 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 356 pathOffset += 1; | 391 pathOffset += 1; |
| 357 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("freebase/v1/")); | 392 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("freebase/v1/")); |
| 358 pathOffset += 12; | 393 pathOffset += 12; |
| 359 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("reconcile")); | 394 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als("reconcile")); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 380 unittest.expect(queryMap["lang"], unittest.equals(arg_lang)); | 415 unittest.expect(queryMap["lang"], unittest.equals(arg_lang)); |
| 381 unittest.expect(core.int.parse(queryMap["limit"].first), unittest.equals
(arg_limit)); | 416 unittest.expect(core.int.parse(queryMap["limit"].first), unittest.equals
(arg_limit)); |
| 382 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); | 417 unittest.expect(queryMap["name"].first, unittest.equals(arg_name)); |
| 383 unittest.expect(queryMap["prop"], unittest.equals(arg_prop)); | 418 unittest.expect(queryMap["prop"], unittest.equals(arg_prop)); |
| 384 | 419 |
| 385 | 420 |
| 386 var h = { | 421 var h = { |
| 387 "content-type" : "application/json; charset=utf-8", | 422 "content-type" : "application/json; charset=utf-8", |
| 388 }; | 423 }; |
| 389 var resp = convert.JSON.encode(buildReconcileGet()); | 424 var resp = convert.JSON.encode(buildReconcileGet()); |
| 390 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 425 return new async.Future.value(stringResponse(200, h, resp)); |
| 391 }), true); | 426 }), true); |
| 392 res.reconcile(confidence: arg_confidence, kind: arg_kind, lang: arg_lang,
limit: arg_limit, name: arg_name, prop: arg_prop).then(unittest.expectAsync(((ap
i.ReconcileGet response) { | 427 res.reconcile(confidence: arg_confidence, kind: arg_kind, lang: arg_lang,
limit: arg_limit, name: arg_name, prop: arg_prop).then(unittest.expectAsync(((ap
i.ReconcileGet response) { |
| 393 checkReconcileGet(response); | 428 checkReconcileGet(response); |
| 394 }))); | 429 }))); |
| 395 }); | 430 }); |
| 396 | 431 |
| 397 unittest.test("method--search", () { | 432 unittest.test("method--search", () { |
| 398 // TODO: Implement tests for media upload; | 433 // TODO: Implement tests for media upload; |
| 399 // TODO: Implement tests for media download; | 434 // TODO: Implement tests for media download; |
| 400 | 435 |
| 401 var mock = new common_test.HttpServerMock(); | 436 var mock = new HttpServerMock(); |
| 402 api.FreebaseApi res = new api.FreebaseApi(mock); | 437 api.FreebaseApi res = new api.FreebaseApi(mock); |
| 403 var arg_asOfTime = "foo"; | 438 var arg_asOfTime = "foo"; |
| 404 var arg_callback = "foo"; | 439 var arg_callback = "foo"; |
| 405 var arg_cursor = 42; | 440 var arg_cursor = 42; |
| 406 var arg_domain = buildUnnamed1050(); | 441 var arg_domain = buildUnnamed1024(); |
| 407 var arg_encode = "foo"; | 442 var arg_encode = "foo"; |
| 408 var arg_exact = true; | 443 var arg_exact = true; |
| 409 var arg_filter = buildUnnamed1051(); | 444 var arg_filter = buildUnnamed1025(); |
| 410 var arg_format = "foo"; | 445 var arg_format = "foo"; |
| 411 var arg_help = "foo"; | 446 var arg_help = "foo"; |
| 412 var arg_indent = true; | 447 var arg_indent = true; |
| 413 var arg_lang = buildUnnamed1052(); | 448 var arg_lang = buildUnnamed1026(); |
| 414 var arg_limit = 42; | 449 var arg_limit = 42; |
| 415 var arg_mid = buildUnnamed1053(); | 450 var arg_mid = buildUnnamed1027(); |
| 416 var arg_mqlOutput = "foo"; | 451 var arg_mqlOutput = "foo"; |
| 417 var arg_output = "foo"; | 452 var arg_output = "foo"; |
| 418 var arg_prefixed = true; | 453 var arg_prefixed = true; |
| 419 var arg_query = "foo"; | 454 var arg_query = "foo"; |
| 420 var arg_scoring = "foo"; | 455 var arg_scoring = "foo"; |
| 421 var arg_spell = "foo"; | 456 var arg_spell = "foo"; |
| 422 var arg_stemmed = true; | 457 var arg_stemmed = true; |
| 423 var arg_type = buildUnnamed1054(); | 458 var arg_type = buildUnnamed1028(); |
| 424 var arg_with_ = buildUnnamed1055(); | 459 var arg_with_ = buildUnnamed1029(); |
| 425 var arg_without = buildUnnamed1056(); | 460 var arg_without = buildUnnamed1030(); |
| 426 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 461 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 427 var path = (req.url).path; | 462 var path = (req.url).path; |
| 428 var pathOffset = 0; | 463 var pathOffset = 0; |
| 429 var index; | 464 var index; |
| 430 var subPart; | 465 var subPart; |
| 431 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 466 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 432 pathOffset += 1; | 467 pathOffset += 1; |
| 433 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("freebase/v1/")); | 468 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("freebase/v1/")); |
| 434 pathOffset += 12; | 469 pathOffset += 12; |
| 435 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("search")); | 470 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("search")); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 unittest.expect(queryMap["stemmed"].first, unittest.equals("$arg_stemmed
")); | 508 unittest.expect(queryMap["stemmed"].first, unittest.equals("$arg_stemmed
")); |
| 474 unittest.expect(queryMap["type"], unittest.equals(arg_type)); | 509 unittest.expect(queryMap["type"], unittest.equals(arg_type)); |
| 475 unittest.expect(queryMap["with"], unittest.equals(arg_with_)); | 510 unittest.expect(queryMap["with"], unittest.equals(arg_with_)); |
| 476 unittest.expect(queryMap["without"], unittest.equals(arg_without)); | 511 unittest.expect(queryMap["without"], unittest.equals(arg_without)); |
| 477 | 512 |
| 478 | 513 |
| 479 var h = { | 514 var h = { |
| 480 "content-type" : "application/json; charset=utf-8", | 515 "content-type" : "application/json; charset=utf-8", |
| 481 }; | 516 }; |
| 482 var resp = ""; | 517 var resp = ""; |
| 483 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 518 return new async.Future.value(stringResponse(200, h, resp)); |
| 484 }), true); | 519 }), true); |
| 485 res.search(asOfTime: arg_asOfTime, callback: arg_callback, cursor: arg_cur
sor, domain: arg_domain, encode: arg_encode, exact: arg_exact, filter: arg_filte
r, format: arg_format, help: arg_help, indent: arg_indent, lang: arg_lang, limit
: arg_limit, mid: arg_mid, mqlOutput: arg_mqlOutput, output: arg_output, prefixe
d: arg_prefixed, query: arg_query, scoring: arg_scoring, spell: arg_spell, stemm
ed: arg_stemmed, type: arg_type, with_: arg_with_, without: arg_without).then(un
ittest.expectAsync((_) {})); | 520 res.search(asOfTime: arg_asOfTime, callback: arg_callback, cursor: arg_cur
sor, domain: arg_domain, encode: arg_encode, exact: arg_exact, filter: arg_filte
r, format: arg_format, help: arg_help, indent: arg_indent, lang: arg_lang, limit
: arg_limit, mid: arg_mid, mqlOutput: arg_mqlOutput, output: arg_output, prefixe
d: arg_prefixed, query: arg_query, scoring: arg_scoring, spell: arg_spell, stemm
ed: arg_stemmed, type: arg_type, with_: arg_with_, without: arg_without).then(un
ittest.expectAsync((_) {})); |
| 486 }); | 521 }); |
| 487 | 522 |
| 488 }); | 523 }); |
| 489 | 524 |
| 490 | 525 |
| 491 } | 526 } |
| 492 | 527 |
| OLD | NEW |