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