OLD | NEW |
(Empty) | |
| 1 library googleapis.ml.v1.test; |
| 2 |
| 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; |
| 7 |
| 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; |
| 10 import 'package:unittest/unittest.dart' as unittest; |
| 11 |
| 12 import 'package:googleapis/ml/v1.dart' as api; |
| 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 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 } |
| 53 |
| 54 core.int buildCounterGoogleApiHttpBody = 0; |
| 55 buildGoogleApiHttpBody() { |
| 56 var o = new api.GoogleApiHttpBody(); |
| 57 buildCounterGoogleApiHttpBody++; |
| 58 if (buildCounterGoogleApiHttpBody < 3) { |
| 59 o.contentType = "foo"; |
| 60 o.data = "foo"; |
| 61 } |
| 62 buildCounterGoogleApiHttpBody--; |
| 63 return o; |
| 64 } |
| 65 |
| 66 checkGoogleApiHttpBody(api.GoogleApiHttpBody o) { |
| 67 buildCounterGoogleApiHttpBody++; |
| 68 if (buildCounterGoogleApiHttpBody < 3) { |
| 69 unittest.expect(o.contentType, unittest.equals('foo')); |
| 70 unittest.expect(o.data, unittest.equals('foo')); |
| 71 } |
| 72 buildCounterGoogleApiHttpBody--; |
| 73 } |
| 74 |
| 75 core.int buildCounterGoogleCloudMlV1HyperparameterOutputHyperparameterMetric = 0
; |
| 76 buildGoogleCloudMlV1HyperparameterOutputHyperparameterMetric() { |
| 77 var o = new api.GoogleCloudMlV1HyperparameterOutputHyperparameterMetric(); |
| 78 buildCounterGoogleCloudMlV1HyperparameterOutputHyperparameterMetric++; |
| 79 if (buildCounterGoogleCloudMlV1HyperparameterOutputHyperparameterMetric < 3) { |
| 80 o.objectiveValue = 42.0; |
| 81 o.trainingStep = "foo"; |
| 82 } |
| 83 buildCounterGoogleCloudMlV1HyperparameterOutputHyperparameterMetric--; |
| 84 return o; |
| 85 } |
| 86 |
| 87 checkGoogleCloudMlV1HyperparameterOutputHyperparameterMetric(api.GoogleCloudMlV1
HyperparameterOutputHyperparameterMetric o) { |
| 88 buildCounterGoogleCloudMlV1HyperparameterOutputHyperparameterMetric++; |
| 89 if (buildCounterGoogleCloudMlV1HyperparameterOutputHyperparameterMetric < 3) { |
| 90 unittest.expect(o.objectiveValue, unittest.equals(42.0)); |
| 91 unittest.expect(o.trainingStep, unittest.equals('foo')); |
| 92 } |
| 93 buildCounterGoogleCloudMlV1HyperparameterOutputHyperparameterMetric--; |
| 94 } |
| 95 |
| 96 core.int buildCounterGoogleCloudMlV1CancelJobRequest = 0; |
| 97 buildGoogleCloudMlV1CancelJobRequest() { |
| 98 var o = new api.GoogleCloudMlV1CancelJobRequest(); |
| 99 buildCounterGoogleCloudMlV1CancelJobRequest++; |
| 100 if (buildCounterGoogleCloudMlV1CancelJobRequest < 3) { |
| 101 } |
| 102 buildCounterGoogleCloudMlV1CancelJobRequest--; |
| 103 return o; |
| 104 } |
| 105 |
| 106 checkGoogleCloudMlV1CancelJobRequest(api.GoogleCloudMlV1CancelJobRequest o) { |
| 107 buildCounterGoogleCloudMlV1CancelJobRequest++; |
| 108 if (buildCounterGoogleCloudMlV1CancelJobRequest < 3) { |
| 109 } |
| 110 buildCounterGoogleCloudMlV1CancelJobRequest--; |
| 111 } |
| 112 |
| 113 core.int buildCounterGoogleCloudMlV1GetConfigResponse = 0; |
| 114 buildGoogleCloudMlV1GetConfigResponse() { |
| 115 var o = new api.GoogleCloudMlV1GetConfigResponse(); |
| 116 buildCounterGoogleCloudMlV1GetConfigResponse++; |
| 117 if (buildCounterGoogleCloudMlV1GetConfigResponse < 3) { |
| 118 o.serviceAccount = "foo"; |
| 119 o.serviceAccountProject = "foo"; |
| 120 } |
| 121 buildCounterGoogleCloudMlV1GetConfigResponse--; |
| 122 return o; |
| 123 } |
| 124 |
| 125 checkGoogleCloudMlV1GetConfigResponse(api.GoogleCloudMlV1GetConfigResponse o) { |
| 126 buildCounterGoogleCloudMlV1GetConfigResponse++; |
| 127 if (buildCounterGoogleCloudMlV1GetConfigResponse < 3) { |
| 128 unittest.expect(o.serviceAccount, unittest.equals('foo')); |
| 129 unittest.expect(o.serviceAccountProject, unittest.equals('foo')); |
| 130 } |
| 131 buildCounterGoogleCloudMlV1GetConfigResponse--; |
| 132 } |
| 133 |
| 134 buildUnnamed0() { |
| 135 var o = new core.List<api.GoogleCloudMlV1HyperparameterOutputHyperparameterMet
ric>(); |
| 136 o.add(buildGoogleCloudMlV1HyperparameterOutputHyperparameterMetric()); |
| 137 o.add(buildGoogleCloudMlV1HyperparameterOutputHyperparameterMetric()); |
| 138 return o; |
| 139 } |
| 140 |
| 141 checkUnnamed0(core.List<api.GoogleCloudMlV1HyperparameterOutputHyperparameterMet
ric> o) { |
| 142 unittest.expect(o, unittest.hasLength(2)); |
| 143 checkGoogleCloudMlV1HyperparameterOutputHyperparameterMetric(o[0]); |
| 144 checkGoogleCloudMlV1HyperparameterOutputHyperparameterMetric(o[1]); |
| 145 } |
| 146 |
| 147 buildUnnamed1() { |
| 148 var o = new core.Map<core.String, core.String>(); |
| 149 o["x"] = "foo"; |
| 150 o["y"] = "foo"; |
| 151 return o; |
| 152 } |
| 153 |
| 154 checkUnnamed1(core.Map<core.String, core.String> o) { |
| 155 unittest.expect(o, unittest.hasLength(2)); |
| 156 unittest.expect(o["x"], unittest.equals('foo')); |
| 157 unittest.expect(o["y"], unittest.equals('foo')); |
| 158 } |
| 159 |
| 160 core.int buildCounterGoogleCloudMlV1HyperparameterOutput = 0; |
| 161 buildGoogleCloudMlV1HyperparameterOutput() { |
| 162 var o = new api.GoogleCloudMlV1HyperparameterOutput(); |
| 163 buildCounterGoogleCloudMlV1HyperparameterOutput++; |
| 164 if (buildCounterGoogleCloudMlV1HyperparameterOutput < 3) { |
| 165 o.allMetrics = buildUnnamed0(); |
| 166 o.finalMetric = buildGoogleCloudMlV1HyperparameterOutputHyperparameterMetric
(); |
| 167 o.hyperparameters = buildUnnamed1(); |
| 168 o.trialId = "foo"; |
| 169 } |
| 170 buildCounterGoogleCloudMlV1HyperparameterOutput--; |
| 171 return o; |
| 172 } |
| 173 |
| 174 checkGoogleCloudMlV1HyperparameterOutput(api.GoogleCloudMlV1HyperparameterOutput
o) { |
| 175 buildCounterGoogleCloudMlV1HyperparameterOutput++; |
| 176 if (buildCounterGoogleCloudMlV1HyperparameterOutput < 3) { |
| 177 checkUnnamed0(o.allMetrics); |
| 178 checkGoogleCloudMlV1HyperparameterOutputHyperparameterMetric(o.finalMetric); |
| 179 checkUnnamed1(o.hyperparameters); |
| 180 unittest.expect(o.trialId, unittest.equals('foo')); |
| 181 } |
| 182 buildCounterGoogleCloudMlV1HyperparameterOutput--; |
| 183 } |
| 184 |
| 185 buildUnnamed2() { |
| 186 var o = new core.List<api.GoogleCloudMlV1ParameterSpec>(); |
| 187 o.add(buildGoogleCloudMlV1ParameterSpec()); |
| 188 o.add(buildGoogleCloudMlV1ParameterSpec()); |
| 189 return o; |
| 190 } |
| 191 |
| 192 checkUnnamed2(core.List<api.GoogleCloudMlV1ParameterSpec> o) { |
| 193 unittest.expect(o, unittest.hasLength(2)); |
| 194 checkGoogleCloudMlV1ParameterSpec(o[0]); |
| 195 checkGoogleCloudMlV1ParameterSpec(o[1]); |
| 196 } |
| 197 |
| 198 core.int buildCounterGoogleCloudMlV1HyperparameterSpec = 0; |
| 199 buildGoogleCloudMlV1HyperparameterSpec() { |
| 200 var o = new api.GoogleCloudMlV1HyperparameterSpec(); |
| 201 buildCounterGoogleCloudMlV1HyperparameterSpec++; |
| 202 if (buildCounterGoogleCloudMlV1HyperparameterSpec < 3) { |
| 203 o.goal = "foo"; |
| 204 o.hyperparameterMetricTag = "foo"; |
| 205 o.maxParallelTrials = 42; |
| 206 o.maxTrials = 42; |
| 207 o.params = buildUnnamed2(); |
| 208 } |
| 209 buildCounterGoogleCloudMlV1HyperparameterSpec--; |
| 210 return o; |
| 211 } |
| 212 |
| 213 checkGoogleCloudMlV1HyperparameterSpec(api.GoogleCloudMlV1HyperparameterSpec o)
{ |
| 214 buildCounterGoogleCloudMlV1HyperparameterSpec++; |
| 215 if (buildCounterGoogleCloudMlV1HyperparameterSpec < 3) { |
| 216 unittest.expect(o.goal, unittest.equals('foo')); |
| 217 unittest.expect(o.hyperparameterMetricTag, unittest.equals('foo')); |
| 218 unittest.expect(o.maxParallelTrials, unittest.equals(42)); |
| 219 unittest.expect(o.maxTrials, unittest.equals(42)); |
| 220 checkUnnamed2(o.params); |
| 221 } |
| 222 buildCounterGoogleCloudMlV1HyperparameterSpec--; |
| 223 } |
| 224 |
| 225 core.int buildCounterGoogleCloudMlV1Job = 0; |
| 226 buildGoogleCloudMlV1Job() { |
| 227 var o = new api.GoogleCloudMlV1Job(); |
| 228 buildCounterGoogleCloudMlV1Job++; |
| 229 if (buildCounterGoogleCloudMlV1Job < 3) { |
| 230 o.createTime = "foo"; |
| 231 o.endTime = "foo"; |
| 232 o.errorMessage = "foo"; |
| 233 o.jobId = "foo"; |
| 234 o.predictionInput = buildGoogleCloudMlV1PredictionInput(); |
| 235 o.predictionOutput = buildGoogleCloudMlV1PredictionOutput(); |
| 236 o.startTime = "foo"; |
| 237 o.state = "foo"; |
| 238 o.trainingInput = buildGoogleCloudMlV1TrainingInput(); |
| 239 o.trainingOutput = buildGoogleCloudMlV1TrainingOutput(); |
| 240 } |
| 241 buildCounterGoogleCloudMlV1Job--; |
| 242 return o; |
| 243 } |
| 244 |
| 245 checkGoogleCloudMlV1Job(api.GoogleCloudMlV1Job o) { |
| 246 buildCounterGoogleCloudMlV1Job++; |
| 247 if (buildCounterGoogleCloudMlV1Job < 3) { |
| 248 unittest.expect(o.createTime, unittest.equals('foo')); |
| 249 unittest.expect(o.endTime, unittest.equals('foo')); |
| 250 unittest.expect(o.errorMessage, unittest.equals('foo')); |
| 251 unittest.expect(o.jobId, unittest.equals('foo')); |
| 252 checkGoogleCloudMlV1PredictionInput(o.predictionInput); |
| 253 checkGoogleCloudMlV1PredictionOutput(o.predictionOutput); |
| 254 unittest.expect(o.startTime, unittest.equals('foo')); |
| 255 unittest.expect(o.state, unittest.equals('foo')); |
| 256 checkGoogleCloudMlV1TrainingInput(o.trainingInput); |
| 257 checkGoogleCloudMlV1TrainingOutput(o.trainingOutput); |
| 258 } |
| 259 buildCounterGoogleCloudMlV1Job--; |
| 260 } |
| 261 |
| 262 buildUnnamed3() { |
| 263 var o = new core.List<api.GoogleCloudMlV1Job>(); |
| 264 o.add(buildGoogleCloudMlV1Job()); |
| 265 o.add(buildGoogleCloudMlV1Job()); |
| 266 return o; |
| 267 } |
| 268 |
| 269 checkUnnamed3(core.List<api.GoogleCloudMlV1Job> o) { |
| 270 unittest.expect(o, unittest.hasLength(2)); |
| 271 checkGoogleCloudMlV1Job(o[0]); |
| 272 checkGoogleCloudMlV1Job(o[1]); |
| 273 } |
| 274 |
| 275 core.int buildCounterGoogleCloudMlV1ListJobsResponse = 0; |
| 276 buildGoogleCloudMlV1ListJobsResponse() { |
| 277 var o = new api.GoogleCloudMlV1ListJobsResponse(); |
| 278 buildCounterGoogleCloudMlV1ListJobsResponse++; |
| 279 if (buildCounterGoogleCloudMlV1ListJobsResponse < 3) { |
| 280 o.jobs = buildUnnamed3(); |
| 281 o.nextPageToken = "foo"; |
| 282 } |
| 283 buildCounterGoogleCloudMlV1ListJobsResponse--; |
| 284 return o; |
| 285 } |
| 286 |
| 287 checkGoogleCloudMlV1ListJobsResponse(api.GoogleCloudMlV1ListJobsResponse o) { |
| 288 buildCounterGoogleCloudMlV1ListJobsResponse++; |
| 289 if (buildCounterGoogleCloudMlV1ListJobsResponse < 3) { |
| 290 checkUnnamed3(o.jobs); |
| 291 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 292 } |
| 293 buildCounterGoogleCloudMlV1ListJobsResponse--; |
| 294 } |
| 295 |
| 296 buildUnnamed4() { |
| 297 var o = new core.List<api.GoogleCloudMlV1Model>(); |
| 298 o.add(buildGoogleCloudMlV1Model()); |
| 299 o.add(buildGoogleCloudMlV1Model()); |
| 300 return o; |
| 301 } |
| 302 |
| 303 checkUnnamed4(core.List<api.GoogleCloudMlV1Model> o) { |
| 304 unittest.expect(o, unittest.hasLength(2)); |
| 305 checkGoogleCloudMlV1Model(o[0]); |
| 306 checkGoogleCloudMlV1Model(o[1]); |
| 307 } |
| 308 |
| 309 core.int buildCounterGoogleCloudMlV1ListModelsResponse = 0; |
| 310 buildGoogleCloudMlV1ListModelsResponse() { |
| 311 var o = new api.GoogleCloudMlV1ListModelsResponse(); |
| 312 buildCounterGoogleCloudMlV1ListModelsResponse++; |
| 313 if (buildCounterGoogleCloudMlV1ListModelsResponse < 3) { |
| 314 o.models = buildUnnamed4(); |
| 315 o.nextPageToken = "foo"; |
| 316 } |
| 317 buildCounterGoogleCloudMlV1ListModelsResponse--; |
| 318 return o; |
| 319 } |
| 320 |
| 321 checkGoogleCloudMlV1ListModelsResponse(api.GoogleCloudMlV1ListModelsResponse o)
{ |
| 322 buildCounterGoogleCloudMlV1ListModelsResponse++; |
| 323 if (buildCounterGoogleCloudMlV1ListModelsResponse < 3) { |
| 324 checkUnnamed4(o.models); |
| 325 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 326 } |
| 327 buildCounterGoogleCloudMlV1ListModelsResponse--; |
| 328 } |
| 329 |
| 330 buildUnnamed5() { |
| 331 var o = new core.List<api.GoogleCloudMlV1Version>(); |
| 332 o.add(buildGoogleCloudMlV1Version()); |
| 333 o.add(buildGoogleCloudMlV1Version()); |
| 334 return o; |
| 335 } |
| 336 |
| 337 checkUnnamed5(core.List<api.GoogleCloudMlV1Version> o) { |
| 338 unittest.expect(o, unittest.hasLength(2)); |
| 339 checkGoogleCloudMlV1Version(o[0]); |
| 340 checkGoogleCloudMlV1Version(o[1]); |
| 341 } |
| 342 |
| 343 core.int buildCounterGoogleCloudMlV1ListVersionsResponse = 0; |
| 344 buildGoogleCloudMlV1ListVersionsResponse() { |
| 345 var o = new api.GoogleCloudMlV1ListVersionsResponse(); |
| 346 buildCounterGoogleCloudMlV1ListVersionsResponse++; |
| 347 if (buildCounterGoogleCloudMlV1ListVersionsResponse < 3) { |
| 348 o.nextPageToken = "foo"; |
| 349 o.versions = buildUnnamed5(); |
| 350 } |
| 351 buildCounterGoogleCloudMlV1ListVersionsResponse--; |
| 352 return o; |
| 353 } |
| 354 |
| 355 checkGoogleCloudMlV1ListVersionsResponse(api.GoogleCloudMlV1ListVersionsResponse
o) { |
| 356 buildCounterGoogleCloudMlV1ListVersionsResponse++; |
| 357 if (buildCounterGoogleCloudMlV1ListVersionsResponse < 3) { |
| 358 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 359 checkUnnamed5(o.versions); |
| 360 } |
| 361 buildCounterGoogleCloudMlV1ListVersionsResponse--; |
| 362 } |
| 363 |
| 364 core.int buildCounterGoogleCloudMlV1ManualScaling = 0; |
| 365 buildGoogleCloudMlV1ManualScaling() { |
| 366 var o = new api.GoogleCloudMlV1ManualScaling(); |
| 367 buildCounterGoogleCloudMlV1ManualScaling++; |
| 368 if (buildCounterGoogleCloudMlV1ManualScaling < 3) { |
| 369 o.nodes = 42; |
| 370 } |
| 371 buildCounterGoogleCloudMlV1ManualScaling--; |
| 372 return o; |
| 373 } |
| 374 |
| 375 checkGoogleCloudMlV1ManualScaling(api.GoogleCloudMlV1ManualScaling o) { |
| 376 buildCounterGoogleCloudMlV1ManualScaling++; |
| 377 if (buildCounterGoogleCloudMlV1ManualScaling < 3) { |
| 378 unittest.expect(o.nodes, unittest.equals(42)); |
| 379 } |
| 380 buildCounterGoogleCloudMlV1ManualScaling--; |
| 381 } |
| 382 |
| 383 buildUnnamed6() { |
| 384 var o = new core.List<core.String>(); |
| 385 o.add("foo"); |
| 386 o.add("foo"); |
| 387 return o; |
| 388 } |
| 389 |
| 390 checkUnnamed6(core.List<core.String> o) { |
| 391 unittest.expect(o, unittest.hasLength(2)); |
| 392 unittest.expect(o[0], unittest.equals('foo')); |
| 393 unittest.expect(o[1], unittest.equals('foo')); |
| 394 } |
| 395 |
| 396 core.int buildCounterGoogleCloudMlV1Model = 0; |
| 397 buildGoogleCloudMlV1Model() { |
| 398 var o = new api.GoogleCloudMlV1Model(); |
| 399 buildCounterGoogleCloudMlV1Model++; |
| 400 if (buildCounterGoogleCloudMlV1Model < 3) { |
| 401 o.defaultVersion = buildGoogleCloudMlV1Version(); |
| 402 o.description = "foo"; |
| 403 o.name = "foo"; |
| 404 o.onlinePredictionLogging = true; |
| 405 o.regions = buildUnnamed6(); |
| 406 } |
| 407 buildCounterGoogleCloudMlV1Model--; |
| 408 return o; |
| 409 } |
| 410 |
| 411 checkGoogleCloudMlV1Model(api.GoogleCloudMlV1Model o) { |
| 412 buildCounterGoogleCloudMlV1Model++; |
| 413 if (buildCounterGoogleCloudMlV1Model < 3) { |
| 414 checkGoogleCloudMlV1Version(o.defaultVersion); |
| 415 unittest.expect(o.description, unittest.equals('foo')); |
| 416 unittest.expect(o.name, unittest.equals('foo')); |
| 417 unittest.expect(o.onlinePredictionLogging, unittest.isTrue); |
| 418 checkUnnamed6(o.regions); |
| 419 } |
| 420 buildCounterGoogleCloudMlV1Model--; |
| 421 } |
| 422 |
| 423 core.int buildCounterGoogleCloudMlV1OperationMetadata = 0; |
| 424 buildGoogleCloudMlV1OperationMetadata() { |
| 425 var o = new api.GoogleCloudMlV1OperationMetadata(); |
| 426 buildCounterGoogleCloudMlV1OperationMetadata++; |
| 427 if (buildCounterGoogleCloudMlV1OperationMetadata < 3) { |
| 428 o.createTime = "foo"; |
| 429 o.endTime = "foo"; |
| 430 o.isCancellationRequested = true; |
| 431 o.modelName = "foo"; |
| 432 o.operationType = "foo"; |
| 433 o.startTime = "foo"; |
| 434 o.version = buildGoogleCloudMlV1Version(); |
| 435 } |
| 436 buildCounterGoogleCloudMlV1OperationMetadata--; |
| 437 return o; |
| 438 } |
| 439 |
| 440 checkGoogleCloudMlV1OperationMetadata(api.GoogleCloudMlV1OperationMetadata o) { |
| 441 buildCounterGoogleCloudMlV1OperationMetadata++; |
| 442 if (buildCounterGoogleCloudMlV1OperationMetadata < 3) { |
| 443 unittest.expect(o.createTime, unittest.equals('foo')); |
| 444 unittest.expect(o.endTime, unittest.equals('foo')); |
| 445 unittest.expect(o.isCancellationRequested, unittest.isTrue); |
| 446 unittest.expect(o.modelName, unittest.equals('foo')); |
| 447 unittest.expect(o.operationType, unittest.equals('foo')); |
| 448 unittest.expect(o.startTime, unittest.equals('foo')); |
| 449 checkGoogleCloudMlV1Version(o.version); |
| 450 } |
| 451 buildCounterGoogleCloudMlV1OperationMetadata--; |
| 452 } |
| 453 |
| 454 buildUnnamed7() { |
| 455 var o = new core.List<core.String>(); |
| 456 o.add("foo"); |
| 457 o.add("foo"); |
| 458 return o; |
| 459 } |
| 460 |
| 461 checkUnnamed7(core.List<core.String> o) { |
| 462 unittest.expect(o, unittest.hasLength(2)); |
| 463 unittest.expect(o[0], unittest.equals('foo')); |
| 464 unittest.expect(o[1], unittest.equals('foo')); |
| 465 } |
| 466 |
| 467 buildUnnamed8() { |
| 468 var o = new core.List<core.double>(); |
| 469 o.add(42.0); |
| 470 o.add(42.0); |
| 471 return o; |
| 472 } |
| 473 |
| 474 checkUnnamed8(core.List<core.double> o) { |
| 475 unittest.expect(o, unittest.hasLength(2)); |
| 476 unittest.expect(o[0], unittest.equals(42.0)); |
| 477 unittest.expect(o[1], unittest.equals(42.0)); |
| 478 } |
| 479 |
| 480 core.int buildCounterGoogleCloudMlV1ParameterSpec = 0; |
| 481 buildGoogleCloudMlV1ParameterSpec() { |
| 482 var o = new api.GoogleCloudMlV1ParameterSpec(); |
| 483 buildCounterGoogleCloudMlV1ParameterSpec++; |
| 484 if (buildCounterGoogleCloudMlV1ParameterSpec < 3) { |
| 485 o.categoricalValues = buildUnnamed7(); |
| 486 o.discreteValues = buildUnnamed8(); |
| 487 o.maxValue = 42.0; |
| 488 o.minValue = 42.0; |
| 489 o.parameterName = "foo"; |
| 490 o.scaleType = "foo"; |
| 491 o.type = "foo"; |
| 492 } |
| 493 buildCounterGoogleCloudMlV1ParameterSpec--; |
| 494 return o; |
| 495 } |
| 496 |
| 497 checkGoogleCloudMlV1ParameterSpec(api.GoogleCloudMlV1ParameterSpec o) { |
| 498 buildCounterGoogleCloudMlV1ParameterSpec++; |
| 499 if (buildCounterGoogleCloudMlV1ParameterSpec < 3) { |
| 500 checkUnnamed7(o.categoricalValues); |
| 501 checkUnnamed8(o.discreteValues); |
| 502 unittest.expect(o.maxValue, unittest.equals(42.0)); |
| 503 unittest.expect(o.minValue, unittest.equals(42.0)); |
| 504 unittest.expect(o.parameterName, unittest.equals('foo')); |
| 505 unittest.expect(o.scaleType, unittest.equals('foo')); |
| 506 unittest.expect(o.type, unittest.equals('foo')); |
| 507 } |
| 508 buildCounterGoogleCloudMlV1ParameterSpec--; |
| 509 } |
| 510 |
| 511 core.int buildCounterGoogleCloudMlV1PredictRequest = 0; |
| 512 buildGoogleCloudMlV1PredictRequest() { |
| 513 var o = new api.GoogleCloudMlV1PredictRequest(); |
| 514 buildCounterGoogleCloudMlV1PredictRequest++; |
| 515 if (buildCounterGoogleCloudMlV1PredictRequest < 3) { |
| 516 o.httpBody = buildGoogleApiHttpBody(); |
| 517 } |
| 518 buildCounterGoogleCloudMlV1PredictRequest--; |
| 519 return o; |
| 520 } |
| 521 |
| 522 checkGoogleCloudMlV1PredictRequest(api.GoogleCloudMlV1PredictRequest o) { |
| 523 buildCounterGoogleCloudMlV1PredictRequest++; |
| 524 if (buildCounterGoogleCloudMlV1PredictRequest < 3) { |
| 525 checkGoogleApiHttpBody(o.httpBody); |
| 526 } |
| 527 buildCounterGoogleCloudMlV1PredictRequest--; |
| 528 } |
| 529 |
| 530 buildUnnamed9() { |
| 531 var o = new core.List<core.String>(); |
| 532 o.add("foo"); |
| 533 o.add("foo"); |
| 534 return o; |
| 535 } |
| 536 |
| 537 checkUnnamed9(core.List<core.String> o) { |
| 538 unittest.expect(o, unittest.hasLength(2)); |
| 539 unittest.expect(o[0], unittest.equals('foo')); |
| 540 unittest.expect(o[1], unittest.equals('foo')); |
| 541 } |
| 542 |
| 543 core.int buildCounterGoogleCloudMlV1PredictionInput = 0; |
| 544 buildGoogleCloudMlV1PredictionInput() { |
| 545 var o = new api.GoogleCloudMlV1PredictionInput(); |
| 546 buildCounterGoogleCloudMlV1PredictionInput++; |
| 547 if (buildCounterGoogleCloudMlV1PredictionInput < 3) { |
| 548 o.dataFormat = "foo"; |
| 549 o.inputPaths = buildUnnamed9(); |
| 550 o.maxWorkerCount = "foo"; |
| 551 o.modelName = "foo"; |
| 552 o.outputPath = "foo"; |
| 553 o.region = "foo"; |
| 554 o.runtimeVersion = "foo"; |
| 555 o.uri = "foo"; |
| 556 o.versionName = "foo"; |
| 557 } |
| 558 buildCounterGoogleCloudMlV1PredictionInput--; |
| 559 return o; |
| 560 } |
| 561 |
| 562 checkGoogleCloudMlV1PredictionInput(api.GoogleCloudMlV1PredictionInput o) { |
| 563 buildCounterGoogleCloudMlV1PredictionInput++; |
| 564 if (buildCounterGoogleCloudMlV1PredictionInput < 3) { |
| 565 unittest.expect(o.dataFormat, unittest.equals('foo')); |
| 566 checkUnnamed9(o.inputPaths); |
| 567 unittest.expect(o.maxWorkerCount, unittest.equals('foo')); |
| 568 unittest.expect(o.modelName, unittest.equals('foo')); |
| 569 unittest.expect(o.outputPath, unittest.equals('foo')); |
| 570 unittest.expect(o.region, unittest.equals('foo')); |
| 571 unittest.expect(o.runtimeVersion, unittest.equals('foo')); |
| 572 unittest.expect(o.uri, unittest.equals('foo')); |
| 573 unittest.expect(o.versionName, unittest.equals('foo')); |
| 574 } |
| 575 buildCounterGoogleCloudMlV1PredictionInput--; |
| 576 } |
| 577 |
| 578 core.int buildCounterGoogleCloudMlV1PredictionOutput = 0; |
| 579 buildGoogleCloudMlV1PredictionOutput() { |
| 580 var o = new api.GoogleCloudMlV1PredictionOutput(); |
| 581 buildCounterGoogleCloudMlV1PredictionOutput++; |
| 582 if (buildCounterGoogleCloudMlV1PredictionOutput < 3) { |
| 583 o.errorCount = "foo"; |
| 584 o.nodeHours = 42.0; |
| 585 o.outputPath = "foo"; |
| 586 o.predictionCount = "foo"; |
| 587 } |
| 588 buildCounterGoogleCloudMlV1PredictionOutput--; |
| 589 return o; |
| 590 } |
| 591 |
| 592 checkGoogleCloudMlV1PredictionOutput(api.GoogleCloudMlV1PredictionOutput o) { |
| 593 buildCounterGoogleCloudMlV1PredictionOutput++; |
| 594 if (buildCounterGoogleCloudMlV1PredictionOutput < 3) { |
| 595 unittest.expect(o.errorCount, unittest.equals('foo')); |
| 596 unittest.expect(o.nodeHours, unittest.equals(42.0)); |
| 597 unittest.expect(o.outputPath, unittest.equals('foo')); |
| 598 unittest.expect(o.predictionCount, unittest.equals('foo')); |
| 599 } |
| 600 buildCounterGoogleCloudMlV1PredictionOutput--; |
| 601 } |
| 602 |
| 603 core.int buildCounterGoogleCloudMlV1SetDefaultVersionRequest = 0; |
| 604 buildGoogleCloudMlV1SetDefaultVersionRequest() { |
| 605 var o = new api.GoogleCloudMlV1SetDefaultVersionRequest(); |
| 606 buildCounterGoogleCloudMlV1SetDefaultVersionRequest++; |
| 607 if (buildCounterGoogleCloudMlV1SetDefaultVersionRequest < 3) { |
| 608 } |
| 609 buildCounterGoogleCloudMlV1SetDefaultVersionRequest--; |
| 610 return o; |
| 611 } |
| 612 |
| 613 checkGoogleCloudMlV1SetDefaultVersionRequest(api.GoogleCloudMlV1SetDefaultVersio
nRequest o) { |
| 614 buildCounterGoogleCloudMlV1SetDefaultVersionRequest++; |
| 615 if (buildCounterGoogleCloudMlV1SetDefaultVersionRequest < 3) { |
| 616 } |
| 617 buildCounterGoogleCloudMlV1SetDefaultVersionRequest--; |
| 618 } |
| 619 |
| 620 buildUnnamed10() { |
| 621 var o = new core.List<core.String>(); |
| 622 o.add("foo"); |
| 623 o.add("foo"); |
| 624 return o; |
| 625 } |
| 626 |
| 627 checkUnnamed10(core.List<core.String> o) { |
| 628 unittest.expect(o, unittest.hasLength(2)); |
| 629 unittest.expect(o[0], unittest.equals('foo')); |
| 630 unittest.expect(o[1], unittest.equals('foo')); |
| 631 } |
| 632 |
| 633 buildUnnamed11() { |
| 634 var o = new core.List<core.String>(); |
| 635 o.add("foo"); |
| 636 o.add("foo"); |
| 637 return o; |
| 638 } |
| 639 |
| 640 checkUnnamed11(core.List<core.String> o) { |
| 641 unittest.expect(o, unittest.hasLength(2)); |
| 642 unittest.expect(o[0], unittest.equals('foo')); |
| 643 unittest.expect(o[1], unittest.equals('foo')); |
| 644 } |
| 645 |
| 646 core.int buildCounterGoogleCloudMlV1TrainingInput = 0; |
| 647 buildGoogleCloudMlV1TrainingInput() { |
| 648 var o = new api.GoogleCloudMlV1TrainingInput(); |
| 649 buildCounterGoogleCloudMlV1TrainingInput++; |
| 650 if (buildCounterGoogleCloudMlV1TrainingInput < 3) { |
| 651 o.args = buildUnnamed10(); |
| 652 o.hyperparameters = buildGoogleCloudMlV1HyperparameterSpec(); |
| 653 o.jobDir = "foo"; |
| 654 o.masterType = "foo"; |
| 655 o.packageUris = buildUnnamed11(); |
| 656 o.parameterServerCount = "foo"; |
| 657 o.parameterServerType = "foo"; |
| 658 o.pythonModule = "foo"; |
| 659 o.region = "foo"; |
| 660 o.runtimeVersion = "foo"; |
| 661 o.scaleTier = "foo"; |
| 662 o.workerCount = "foo"; |
| 663 o.workerType = "foo"; |
| 664 } |
| 665 buildCounterGoogleCloudMlV1TrainingInput--; |
| 666 return o; |
| 667 } |
| 668 |
| 669 checkGoogleCloudMlV1TrainingInput(api.GoogleCloudMlV1TrainingInput o) { |
| 670 buildCounterGoogleCloudMlV1TrainingInput++; |
| 671 if (buildCounterGoogleCloudMlV1TrainingInput < 3) { |
| 672 checkUnnamed10(o.args); |
| 673 checkGoogleCloudMlV1HyperparameterSpec(o.hyperparameters); |
| 674 unittest.expect(o.jobDir, unittest.equals('foo')); |
| 675 unittest.expect(o.masterType, unittest.equals('foo')); |
| 676 checkUnnamed11(o.packageUris); |
| 677 unittest.expect(o.parameterServerCount, unittest.equals('foo')); |
| 678 unittest.expect(o.parameterServerType, unittest.equals('foo')); |
| 679 unittest.expect(o.pythonModule, unittest.equals('foo')); |
| 680 unittest.expect(o.region, unittest.equals('foo')); |
| 681 unittest.expect(o.runtimeVersion, unittest.equals('foo')); |
| 682 unittest.expect(o.scaleTier, unittest.equals('foo')); |
| 683 unittest.expect(o.workerCount, unittest.equals('foo')); |
| 684 unittest.expect(o.workerType, unittest.equals('foo')); |
| 685 } |
| 686 buildCounterGoogleCloudMlV1TrainingInput--; |
| 687 } |
| 688 |
| 689 buildUnnamed12() { |
| 690 var o = new core.List<api.GoogleCloudMlV1HyperparameterOutput>(); |
| 691 o.add(buildGoogleCloudMlV1HyperparameterOutput()); |
| 692 o.add(buildGoogleCloudMlV1HyperparameterOutput()); |
| 693 return o; |
| 694 } |
| 695 |
| 696 checkUnnamed12(core.List<api.GoogleCloudMlV1HyperparameterOutput> o) { |
| 697 unittest.expect(o, unittest.hasLength(2)); |
| 698 checkGoogleCloudMlV1HyperparameterOutput(o[0]); |
| 699 checkGoogleCloudMlV1HyperparameterOutput(o[1]); |
| 700 } |
| 701 |
| 702 core.int buildCounterGoogleCloudMlV1TrainingOutput = 0; |
| 703 buildGoogleCloudMlV1TrainingOutput() { |
| 704 var o = new api.GoogleCloudMlV1TrainingOutput(); |
| 705 buildCounterGoogleCloudMlV1TrainingOutput++; |
| 706 if (buildCounterGoogleCloudMlV1TrainingOutput < 3) { |
| 707 o.completedTrialCount = "foo"; |
| 708 o.consumedMLUnits = 42.0; |
| 709 o.isHyperparameterTuningJob = true; |
| 710 o.trials = buildUnnamed12(); |
| 711 } |
| 712 buildCounterGoogleCloudMlV1TrainingOutput--; |
| 713 return o; |
| 714 } |
| 715 |
| 716 checkGoogleCloudMlV1TrainingOutput(api.GoogleCloudMlV1TrainingOutput o) { |
| 717 buildCounterGoogleCloudMlV1TrainingOutput++; |
| 718 if (buildCounterGoogleCloudMlV1TrainingOutput < 3) { |
| 719 unittest.expect(o.completedTrialCount, unittest.equals('foo')); |
| 720 unittest.expect(o.consumedMLUnits, unittest.equals(42.0)); |
| 721 unittest.expect(o.isHyperparameterTuningJob, unittest.isTrue); |
| 722 checkUnnamed12(o.trials); |
| 723 } |
| 724 buildCounterGoogleCloudMlV1TrainingOutput--; |
| 725 } |
| 726 |
| 727 core.int buildCounterGoogleCloudMlV1Version = 0; |
| 728 buildGoogleCloudMlV1Version() { |
| 729 var o = new api.GoogleCloudMlV1Version(); |
| 730 buildCounterGoogleCloudMlV1Version++; |
| 731 if (buildCounterGoogleCloudMlV1Version < 3) { |
| 732 o.createTime = "foo"; |
| 733 o.deploymentUri = "foo"; |
| 734 o.description = "foo"; |
| 735 o.isDefault = true; |
| 736 o.lastUseTime = "foo"; |
| 737 o.manualScaling = buildGoogleCloudMlV1ManualScaling(); |
| 738 o.name = "foo"; |
| 739 o.runtimeVersion = "foo"; |
| 740 } |
| 741 buildCounterGoogleCloudMlV1Version--; |
| 742 return o; |
| 743 } |
| 744 |
| 745 checkGoogleCloudMlV1Version(api.GoogleCloudMlV1Version o) { |
| 746 buildCounterGoogleCloudMlV1Version++; |
| 747 if (buildCounterGoogleCloudMlV1Version < 3) { |
| 748 unittest.expect(o.createTime, unittest.equals('foo')); |
| 749 unittest.expect(o.deploymentUri, unittest.equals('foo')); |
| 750 unittest.expect(o.description, unittest.equals('foo')); |
| 751 unittest.expect(o.isDefault, unittest.isTrue); |
| 752 unittest.expect(o.lastUseTime, unittest.equals('foo')); |
| 753 checkGoogleCloudMlV1ManualScaling(o.manualScaling); |
| 754 unittest.expect(o.name, unittest.equals('foo')); |
| 755 unittest.expect(o.runtimeVersion, unittest.equals('foo')); |
| 756 } |
| 757 buildCounterGoogleCloudMlV1Version--; |
| 758 } |
| 759 |
| 760 core.int buildCounterGoogleCloudMlV1beta1ManualScaling = 0; |
| 761 buildGoogleCloudMlV1beta1ManualScaling() { |
| 762 var o = new api.GoogleCloudMlV1beta1ManualScaling(); |
| 763 buildCounterGoogleCloudMlV1beta1ManualScaling++; |
| 764 if (buildCounterGoogleCloudMlV1beta1ManualScaling < 3) { |
| 765 o.nodes = 42; |
| 766 } |
| 767 buildCounterGoogleCloudMlV1beta1ManualScaling--; |
| 768 return o; |
| 769 } |
| 770 |
| 771 checkGoogleCloudMlV1beta1ManualScaling(api.GoogleCloudMlV1beta1ManualScaling o)
{ |
| 772 buildCounterGoogleCloudMlV1beta1ManualScaling++; |
| 773 if (buildCounterGoogleCloudMlV1beta1ManualScaling < 3) { |
| 774 unittest.expect(o.nodes, unittest.equals(42)); |
| 775 } |
| 776 buildCounterGoogleCloudMlV1beta1ManualScaling--; |
| 777 } |
| 778 |
| 779 core.int buildCounterGoogleCloudMlV1beta1OperationMetadata = 0; |
| 780 buildGoogleCloudMlV1beta1OperationMetadata() { |
| 781 var o = new api.GoogleCloudMlV1beta1OperationMetadata(); |
| 782 buildCounterGoogleCloudMlV1beta1OperationMetadata++; |
| 783 if (buildCounterGoogleCloudMlV1beta1OperationMetadata < 3) { |
| 784 o.createTime = "foo"; |
| 785 o.endTime = "foo"; |
| 786 o.isCancellationRequested = true; |
| 787 o.modelName = "foo"; |
| 788 o.operationType = "foo"; |
| 789 o.startTime = "foo"; |
| 790 o.version = buildGoogleCloudMlV1beta1Version(); |
| 791 } |
| 792 buildCounterGoogleCloudMlV1beta1OperationMetadata--; |
| 793 return o; |
| 794 } |
| 795 |
| 796 checkGoogleCloudMlV1beta1OperationMetadata(api.GoogleCloudMlV1beta1OperationMeta
data o) { |
| 797 buildCounterGoogleCloudMlV1beta1OperationMetadata++; |
| 798 if (buildCounterGoogleCloudMlV1beta1OperationMetadata < 3) { |
| 799 unittest.expect(o.createTime, unittest.equals('foo')); |
| 800 unittest.expect(o.endTime, unittest.equals('foo')); |
| 801 unittest.expect(o.isCancellationRequested, unittest.isTrue); |
| 802 unittest.expect(o.modelName, unittest.equals('foo')); |
| 803 unittest.expect(o.operationType, unittest.equals('foo')); |
| 804 unittest.expect(o.startTime, unittest.equals('foo')); |
| 805 checkGoogleCloudMlV1beta1Version(o.version); |
| 806 } |
| 807 buildCounterGoogleCloudMlV1beta1OperationMetadata--; |
| 808 } |
| 809 |
| 810 core.int buildCounterGoogleCloudMlV1beta1Version = 0; |
| 811 buildGoogleCloudMlV1beta1Version() { |
| 812 var o = new api.GoogleCloudMlV1beta1Version(); |
| 813 buildCounterGoogleCloudMlV1beta1Version++; |
| 814 if (buildCounterGoogleCloudMlV1beta1Version < 3) { |
| 815 o.createTime = "foo"; |
| 816 o.deploymentUri = "foo"; |
| 817 o.description = "foo"; |
| 818 o.isDefault = true; |
| 819 o.lastUseTime = "foo"; |
| 820 o.manualScaling = buildGoogleCloudMlV1beta1ManualScaling(); |
| 821 o.name = "foo"; |
| 822 o.runtimeVersion = "foo"; |
| 823 } |
| 824 buildCounterGoogleCloudMlV1beta1Version--; |
| 825 return o; |
| 826 } |
| 827 |
| 828 checkGoogleCloudMlV1beta1Version(api.GoogleCloudMlV1beta1Version o) { |
| 829 buildCounterGoogleCloudMlV1beta1Version++; |
| 830 if (buildCounterGoogleCloudMlV1beta1Version < 3) { |
| 831 unittest.expect(o.createTime, unittest.equals('foo')); |
| 832 unittest.expect(o.deploymentUri, unittest.equals('foo')); |
| 833 unittest.expect(o.description, unittest.equals('foo')); |
| 834 unittest.expect(o.isDefault, unittest.isTrue); |
| 835 unittest.expect(o.lastUseTime, unittest.equals('foo')); |
| 836 checkGoogleCloudMlV1beta1ManualScaling(o.manualScaling); |
| 837 unittest.expect(o.name, unittest.equals('foo')); |
| 838 unittest.expect(o.runtimeVersion, unittest.equals('foo')); |
| 839 } |
| 840 buildCounterGoogleCloudMlV1beta1Version--; |
| 841 } |
| 842 |
| 843 buildUnnamed13() { |
| 844 var o = new core.List<api.GoogleLongrunningOperation>(); |
| 845 o.add(buildGoogleLongrunningOperation()); |
| 846 o.add(buildGoogleLongrunningOperation()); |
| 847 return o; |
| 848 } |
| 849 |
| 850 checkUnnamed13(core.List<api.GoogleLongrunningOperation> o) { |
| 851 unittest.expect(o, unittest.hasLength(2)); |
| 852 checkGoogleLongrunningOperation(o[0]); |
| 853 checkGoogleLongrunningOperation(o[1]); |
| 854 } |
| 855 |
| 856 core.int buildCounterGoogleLongrunningListOperationsResponse = 0; |
| 857 buildGoogleLongrunningListOperationsResponse() { |
| 858 var o = new api.GoogleLongrunningListOperationsResponse(); |
| 859 buildCounterGoogleLongrunningListOperationsResponse++; |
| 860 if (buildCounterGoogleLongrunningListOperationsResponse < 3) { |
| 861 o.nextPageToken = "foo"; |
| 862 o.operations = buildUnnamed13(); |
| 863 } |
| 864 buildCounterGoogleLongrunningListOperationsResponse--; |
| 865 return o; |
| 866 } |
| 867 |
| 868 checkGoogleLongrunningListOperationsResponse(api.GoogleLongrunningListOperations
Response o) { |
| 869 buildCounterGoogleLongrunningListOperationsResponse++; |
| 870 if (buildCounterGoogleLongrunningListOperationsResponse < 3) { |
| 871 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 872 checkUnnamed13(o.operations); |
| 873 } |
| 874 buildCounterGoogleLongrunningListOperationsResponse--; |
| 875 } |
| 876 |
| 877 buildUnnamed14() { |
| 878 var o = new core.Map<core.String, core.Object>(); |
| 879 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 880 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 881 return o; |
| 882 } |
| 883 |
| 884 checkUnnamed14(core.Map<core.String, core.Object> o) { |
| 885 unittest.expect(o, unittest.hasLength(2)); |
| 886 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); |
| 887 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); |
| 888 } |
| 889 |
| 890 buildUnnamed15() { |
| 891 var o = new core.Map<core.String, core.Object>(); |
| 892 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 893 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 894 return o; |
| 895 } |
| 896 |
| 897 checkUnnamed15(core.Map<core.String, core.Object> o) { |
| 898 unittest.expect(o, unittest.hasLength(2)); |
| 899 var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLengt
h(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"],
unittest.equals('foo')); |
| 900 var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLengt
h(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"],
unittest.equals('foo')); |
| 901 } |
| 902 |
| 903 core.int buildCounterGoogleLongrunningOperation = 0; |
| 904 buildGoogleLongrunningOperation() { |
| 905 var o = new api.GoogleLongrunningOperation(); |
| 906 buildCounterGoogleLongrunningOperation++; |
| 907 if (buildCounterGoogleLongrunningOperation < 3) { |
| 908 o.done = true; |
| 909 o.error = buildGoogleRpcStatus(); |
| 910 o.metadata = buildUnnamed14(); |
| 911 o.name = "foo"; |
| 912 o.response = buildUnnamed15(); |
| 913 } |
| 914 buildCounterGoogleLongrunningOperation--; |
| 915 return o; |
| 916 } |
| 917 |
| 918 checkGoogleLongrunningOperation(api.GoogleLongrunningOperation o) { |
| 919 buildCounterGoogleLongrunningOperation++; |
| 920 if (buildCounterGoogleLongrunningOperation < 3) { |
| 921 unittest.expect(o.done, unittest.isTrue); |
| 922 checkGoogleRpcStatus(o.error); |
| 923 checkUnnamed14(o.metadata); |
| 924 unittest.expect(o.name, unittest.equals('foo')); |
| 925 checkUnnamed15(o.response); |
| 926 } |
| 927 buildCounterGoogleLongrunningOperation--; |
| 928 } |
| 929 |
| 930 core.int buildCounterGoogleProtobufEmpty = 0; |
| 931 buildGoogleProtobufEmpty() { |
| 932 var o = new api.GoogleProtobufEmpty(); |
| 933 buildCounterGoogleProtobufEmpty++; |
| 934 if (buildCounterGoogleProtobufEmpty < 3) { |
| 935 } |
| 936 buildCounterGoogleProtobufEmpty--; |
| 937 return o; |
| 938 } |
| 939 |
| 940 checkGoogleProtobufEmpty(api.GoogleProtobufEmpty o) { |
| 941 buildCounterGoogleProtobufEmpty++; |
| 942 if (buildCounterGoogleProtobufEmpty < 3) { |
| 943 } |
| 944 buildCounterGoogleProtobufEmpty--; |
| 945 } |
| 946 |
| 947 buildUnnamed16() { |
| 948 var o = new core.Map<core.String, core.Object>(); |
| 949 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 950 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 951 return o; |
| 952 } |
| 953 |
| 954 checkUnnamed16(core.Map<core.String, core.Object> o) { |
| 955 unittest.expect(o, unittest.hasLength(2)); |
| 956 var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLengt
h(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"],
unittest.equals('foo')); |
| 957 var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLengt
h(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"],
unittest.equals('foo')); |
| 958 } |
| 959 |
| 960 buildUnnamed17() { |
| 961 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 962 o.add(buildUnnamed16()); |
| 963 o.add(buildUnnamed16()); |
| 964 return o; |
| 965 } |
| 966 |
| 967 checkUnnamed17(core.List<core.Map<core.String, core.Object>> o) { |
| 968 unittest.expect(o, unittest.hasLength(2)); |
| 969 checkUnnamed16(o[0]); |
| 970 checkUnnamed16(o[1]); |
| 971 } |
| 972 |
| 973 core.int buildCounterGoogleRpcStatus = 0; |
| 974 buildGoogleRpcStatus() { |
| 975 var o = new api.GoogleRpcStatus(); |
| 976 buildCounterGoogleRpcStatus++; |
| 977 if (buildCounterGoogleRpcStatus < 3) { |
| 978 o.code = 42; |
| 979 o.details = buildUnnamed17(); |
| 980 o.message = "foo"; |
| 981 } |
| 982 buildCounterGoogleRpcStatus--; |
| 983 return o; |
| 984 } |
| 985 |
| 986 checkGoogleRpcStatus(api.GoogleRpcStatus o) { |
| 987 buildCounterGoogleRpcStatus++; |
| 988 if (buildCounterGoogleRpcStatus < 3) { |
| 989 unittest.expect(o.code, unittest.equals(42)); |
| 990 checkUnnamed17(o.details); |
| 991 unittest.expect(o.message, unittest.equals('foo')); |
| 992 } |
| 993 buildCounterGoogleRpcStatus--; |
| 994 } |
| 995 |
| 996 |
| 997 main() { |
| 998 unittest.group("obj-schema-GoogleApiHttpBody", () { |
| 999 unittest.test("to-json--from-json", () { |
| 1000 var o = buildGoogleApiHttpBody(); |
| 1001 var od = new api.GoogleApiHttpBody.fromJson(o.toJson()); |
| 1002 checkGoogleApiHttpBody(od); |
| 1003 }); |
| 1004 }); |
| 1005 |
| 1006 |
| 1007 unittest.group("obj-schema-GoogleCloudMlV1HyperparameterOutputHyperparameterMe
tric", () { |
| 1008 unittest.test("to-json--from-json", () { |
| 1009 var o = buildGoogleCloudMlV1HyperparameterOutputHyperparameterMetric(); |
| 1010 var od = new api.GoogleCloudMlV1HyperparameterOutputHyperparameterMetric.f
romJson(o.toJson()); |
| 1011 checkGoogleCloudMlV1HyperparameterOutputHyperparameterMetric(od); |
| 1012 }); |
| 1013 }); |
| 1014 |
| 1015 |
| 1016 unittest.group("obj-schema-GoogleCloudMlV1CancelJobRequest", () { |
| 1017 unittest.test("to-json--from-json", () { |
| 1018 var o = buildGoogleCloudMlV1CancelJobRequest(); |
| 1019 var od = new api.GoogleCloudMlV1CancelJobRequest.fromJson(o.toJson()); |
| 1020 checkGoogleCloudMlV1CancelJobRequest(od); |
| 1021 }); |
| 1022 }); |
| 1023 |
| 1024 |
| 1025 unittest.group("obj-schema-GoogleCloudMlV1GetConfigResponse", () { |
| 1026 unittest.test("to-json--from-json", () { |
| 1027 var o = buildGoogleCloudMlV1GetConfigResponse(); |
| 1028 var od = new api.GoogleCloudMlV1GetConfigResponse.fromJson(o.toJson()); |
| 1029 checkGoogleCloudMlV1GetConfigResponse(od); |
| 1030 }); |
| 1031 }); |
| 1032 |
| 1033 |
| 1034 unittest.group("obj-schema-GoogleCloudMlV1HyperparameterOutput", () { |
| 1035 unittest.test("to-json--from-json", () { |
| 1036 var o = buildGoogleCloudMlV1HyperparameterOutput(); |
| 1037 var od = new api.GoogleCloudMlV1HyperparameterOutput.fromJson(o.toJson()); |
| 1038 checkGoogleCloudMlV1HyperparameterOutput(od); |
| 1039 }); |
| 1040 }); |
| 1041 |
| 1042 |
| 1043 unittest.group("obj-schema-GoogleCloudMlV1HyperparameterSpec", () { |
| 1044 unittest.test("to-json--from-json", () { |
| 1045 var o = buildGoogleCloudMlV1HyperparameterSpec(); |
| 1046 var od = new api.GoogleCloudMlV1HyperparameterSpec.fromJson(o.toJson()); |
| 1047 checkGoogleCloudMlV1HyperparameterSpec(od); |
| 1048 }); |
| 1049 }); |
| 1050 |
| 1051 |
| 1052 unittest.group("obj-schema-GoogleCloudMlV1Job", () { |
| 1053 unittest.test("to-json--from-json", () { |
| 1054 var o = buildGoogleCloudMlV1Job(); |
| 1055 var od = new api.GoogleCloudMlV1Job.fromJson(o.toJson()); |
| 1056 checkGoogleCloudMlV1Job(od); |
| 1057 }); |
| 1058 }); |
| 1059 |
| 1060 |
| 1061 unittest.group("obj-schema-GoogleCloudMlV1ListJobsResponse", () { |
| 1062 unittest.test("to-json--from-json", () { |
| 1063 var o = buildGoogleCloudMlV1ListJobsResponse(); |
| 1064 var od = new api.GoogleCloudMlV1ListJobsResponse.fromJson(o.toJson()); |
| 1065 checkGoogleCloudMlV1ListJobsResponse(od); |
| 1066 }); |
| 1067 }); |
| 1068 |
| 1069 |
| 1070 unittest.group("obj-schema-GoogleCloudMlV1ListModelsResponse", () { |
| 1071 unittest.test("to-json--from-json", () { |
| 1072 var o = buildGoogleCloudMlV1ListModelsResponse(); |
| 1073 var od = new api.GoogleCloudMlV1ListModelsResponse.fromJson(o.toJson()); |
| 1074 checkGoogleCloudMlV1ListModelsResponse(od); |
| 1075 }); |
| 1076 }); |
| 1077 |
| 1078 |
| 1079 unittest.group("obj-schema-GoogleCloudMlV1ListVersionsResponse", () { |
| 1080 unittest.test("to-json--from-json", () { |
| 1081 var o = buildGoogleCloudMlV1ListVersionsResponse(); |
| 1082 var od = new api.GoogleCloudMlV1ListVersionsResponse.fromJson(o.toJson()); |
| 1083 checkGoogleCloudMlV1ListVersionsResponse(od); |
| 1084 }); |
| 1085 }); |
| 1086 |
| 1087 |
| 1088 unittest.group("obj-schema-GoogleCloudMlV1ManualScaling", () { |
| 1089 unittest.test("to-json--from-json", () { |
| 1090 var o = buildGoogleCloudMlV1ManualScaling(); |
| 1091 var od = new api.GoogleCloudMlV1ManualScaling.fromJson(o.toJson()); |
| 1092 checkGoogleCloudMlV1ManualScaling(od); |
| 1093 }); |
| 1094 }); |
| 1095 |
| 1096 |
| 1097 unittest.group("obj-schema-GoogleCloudMlV1Model", () { |
| 1098 unittest.test("to-json--from-json", () { |
| 1099 var o = buildGoogleCloudMlV1Model(); |
| 1100 var od = new api.GoogleCloudMlV1Model.fromJson(o.toJson()); |
| 1101 checkGoogleCloudMlV1Model(od); |
| 1102 }); |
| 1103 }); |
| 1104 |
| 1105 |
| 1106 unittest.group("obj-schema-GoogleCloudMlV1OperationMetadata", () { |
| 1107 unittest.test("to-json--from-json", () { |
| 1108 var o = buildGoogleCloudMlV1OperationMetadata(); |
| 1109 var od = new api.GoogleCloudMlV1OperationMetadata.fromJson(o.toJson()); |
| 1110 checkGoogleCloudMlV1OperationMetadata(od); |
| 1111 }); |
| 1112 }); |
| 1113 |
| 1114 |
| 1115 unittest.group("obj-schema-GoogleCloudMlV1ParameterSpec", () { |
| 1116 unittest.test("to-json--from-json", () { |
| 1117 var o = buildGoogleCloudMlV1ParameterSpec(); |
| 1118 var od = new api.GoogleCloudMlV1ParameterSpec.fromJson(o.toJson()); |
| 1119 checkGoogleCloudMlV1ParameterSpec(od); |
| 1120 }); |
| 1121 }); |
| 1122 |
| 1123 |
| 1124 unittest.group("obj-schema-GoogleCloudMlV1PredictRequest", () { |
| 1125 unittest.test("to-json--from-json", () { |
| 1126 var o = buildGoogleCloudMlV1PredictRequest(); |
| 1127 var od = new api.GoogleCloudMlV1PredictRequest.fromJson(o.toJson()); |
| 1128 checkGoogleCloudMlV1PredictRequest(od); |
| 1129 }); |
| 1130 }); |
| 1131 |
| 1132 |
| 1133 unittest.group("obj-schema-GoogleCloudMlV1PredictionInput", () { |
| 1134 unittest.test("to-json--from-json", () { |
| 1135 var o = buildGoogleCloudMlV1PredictionInput(); |
| 1136 var od = new api.GoogleCloudMlV1PredictionInput.fromJson(o.toJson()); |
| 1137 checkGoogleCloudMlV1PredictionInput(od); |
| 1138 }); |
| 1139 }); |
| 1140 |
| 1141 |
| 1142 unittest.group("obj-schema-GoogleCloudMlV1PredictionOutput", () { |
| 1143 unittest.test("to-json--from-json", () { |
| 1144 var o = buildGoogleCloudMlV1PredictionOutput(); |
| 1145 var od = new api.GoogleCloudMlV1PredictionOutput.fromJson(o.toJson()); |
| 1146 checkGoogleCloudMlV1PredictionOutput(od); |
| 1147 }); |
| 1148 }); |
| 1149 |
| 1150 |
| 1151 unittest.group("obj-schema-GoogleCloudMlV1SetDefaultVersionRequest", () { |
| 1152 unittest.test("to-json--from-json", () { |
| 1153 var o = buildGoogleCloudMlV1SetDefaultVersionRequest(); |
| 1154 var od = new api.GoogleCloudMlV1SetDefaultVersionRequest.fromJson(o.toJson
()); |
| 1155 checkGoogleCloudMlV1SetDefaultVersionRequest(od); |
| 1156 }); |
| 1157 }); |
| 1158 |
| 1159 |
| 1160 unittest.group("obj-schema-GoogleCloudMlV1TrainingInput", () { |
| 1161 unittest.test("to-json--from-json", () { |
| 1162 var o = buildGoogleCloudMlV1TrainingInput(); |
| 1163 var od = new api.GoogleCloudMlV1TrainingInput.fromJson(o.toJson()); |
| 1164 checkGoogleCloudMlV1TrainingInput(od); |
| 1165 }); |
| 1166 }); |
| 1167 |
| 1168 |
| 1169 unittest.group("obj-schema-GoogleCloudMlV1TrainingOutput", () { |
| 1170 unittest.test("to-json--from-json", () { |
| 1171 var o = buildGoogleCloudMlV1TrainingOutput(); |
| 1172 var od = new api.GoogleCloudMlV1TrainingOutput.fromJson(o.toJson()); |
| 1173 checkGoogleCloudMlV1TrainingOutput(od); |
| 1174 }); |
| 1175 }); |
| 1176 |
| 1177 |
| 1178 unittest.group("obj-schema-GoogleCloudMlV1Version", () { |
| 1179 unittest.test("to-json--from-json", () { |
| 1180 var o = buildGoogleCloudMlV1Version(); |
| 1181 var od = new api.GoogleCloudMlV1Version.fromJson(o.toJson()); |
| 1182 checkGoogleCloudMlV1Version(od); |
| 1183 }); |
| 1184 }); |
| 1185 |
| 1186 |
| 1187 unittest.group("obj-schema-GoogleCloudMlV1beta1ManualScaling", () { |
| 1188 unittest.test("to-json--from-json", () { |
| 1189 var o = buildGoogleCloudMlV1beta1ManualScaling(); |
| 1190 var od = new api.GoogleCloudMlV1beta1ManualScaling.fromJson(o.toJson()); |
| 1191 checkGoogleCloudMlV1beta1ManualScaling(od); |
| 1192 }); |
| 1193 }); |
| 1194 |
| 1195 |
| 1196 unittest.group("obj-schema-GoogleCloudMlV1beta1OperationMetadata", () { |
| 1197 unittest.test("to-json--from-json", () { |
| 1198 var o = buildGoogleCloudMlV1beta1OperationMetadata(); |
| 1199 var od = new api.GoogleCloudMlV1beta1OperationMetadata.fromJson(o.toJson()
); |
| 1200 checkGoogleCloudMlV1beta1OperationMetadata(od); |
| 1201 }); |
| 1202 }); |
| 1203 |
| 1204 |
| 1205 unittest.group("obj-schema-GoogleCloudMlV1beta1Version", () { |
| 1206 unittest.test("to-json--from-json", () { |
| 1207 var o = buildGoogleCloudMlV1beta1Version(); |
| 1208 var od = new api.GoogleCloudMlV1beta1Version.fromJson(o.toJson()); |
| 1209 checkGoogleCloudMlV1beta1Version(od); |
| 1210 }); |
| 1211 }); |
| 1212 |
| 1213 |
| 1214 unittest.group("obj-schema-GoogleLongrunningListOperationsResponse", () { |
| 1215 unittest.test("to-json--from-json", () { |
| 1216 var o = buildGoogleLongrunningListOperationsResponse(); |
| 1217 var od = new api.GoogleLongrunningListOperationsResponse.fromJson(o.toJson
()); |
| 1218 checkGoogleLongrunningListOperationsResponse(od); |
| 1219 }); |
| 1220 }); |
| 1221 |
| 1222 |
| 1223 unittest.group("obj-schema-GoogleLongrunningOperation", () { |
| 1224 unittest.test("to-json--from-json", () { |
| 1225 var o = buildGoogleLongrunningOperation(); |
| 1226 var od = new api.GoogleLongrunningOperation.fromJson(o.toJson()); |
| 1227 checkGoogleLongrunningOperation(od); |
| 1228 }); |
| 1229 }); |
| 1230 |
| 1231 |
| 1232 unittest.group("obj-schema-GoogleProtobufEmpty", () { |
| 1233 unittest.test("to-json--from-json", () { |
| 1234 var o = buildGoogleProtobufEmpty(); |
| 1235 var od = new api.GoogleProtobufEmpty.fromJson(o.toJson()); |
| 1236 checkGoogleProtobufEmpty(od); |
| 1237 }); |
| 1238 }); |
| 1239 |
| 1240 |
| 1241 unittest.group("obj-schema-GoogleRpcStatus", () { |
| 1242 unittest.test("to-json--from-json", () { |
| 1243 var o = buildGoogleRpcStatus(); |
| 1244 var od = new api.GoogleRpcStatus.fromJson(o.toJson()); |
| 1245 checkGoogleRpcStatus(od); |
| 1246 }); |
| 1247 }); |
| 1248 |
| 1249 |
| 1250 unittest.group("resource-ProjectsResourceApi", () { |
| 1251 unittest.test("method--getConfig", () { |
| 1252 |
| 1253 var mock = new HttpServerMock(); |
| 1254 api.ProjectsResourceApi res = new api.MlApi(mock).projects; |
| 1255 var arg_name = "foo"; |
| 1256 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1257 var path = (req.url).path; |
| 1258 var pathOffset = 0; |
| 1259 var index; |
| 1260 var subPart; |
| 1261 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1262 pathOffset += 1; |
| 1263 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1264 pathOffset += 3; |
| 1265 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1266 |
| 1267 var query = (req.url).query; |
| 1268 var queryOffset = 0; |
| 1269 var queryMap = {}; |
| 1270 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1271 parseBool(n) { |
| 1272 if (n == "true") return true; |
| 1273 if (n == "false") return false; |
| 1274 if (n == null) return null; |
| 1275 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1276 } |
| 1277 if (query.length > 0) { |
| 1278 for (var part in query.split("&")) { |
| 1279 var keyvalue = part.split("="); |
| 1280 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1281 } |
| 1282 } |
| 1283 |
| 1284 |
| 1285 var h = { |
| 1286 "content-type" : "application/json; charset=utf-8", |
| 1287 }; |
| 1288 var resp = convert.JSON.encode(buildGoogleCloudMlV1GetConfigResponse()); |
| 1289 return new async.Future.value(stringResponse(200, h, resp)); |
| 1290 }), true); |
| 1291 res.getConfig(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1Get
ConfigResponse response) { |
| 1292 checkGoogleCloudMlV1GetConfigResponse(response); |
| 1293 }))); |
| 1294 }); |
| 1295 |
| 1296 unittest.test("method--predict", () { |
| 1297 |
| 1298 var mock = new HttpServerMock(); |
| 1299 api.ProjectsResourceApi res = new api.MlApi(mock).projects; |
| 1300 var arg_request = buildGoogleCloudMlV1PredictRequest(); |
| 1301 var arg_name = "foo"; |
| 1302 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1303 var obj = new api.GoogleCloudMlV1PredictRequest.fromJson(json); |
| 1304 checkGoogleCloudMlV1PredictRequest(obj); |
| 1305 |
| 1306 var path = (req.url).path; |
| 1307 var pathOffset = 0; |
| 1308 var index; |
| 1309 var subPart; |
| 1310 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1311 pathOffset += 1; |
| 1312 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1313 pathOffset += 3; |
| 1314 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1315 |
| 1316 var query = (req.url).query; |
| 1317 var queryOffset = 0; |
| 1318 var queryMap = {}; |
| 1319 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1320 parseBool(n) { |
| 1321 if (n == "true") return true; |
| 1322 if (n == "false") return false; |
| 1323 if (n == null) return null; |
| 1324 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1325 } |
| 1326 if (query.length > 0) { |
| 1327 for (var part in query.split("&")) { |
| 1328 var keyvalue = part.split("="); |
| 1329 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1330 } |
| 1331 } |
| 1332 |
| 1333 |
| 1334 var h = { |
| 1335 "content-type" : "application/json; charset=utf-8", |
| 1336 }; |
| 1337 var resp = convert.JSON.encode(buildGoogleApiHttpBody()); |
| 1338 return new async.Future.value(stringResponse(200, h, resp)); |
| 1339 }), true); |
| 1340 res.predict(arg_request, arg_name).then(unittest.expectAsync(((api.GoogleA
piHttpBody response) { |
| 1341 checkGoogleApiHttpBody(response); |
| 1342 }))); |
| 1343 }); |
| 1344 |
| 1345 }); |
| 1346 |
| 1347 |
| 1348 unittest.group("resource-ProjectsJobsResourceApi", () { |
| 1349 unittest.test("method--cancel", () { |
| 1350 |
| 1351 var mock = new HttpServerMock(); |
| 1352 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; |
| 1353 var arg_request = buildGoogleCloudMlV1CancelJobRequest(); |
| 1354 var arg_name = "foo"; |
| 1355 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1356 var obj = new api.GoogleCloudMlV1CancelJobRequest.fromJson(json); |
| 1357 checkGoogleCloudMlV1CancelJobRequest(obj); |
| 1358 |
| 1359 var path = (req.url).path; |
| 1360 var pathOffset = 0; |
| 1361 var index; |
| 1362 var subPart; |
| 1363 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1364 pathOffset += 1; |
| 1365 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1366 pathOffset += 3; |
| 1367 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1368 |
| 1369 var query = (req.url).query; |
| 1370 var queryOffset = 0; |
| 1371 var queryMap = {}; |
| 1372 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1373 parseBool(n) { |
| 1374 if (n == "true") return true; |
| 1375 if (n == "false") return false; |
| 1376 if (n == null) return null; |
| 1377 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1378 } |
| 1379 if (query.length > 0) { |
| 1380 for (var part in query.split("&")) { |
| 1381 var keyvalue = part.split("="); |
| 1382 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1383 } |
| 1384 } |
| 1385 |
| 1386 |
| 1387 var h = { |
| 1388 "content-type" : "application/json; charset=utf-8", |
| 1389 }; |
| 1390 var resp = convert.JSON.encode(buildGoogleProtobufEmpty()); |
| 1391 return new async.Future.value(stringResponse(200, h, resp)); |
| 1392 }), true); |
| 1393 res.cancel(arg_request, arg_name).then(unittest.expectAsync(((api.GooglePr
otobufEmpty response) { |
| 1394 checkGoogleProtobufEmpty(response); |
| 1395 }))); |
| 1396 }); |
| 1397 |
| 1398 unittest.test("method--create", () { |
| 1399 |
| 1400 var mock = new HttpServerMock(); |
| 1401 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; |
| 1402 var arg_request = buildGoogleCloudMlV1Job(); |
| 1403 var arg_parent = "foo"; |
| 1404 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1405 var obj = new api.GoogleCloudMlV1Job.fromJson(json); |
| 1406 checkGoogleCloudMlV1Job(obj); |
| 1407 |
| 1408 var path = (req.url).path; |
| 1409 var pathOffset = 0; |
| 1410 var index; |
| 1411 var subPart; |
| 1412 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1413 pathOffset += 1; |
| 1414 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1415 pathOffset += 3; |
| 1416 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1417 |
| 1418 var query = (req.url).query; |
| 1419 var queryOffset = 0; |
| 1420 var queryMap = {}; |
| 1421 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1422 parseBool(n) { |
| 1423 if (n == "true") return true; |
| 1424 if (n == "false") return false; |
| 1425 if (n == null) return null; |
| 1426 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1427 } |
| 1428 if (query.length > 0) { |
| 1429 for (var part in query.split("&")) { |
| 1430 var keyvalue = part.split("="); |
| 1431 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1432 } |
| 1433 } |
| 1434 |
| 1435 |
| 1436 var h = { |
| 1437 "content-type" : "application/json; charset=utf-8", |
| 1438 }; |
| 1439 var resp = convert.JSON.encode(buildGoogleCloudMlV1Job()); |
| 1440 return new async.Future.value(stringResponse(200, h, resp)); |
| 1441 }), true); |
| 1442 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Google
CloudMlV1Job response) { |
| 1443 checkGoogleCloudMlV1Job(response); |
| 1444 }))); |
| 1445 }); |
| 1446 |
| 1447 unittest.test("method--get", () { |
| 1448 |
| 1449 var mock = new HttpServerMock(); |
| 1450 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; |
| 1451 var arg_name = "foo"; |
| 1452 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1453 var path = (req.url).path; |
| 1454 var pathOffset = 0; |
| 1455 var index; |
| 1456 var subPart; |
| 1457 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1458 pathOffset += 1; |
| 1459 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1460 pathOffset += 3; |
| 1461 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1462 |
| 1463 var query = (req.url).query; |
| 1464 var queryOffset = 0; |
| 1465 var queryMap = {}; |
| 1466 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1467 parseBool(n) { |
| 1468 if (n == "true") return true; |
| 1469 if (n == "false") return false; |
| 1470 if (n == null) return null; |
| 1471 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1472 } |
| 1473 if (query.length > 0) { |
| 1474 for (var part in query.split("&")) { |
| 1475 var keyvalue = part.split("="); |
| 1476 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1477 } |
| 1478 } |
| 1479 |
| 1480 |
| 1481 var h = { |
| 1482 "content-type" : "application/json; charset=utf-8", |
| 1483 }; |
| 1484 var resp = convert.JSON.encode(buildGoogleCloudMlV1Job()); |
| 1485 return new async.Future.value(stringResponse(200, h, resp)); |
| 1486 }), true); |
| 1487 res.get(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1Job respo
nse) { |
| 1488 checkGoogleCloudMlV1Job(response); |
| 1489 }))); |
| 1490 }); |
| 1491 |
| 1492 unittest.test("method--list", () { |
| 1493 |
| 1494 var mock = new HttpServerMock(); |
| 1495 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; |
| 1496 var arg_parent = "foo"; |
| 1497 var arg_filter = "foo"; |
| 1498 var arg_pageToken = "foo"; |
| 1499 var arg_pageSize = 42; |
| 1500 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1501 var path = (req.url).path; |
| 1502 var pathOffset = 0; |
| 1503 var index; |
| 1504 var subPart; |
| 1505 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1506 pathOffset += 1; |
| 1507 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1508 pathOffset += 3; |
| 1509 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1510 |
| 1511 var query = (req.url).query; |
| 1512 var queryOffset = 0; |
| 1513 var queryMap = {}; |
| 1514 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1515 parseBool(n) { |
| 1516 if (n == "true") return true; |
| 1517 if (n == "false") return false; |
| 1518 if (n == null) return null; |
| 1519 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1520 } |
| 1521 if (query.length > 0) { |
| 1522 for (var part in query.split("&")) { |
| 1523 var keyvalue = part.split("="); |
| 1524 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1525 } |
| 1526 } |
| 1527 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| 1528 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1529 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1530 |
| 1531 |
| 1532 var h = { |
| 1533 "content-type" : "application/json; charset=utf-8", |
| 1534 }; |
| 1535 var resp = convert.JSON.encode(buildGoogleCloudMlV1ListJobsResponse()); |
| 1536 return new async.Future.value(stringResponse(200, h, resp)); |
| 1537 }), true); |
| 1538 res.list(arg_parent, filter: arg_filter, pageToken: arg_pageToken, pageSiz
e: arg_pageSize).then(unittest.expectAsync(((api.GoogleCloudMlV1ListJobsResponse
response) { |
| 1539 checkGoogleCloudMlV1ListJobsResponse(response); |
| 1540 }))); |
| 1541 }); |
| 1542 |
| 1543 }); |
| 1544 |
| 1545 |
| 1546 unittest.group("resource-ProjectsModelsResourceApi", () { |
| 1547 unittest.test("method--create", () { |
| 1548 |
| 1549 var mock = new HttpServerMock(); |
| 1550 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; |
| 1551 var arg_request = buildGoogleCloudMlV1Model(); |
| 1552 var arg_parent = "foo"; |
| 1553 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1554 var obj = new api.GoogleCloudMlV1Model.fromJson(json); |
| 1555 checkGoogleCloudMlV1Model(obj); |
| 1556 |
| 1557 var path = (req.url).path; |
| 1558 var pathOffset = 0; |
| 1559 var index; |
| 1560 var subPart; |
| 1561 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1562 pathOffset += 1; |
| 1563 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1564 pathOffset += 3; |
| 1565 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1566 |
| 1567 var query = (req.url).query; |
| 1568 var queryOffset = 0; |
| 1569 var queryMap = {}; |
| 1570 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1571 parseBool(n) { |
| 1572 if (n == "true") return true; |
| 1573 if (n == "false") return false; |
| 1574 if (n == null) return null; |
| 1575 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1576 } |
| 1577 if (query.length > 0) { |
| 1578 for (var part in query.split("&")) { |
| 1579 var keyvalue = part.split("="); |
| 1580 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1581 } |
| 1582 } |
| 1583 |
| 1584 |
| 1585 var h = { |
| 1586 "content-type" : "application/json; charset=utf-8", |
| 1587 }; |
| 1588 var resp = convert.JSON.encode(buildGoogleCloudMlV1Model()); |
| 1589 return new async.Future.value(stringResponse(200, h, resp)); |
| 1590 }), true); |
| 1591 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Google
CloudMlV1Model response) { |
| 1592 checkGoogleCloudMlV1Model(response); |
| 1593 }))); |
| 1594 }); |
| 1595 |
| 1596 unittest.test("method--delete", () { |
| 1597 |
| 1598 var mock = new HttpServerMock(); |
| 1599 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; |
| 1600 var arg_name = "foo"; |
| 1601 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1602 var path = (req.url).path; |
| 1603 var pathOffset = 0; |
| 1604 var index; |
| 1605 var subPart; |
| 1606 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1607 pathOffset += 1; |
| 1608 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1609 pathOffset += 3; |
| 1610 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1611 |
| 1612 var query = (req.url).query; |
| 1613 var queryOffset = 0; |
| 1614 var queryMap = {}; |
| 1615 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1616 parseBool(n) { |
| 1617 if (n == "true") return true; |
| 1618 if (n == "false") return false; |
| 1619 if (n == null) return null; |
| 1620 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1621 } |
| 1622 if (query.length > 0) { |
| 1623 for (var part in query.split("&")) { |
| 1624 var keyvalue = part.split("="); |
| 1625 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1626 } |
| 1627 } |
| 1628 |
| 1629 |
| 1630 var h = { |
| 1631 "content-type" : "application/json; charset=utf-8", |
| 1632 }; |
| 1633 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); |
| 1634 return new async.Future.value(stringResponse(200, h, resp)); |
| 1635 }), true); |
| 1636 res.delete(arg_name).then(unittest.expectAsync(((api.GoogleLongrunningOper
ation response) { |
| 1637 checkGoogleLongrunningOperation(response); |
| 1638 }))); |
| 1639 }); |
| 1640 |
| 1641 unittest.test("method--get", () { |
| 1642 |
| 1643 var mock = new HttpServerMock(); |
| 1644 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; |
| 1645 var arg_name = "foo"; |
| 1646 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1647 var path = (req.url).path; |
| 1648 var pathOffset = 0; |
| 1649 var index; |
| 1650 var subPart; |
| 1651 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1652 pathOffset += 1; |
| 1653 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1654 pathOffset += 3; |
| 1655 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1656 |
| 1657 var query = (req.url).query; |
| 1658 var queryOffset = 0; |
| 1659 var queryMap = {}; |
| 1660 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1661 parseBool(n) { |
| 1662 if (n == "true") return true; |
| 1663 if (n == "false") return false; |
| 1664 if (n == null) return null; |
| 1665 throw new core.ArgumentError("Invalid boolean: $n"); |
| 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]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1671 } |
| 1672 } |
| 1673 |
| 1674 |
| 1675 var h = { |
| 1676 "content-type" : "application/json; charset=utf-8", |
| 1677 }; |
| 1678 var resp = convert.JSON.encode(buildGoogleCloudMlV1Model()); |
| 1679 return new async.Future.value(stringResponse(200, h, resp)); |
| 1680 }), true); |
| 1681 res.get(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1Model res
ponse) { |
| 1682 checkGoogleCloudMlV1Model(response); |
| 1683 }))); |
| 1684 }); |
| 1685 |
| 1686 unittest.test("method--list", () { |
| 1687 |
| 1688 var mock = new HttpServerMock(); |
| 1689 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; |
| 1690 var arg_parent = "foo"; |
| 1691 var arg_pageToken = "foo"; |
| 1692 var arg_pageSize = 42; |
| 1693 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1694 var path = (req.url).path; |
| 1695 var pathOffset = 0; |
| 1696 var index; |
| 1697 var subPart; |
| 1698 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1699 pathOffset += 1; |
| 1700 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1701 pathOffset += 3; |
| 1702 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1703 |
| 1704 var query = (req.url).query; |
| 1705 var queryOffset = 0; |
| 1706 var queryMap = {}; |
| 1707 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1708 parseBool(n) { |
| 1709 if (n == "true") return true; |
| 1710 if (n == "false") return false; |
| 1711 if (n == null) return null; |
| 1712 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1713 } |
| 1714 if (query.length > 0) { |
| 1715 for (var part in query.split("&")) { |
| 1716 var keyvalue = part.split("="); |
| 1717 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1718 } |
| 1719 } |
| 1720 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1721 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1722 |
| 1723 |
| 1724 var h = { |
| 1725 "content-type" : "application/json; charset=utf-8", |
| 1726 }; |
| 1727 var resp = convert.JSON.encode(buildGoogleCloudMlV1ListModelsResponse())
; |
| 1728 return new async.Future.value(stringResponse(200, h, resp)); |
| 1729 }), true); |
| 1730 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.GoogleCloudMlV1ListModelsResponse response) { |
| 1731 checkGoogleCloudMlV1ListModelsResponse(response); |
| 1732 }))); |
| 1733 }); |
| 1734 |
| 1735 }); |
| 1736 |
| 1737 |
| 1738 unittest.group("resource-ProjectsModelsVersionsResourceApi", () { |
| 1739 unittest.test("method--create", () { |
| 1740 |
| 1741 var mock = new HttpServerMock(); |
| 1742 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; |
| 1743 var arg_request = buildGoogleCloudMlV1Version(); |
| 1744 var arg_parent = "foo"; |
| 1745 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1746 var obj = new api.GoogleCloudMlV1Version.fromJson(json); |
| 1747 checkGoogleCloudMlV1Version(obj); |
| 1748 |
| 1749 var path = (req.url).path; |
| 1750 var pathOffset = 0; |
| 1751 var index; |
| 1752 var subPart; |
| 1753 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1754 pathOffset += 1; |
| 1755 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1756 pathOffset += 3; |
| 1757 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1758 |
| 1759 var query = (req.url).query; |
| 1760 var queryOffset = 0; |
| 1761 var queryMap = {}; |
| 1762 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1763 parseBool(n) { |
| 1764 if (n == "true") return true; |
| 1765 if (n == "false") return false; |
| 1766 if (n == null) return null; |
| 1767 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1768 } |
| 1769 if (query.length > 0) { |
| 1770 for (var part in query.split("&")) { |
| 1771 var keyvalue = part.split("="); |
| 1772 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1773 } |
| 1774 } |
| 1775 |
| 1776 |
| 1777 var h = { |
| 1778 "content-type" : "application/json; charset=utf-8", |
| 1779 }; |
| 1780 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); |
| 1781 return new async.Future.value(stringResponse(200, h, resp)); |
| 1782 }), true); |
| 1783 res.create(arg_request, arg_parent).then(unittest.expectAsync(((api.Google
LongrunningOperation response) { |
| 1784 checkGoogleLongrunningOperation(response); |
| 1785 }))); |
| 1786 }); |
| 1787 |
| 1788 unittest.test("method--delete", () { |
| 1789 |
| 1790 var mock = new HttpServerMock(); |
| 1791 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; |
| 1792 var arg_name = "foo"; |
| 1793 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1794 var path = (req.url).path; |
| 1795 var pathOffset = 0; |
| 1796 var index; |
| 1797 var subPart; |
| 1798 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1799 pathOffset += 1; |
| 1800 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1801 pathOffset += 3; |
| 1802 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1803 |
| 1804 var query = (req.url).query; |
| 1805 var queryOffset = 0; |
| 1806 var queryMap = {}; |
| 1807 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1808 parseBool(n) { |
| 1809 if (n == "true") return true; |
| 1810 if (n == "false") return false; |
| 1811 if (n == null) return null; |
| 1812 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1813 } |
| 1814 if (query.length > 0) { |
| 1815 for (var part in query.split("&")) { |
| 1816 var keyvalue = part.split("="); |
| 1817 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1818 } |
| 1819 } |
| 1820 |
| 1821 |
| 1822 var h = { |
| 1823 "content-type" : "application/json; charset=utf-8", |
| 1824 }; |
| 1825 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); |
| 1826 return new async.Future.value(stringResponse(200, h, resp)); |
| 1827 }), true); |
| 1828 res.delete(arg_name).then(unittest.expectAsync(((api.GoogleLongrunningOper
ation response) { |
| 1829 checkGoogleLongrunningOperation(response); |
| 1830 }))); |
| 1831 }); |
| 1832 |
| 1833 unittest.test("method--get", () { |
| 1834 |
| 1835 var mock = new HttpServerMock(); |
| 1836 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; |
| 1837 var arg_name = "foo"; |
| 1838 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1839 var path = (req.url).path; |
| 1840 var pathOffset = 0; |
| 1841 var index; |
| 1842 var subPart; |
| 1843 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1844 pathOffset += 1; |
| 1845 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1846 pathOffset += 3; |
| 1847 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1848 |
| 1849 var query = (req.url).query; |
| 1850 var queryOffset = 0; |
| 1851 var queryMap = {}; |
| 1852 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1853 parseBool(n) { |
| 1854 if (n == "true") return true; |
| 1855 if (n == "false") return false; |
| 1856 if (n == null) return null; |
| 1857 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1858 } |
| 1859 if (query.length > 0) { |
| 1860 for (var part in query.split("&")) { |
| 1861 var keyvalue = part.split("="); |
| 1862 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1863 } |
| 1864 } |
| 1865 |
| 1866 |
| 1867 var h = { |
| 1868 "content-type" : "application/json; charset=utf-8", |
| 1869 }; |
| 1870 var resp = convert.JSON.encode(buildGoogleCloudMlV1Version()); |
| 1871 return new async.Future.value(stringResponse(200, h, resp)); |
| 1872 }), true); |
| 1873 res.get(arg_name).then(unittest.expectAsync(((api.GoogleCloudMlV1Version r
esponse) { |
| 1874 checkGoogleCloudMlV1Version(response); |
| 1875 }))); |
| 1876 }); |
| 1877 |
| 1878 unittest.test("method--list", () { |
| 1879 |
| 1880 var mock = new HttpServerMock(); |
| 1881 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; |
| 1882 var arg_parent = "foo"; |
| 1883 var arg_pageToken = "foo"; |
| 1884 var arg_pageSize = 42; |
| 1885 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1886 var path = (req.url).path; |
| 1887 var pathOffset = 0; |
| 1888 var index; |
| 1889 var subPart; |
| 1890 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1891 pathOffset += 1; |
| 1892 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1893 pathOffset += 3; |
| 1894 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1895 |
| 1896 var query = (req.url).query; |
| 1897 var queryOffset = 0; |
| 1898 var queryMap = {}; |
| 1899 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1900 parseBool(n) { |
| 1901 if (n == "true") return true; |
| 1902 if (n == "false") return false; |
| 1903 if (n == null) return null; |
| 1904 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1905 } |
| 1906 if (query.length > 0) { |
| 1907 for (var part in query.split("&")) { |
| 1908 var keyvalue = part.split("="); |
| 1909 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1910 } |
| 1911 } |
| 1912 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1913 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1914 |
| 1915 |
| 1916 var h = { |
| 1917 "content-type" : "application/json; charset=utf-8", |
| 1918 }; |
| 1919 var resp = convert.JSON.encode(buildGoogleCloudMlV1ListVersionsResponse(
)); |
| 1920 return new async.Future.value(stringResponse(200, h, resp)); |
| 1921 }), true); |
| 1922 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize).the
n(unittest.expectAsync(((api.GoogleCloudMlV1ListVersionsResponse response) { |
| 1923 checkGoogleCloudMlV1ListVersionsResponse(response); |
| 1924 }))); |
| 1925 }); |
| 1926 |
| 1927 unittest.test("method--setDefault", () { |
| 1928 |
| 1929 var mock = new HttpServerMock(); |
| 1930 api.ProjectsModelsVersionsResourceApi res = new api.MlApi(mock).projects.m
odels.versions; |
| 1931 var arg_request = buildGoogleCloudMlV1SetDefaultVersionRequest(); |
| 1932 var arg_name = "foo"; |
| 1933 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1934 var obj = new api.GoogleCloudMlV1SetDefaultVersionRequest.fromJson(json)
; |
| 1935 checkGoogleCloudMlV1SetDefaultVersionRequest(obj); |
| 1936 |
| 1937 var path = (req.url).path; |
| 1938 var pathOffset = 0; |
| 1939 var index; |
| 1940 var subPart; |
| 1941 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1942 pathOffset += 1; |
| 1943 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1944 pathOffset += 3; |
| 1945 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1946 |
| 1947 var query = (req.url).query; |
| 1948 var queryOffset = 0; |
| 1949 var queryMap = {}; |
| 1950 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1951 parseBool(n) { |
| 1952 if (n == "true") return true; |
| 1953 if (n == "false") return false; |
| 1954 if (n == null) return null; |
| 1955 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1956 } |
| 1957 if (query.length > 0) { |
| 1958 for (var part in query.split("&")) { |
| 1959 var keyvalue = part.split("="); |
| 1960 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1961 } |
| 1962 } |
| 1963 |
| 1964 |
| 1965 var h = { |
| 1966 "content-type" : "application/json; charset=utf-8", |
| 1967 }; |
| 1968 var resp = convert.JSON.encode(buildGoogleCloudMlV1Version()); |
| 1969 return new async.Future.value(stringResponse(200, h, resp)); |
| 1970 }), true); |
| 1971 res.setDefault(arg_request, arg_name).then(unittest.expectAsync(((api.Goog
leCloudMlV1Version response) { |
| 1972 checkGoogleCloudMlV1Version(response); |
| 1973 }))); |
| 1974 }); |
| 1975 |
| 1976 }); |
| 1977 |
| 1978 |
| 1979 unittest.group("resource-ProjectsOperationsResourceApi", () { |
| 1980 unittest.test("method--cancel", () { |
| 1981 |
| 1982 var mock = new HttpServerMock(); |
| 1983 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; |
| 1984 var arg_name = "foo"; |
| 1985 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1986 var path = (req.url).path; |
| 1987 var pathOffset = 0; |
| 1988 var index; |
| 1989 var subPart; |
| 1990 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1991 pathOffset += 1; |
| 1992 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 1993 pathOffset += 3; |
| 1994 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 1995 |
| 1996 var query = (req.url).query; |
| 1997 var queryOffset = 0; |
| 1998 var queryMap = {}; |
| 1999 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2000 parseBool(n) { |
| 2001 if (n == "true") return true; |
| 2002 if (n == "false") return false; |
| 2003 if (n == null) return null; |
| 2004 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2005 } |
| 2006 if (query.length > 0) { |
| 2007 for (var part in query.split("&")) { |
| 2008 var keyvalue = part.split("="); |
| 2009 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2010 } |
| 2011 } |
| 2012 |
| 2013 |
| 2014 var h = { |
| 2015 "content-type" : "application/json; charset=utf-8", |
| 2016 }; |
| 2017 var resp = convert.JSON.encode(buildGoogleProtobufEmpty()); |
| 2018 return new async.Future.value(stringResponse(200, h, resp)); |
| 2019 }), true); |
| 2020 res.cancel(arg_name).then(unittest.expectAsync(((api.GoogleProtobufEmpty r
esponse) { |
| 2021 checkGoogleProtobufEmpty(response); |
| 2022 }))); |
| 2023 }); |
| 2024 |
| 2025 unittest.test("method--delete", () { |
| 2026 |
| 2027 var mock = new HttpServerMock(); |
| 2028 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; |
| 2029 var arg_name = "foo"; |
| 2030 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2031 var path = (req.url).path; |
| 2032 var pathOffset = 0; |
| 2033 var index; |
| 2034 var subPart; |
| 2035 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2036 pathOffset += 1; |
| 2037 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 2038 pathOffset += 3; |
| 2039 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 2040 |
| 2041 var query = (req.url).query; |
| 2042 var queryOffset = 0; |
| 2043 var queryMap = {}; |
| 2044 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2045 parseBool(n) { |
| 2046 if (n == "true") return true; |
| 2047 if (n == "false") return false; |
| 2048 if (n == null) return null; |
| 2049 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2050 } |
| 2051 if (query.length > 0) { |
| 2052 for (var part in query.split("&")) { |
| 2053 var keyvalue = part.split("="); |
| 2054 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2055 } |
| 2056 } |
| 2057 |
| 2058 |
| 2059 var h = { |
| 2060 "content-type" : "application/json; charset=utf-8", |
| 2061 }; |
| 2062 var resp = convert.JSON.encode(buildGoogleProtobufEmpty()); |
| 2063 return new async.Future.value(stringResponse(200, h, resp)); |
| 2064 }), true); |
| 2065 res.delete(arg_name).then(unittest.expectAsync(((api.GoogleProtobufEmpty r
esponse) { |
| 2066 checkGoogleProtobufEmpty(response); |
| 2067 }))); |
| 2068 }); |
| 2069 |
| 2070 unittest.test("method--get", () { |
| 2071 |
| 2072 var mock = new HttpServerMock(); |
| 2073 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; |
| 2074 var arg_name = "foo"; |
| 2075 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2076 var path = (req.url).path; |
| 2077 var pathOffset = 0; |
| 2078 var index; |
| 2079 var subPart; |
| 2080 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2081 pathOffset += 1; |
| 2082 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 2083 pathOffset += 3; |
| 2084 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 2085 |
| 2086 var query = (req.url).query; |
| 2087 var queryOffset = 0; |
| 2088 var queryMap = {}; |
| 2089 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2090 parseBool(n) { |
| 2091 if (n == "true") return true; |
| 2092 if (n == "false") return false; |
| 2093 if (n == null) return null; |
| 2094 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2095 } |
| 2096 if (query.length > 0) { |
| 2097 for (var part in query.split("&")) { |
| 2098 var keyvalue = part.split("="); |
| 2099 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2100 } |
| 2101 } |
| 2102 |
| 2103 |
| 2104 var h = { |
| 2105 "content-type" : "application/json; charset=utf-8", |
| 2106 }; |
| 2107 var resp = convert.JSON.encode(buildGoogleLongrunningOperation()); |
| 2108 return new async.Future.value(stringResponse(200, h, resp)); |
| 2109 }), true); |
| 2110 res.get(arg_name).then(unittest.expectAsync(((api.GoogleLongrunningOperati
on response) { |
| 2111 checkGoogleLongrunningOperation(response); |
| 2112 }))); |
| 2113 }); |
| 2114 |
| 2115 unittest.test("method--list", () { |
| 2116 |
| 2117 var mock = new HttpServerMock(); |
| 2118 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera
tions; |
| 2119 var arg_name = "foo"; |
| 2120 var arg_filter = "foo"; |
| 2121 var arg_pageToken = "foo"; |
| 2122 var arg_pageSize = 42; |
| 2123 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 2124 var path = (req.url).path; |
| 2125 var pathOffset = 0; |
| 2126 var index; |
| 2127 var subPart; |
| 2128 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 2129 pathOffset += 1; |
| 2130 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
| 2131 pathOffset += 3; |
| 2132 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
| 2133 |
| 2134 var query = (req.url).query; |
| 2135 var queryOffset = 0; |
| 2136 var queryMap = {}; |
| 2137 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 2138 parseBool(n) { |
| 2139 if (n == "true") return true; |
| 2140 if (n == "false") return false; |
| 2141 if (n == null) return null; |
| 2142 throw new core.ArgumentError("Invalid boolean: $n"); |
| 2143 } |
| 2144 if (query.length > 0) { |
| 2145 for (var part in query.split("&")) { |
| 2146 var keyvalue = part.split("="); |
| 2147 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 2148 } |
| 2149 } |
| 2150 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| 2151 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 2152 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 2153 |
| 2154 |
| 2155 var h = { |
| 2156 "content-type" : "application/json; charset=utf-8", |
| 2157 }; |
| 2158 var resp = convert.JSON.encode(buildGoogleLongrunningListOperationsRespo
nse()); |
| 2159 return new async.Future.value(stringResponse(200, h, resp)); |
| 2160 }), true); |
| 2161 res.list(arg_name, filter: arg_filter, pageToken: arg_pageToken, pageSize:
arg_pageSize).then(unittest.expectAsync(((api.GoogleLongrunningListOperationsRe
sponse response) { |
| 2162 checkGoogleLongrunningListOperationsResponse(response); |
| 2163 }))); |
| 2164 }); |
| 2165 |
| 2166 }); |
| 2167 |
| 2168 |
| 2169 } |
| 2170 |
OLD | NEW |