Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: generated/googleapis/test/ml/v1_test.dart

Issue 3003493002: Api-Roll 53: 2017-08-21 (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 library googleapis.ml.v1.test; 1 library googleapis.ml.v1.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing; 9 import 'package:http/testing.dart' as http_testing;
10 import 'package:test/test.dart' as unittest; 10 import 'package:test/test.dart' as unittest;
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 unittest.expect(o, unittest.hasLength(2)); 585 unittest.expect(o, unittest.hasLength(2));
586 unittest.expect(o[0], unittest.equals('foo')); 586 unittest.expect(o[0], unittest.equals('foo'));
587 unittest.expect(o[1], unittest.equals('foo')); 587 unittest.expect(o[1], unittest.equals('foo'));
588 } 588 }
589 589
590 core.int buildCounterGoogleCloudMlV1PredictionInput = 0; 590 core.int buildCounterGoogleCloudMlV1PredictionInput = 0;
591 buildGoogleCloudMlV1PredictionInput() { 591 buildGoogleCloudMlV1PredictionInput() {
592 var o = new api.GoogleCloudMlV1PredictionInput(); 592 var o = new api.GoogleCloudMlV1PredictionInput();
593 buildCounterGoogleCloudMlV1PredictionInput++; 593 buildCounterGoogleCloudMlV1PredictionInput++;
594 if (buildCounterGoogleCloudMlV1PredictionInput < 3) { 594 if (buildCounterGoogleCloudMlV1PredictionInput < 3) {
595 o.batchSize = "foo";
595 o.dataFormat = "foo"; 596 o.dataFormat = "foo";
596 o.inputPaths = buildUnnamed11(); 597 o.inputPaths = buildUnnamed11();
597 o.maxWorkerCount = "foo"; 598 o.maxWorkerCount = "foo";
598 o.modelName = "foo"; 599 o.modelName = "foo";
599 o.outputPath = "foo"; 600 o.outputPath = "foo";
600 o.region = "foo"; 601 o.region = "foo";
601 o.runtimeVersion = "foo"; 602 o.runtimeVersion = "foo";
602 o.uri = "foo"; 603 o.uri = "foo";
603 o.versionName = "foo"; 604 o.versionName = "foo";
604 } 605 }
605 buildCounterGoogleCloudMlV1PredictionInput--; 606 buildCounterGoogleCloudMlV1PredictionInput--;
606 return o; 607 return o;
607 } 608 }
608 609
609 checkGoogleCloudMlV1PredictionInput(api.GoogleCloudMlV1PredictionInput o) { 610 checkGoogleCloudMlV1PredictionInput(api.GoogleCloudMlV1PredictionInput o) {
610 buildCounterGoogleCloudMlV1PredictionInput++; 611 buildCounterGoogleCloudMlV1PredictionInput++;
611 if (buildCounterGoogleCloudMlV1PredictionInput < 3) { 612 if (buildCounterGoogleCloudMlV1PredictionInput < 3) {
613 unittest.expect(o.batchSize, unittest.equals('foo'));
612 unittest.expect(o.dataFormat, unittest.equals('foo')); 614 unittest.expect(o.dataFormat, unittest.equals('foo'));
613 checkUnnamed11(o.inputPaths); 615 checkUnnamed11(o.inputPaths);
614 unittest.expect(o.maxWorkerCount, unittest.equals('foo')); 616 unittest.expect(o.maxWorkerCount, unittest.equals('foo'));
615 unittest.expect(o.modelName, unittest.equals('foo')); 617 unittest.expect(o.modelName, unittest.equals('foo'));
616 unittest.expect(o.outputPath, unittest.equals('foo')); 618 unittest.expect(o.outputPath, unittest.equals('foo'));
617 unittest.expect(o.region, unittest.equals('foo')); 619 unittest.expect(o.region, unittest.equals('foo'));
618 unittest.expect(o.runtimeVersion, unittest.equals('foo')); 620 unittest.expect(o.runtimeVersion, unittest.equals('foo'));
619 unittest.expect(o.uri, unittest.equals('foo')); 621 unittest.expect(o.uri, unittest.equals('foo'));
620 unittest.expect(o.versionName, unittest.equals('foo')); 622 unittest.expect(o.versionName, unittest.equals('foo'));
621 } 623 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 unittest.expect(o.metric, unittest.equals('foo')); 958 unittest.expect(o.metric, unittest.equals('foo'));
957 } 959 }
958 buildCounterGoogleIamV1LogConfigCounterOptions--; 960 buildCounterGoogleIamV1LogConfigCounterOptions--;
959 } 961 }
960 962
961 core.int buildCounterGoogleIamV1LogConfigDataAccessOptions = 0; 963 core.int buildCounterGoogleIamV1LogConfigDataAccessOptions = 0;
962 buildGoogleIamV1LogConfigDataAccessOptions() { 964 buildGoogleIamV1LogConfigDataAccessOptions() {
963 var o = new api.GoogleIamV1LogConfigDataAccessOptions(); 965 var o = new api.GoogleIamV1LogConfigDataAccessOptions();
964 buildCounterGoogleIamV1LogConfigDataAccessOptions++; 966 buildCounterGoogleIamV1LogConfigDataAccessOptions++;
965 if (buildCounterGoogleIamV1LogConfigDataAccessOptions < 3) { 967 if (buildCounterGoogleIamV1LogConfigDataAccessOptions < 3) {
968 o.logMode = "foo";
966 } 969 }
967 buildCounterGoogleIamV1LogConfigDataAccessOptions--; 970 buildCounterGoogleIamV1LogConfigDataAccessOptions--;
968 return o; 971 return o;
969 } 972 }
970 973
971 checkGoogleIamV1LogConfigDataAccessOptions(api.GoogleIamV1LogConfigDataAccessOpt ions o) { 974 checkGoogleIamV1LogConfigDataAccessOptions(api.GoogleIamV1LogConfigDataAccessOpt ions o) {
972 buildCounterGoogleIamV1LogConfigDataAccessOptions++; 975 buildCounterGoogleIamV1LogConfigDataAccessOptions++;
973 if (buildCounterGoogleIamV1LogConfigDataAccessOptions < 3) { 976 if (buildCounterGoogleIamV1LogConfigDataAccessOptions < 3) {
977 unittest.expect(o.logMode, unittest.equals('foo'));
974 } 978 }
975 buildCounterGoogleIamV1LogConfigDataAccessOptions--; 979 buildCounterGoogleIamV1LogConfigDataAccessOptions--;
976 } 980 }
977 981
978 buildUnnamed15() { 982 buildUnnamed15() {
979 var o = new core.List<api.GoogleIamV1AuditLogConfig>(); 983 var o = new core.List<api.GoogleIamV1AuditLogConfig>();
980 o.add(buildGoogleIamV1AuditLogConfig()); 984 o.add(buildGoogleIamV1AuditLogConfig());
981 o.add(buildGoogleIamV1AuditLogConfig()); 985 o.add(buildGoogleIamV1AuditLogConfig());
982 return o; 986 return o;
983 } 987 }
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 "content-type" : "application/json; charset=utf-8", 2223 "content-type" : "application/json; charset=utf-8",
2220 }; 2224 };
2221 var resp = convert.JSON.encode(buildGoogleCloudMlV1Job()); 2225 var resp = convert.JSON.encode(buildGoogleCloudMlV1Job());
2222 return new async.Future.value(stringResponse(200, h, resp)); 2226 return new async.Future.value(stringResponse(200, h, resp));
2223 }), true); 2227 }), true);
2224 res.get(arg_name).then(unittest.expectAsync1(((api.GoogleCloudMlV1Job resp onse) { 2228 res.get(arg_name).then(unittest.expectAsync1(((api.GoogleCloudMlV1Job resp onse) {
2225 checkGoogleCloudMlV1Job(response); 2229 checkGoogleCloudMlV1Job(response);
2226 }))); 2230 })));
2227 }); 2231 });
2228 2232
2233 unittest.test("method--getIamPolicy", () {
2234
2235 var mock = new HttpServerMock();
2236 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs;
2237 var arg_resource = "foo";
2238 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
2239 var path = (req.url).path;
2240 var pathOffset = 0;
2241 var index;
2242 var subPart;
2243 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
2244 pathOffset += 1;
2245 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
2246 pathOffset += 3;
2247 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
2248
2249 var query = (req.url).query;
2250 var queryOffset = 0;
2251 var queryMap = {};
2252 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
2253 parseBool(n) {
2254 if (n == "true") return true;
2255 if (n == "false") return false;
2256 if (n == null) return null;
2257 throw new core.ArgumentError("Invalid boolean: $n");
2258 }
2259 if (query.length > 0) {
2260 for (var part in query.split("&")) {
2261 var keyvalue = part.split("=");
2262 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
2263 }
2264 }
2265
2266
2267 var h = {
2268 "content-type" : "application/json; charset=utf-8",
2269 };
2270 var resp = convert.JSON.encode(buildGoogleIamV1Policy());
2271 return new async.Future.value(stringResponse(200, h, resp));
2272 }), true);
2273 res.getIamPolicy(arg_resource).then(unittest.expectAsync1(((api.GoogleIamV 1Policy response) {
2274 checkGoogleIamV1Policy(response);
2275 })));
2276 });
2277
2229 unittest.test("method--list", () { 2278 unittest.test("method--list", () {
2230 2279
2231 var mock = new HttpServerMock(); 2280 var mock = new HttpServerMock();
2232 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs; 2281 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs;
2233 var arg_parent = "foo"; 2282 var arg_parent = "foo";
2234 var arg_pageToken = "foo"; 2283 var arg_pageToken = "foo";
2235 var arg_pageSize = 42; 2284 var arg_pageSize = 42;
2236 var arg_filter = "foo"; 2285 var arg_filter = "foo";
2237 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 2286 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
2238 var path = (req.url).path; 2287 var path = (req.url).path;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 "content-type" : "application/json; charset=utf-8", 2319 "content-type" : "application/json; charset=utf-8",
2271 }; 2320 };
2272 var resp = convert.JSON.encode(buildGoogleCloudMlV1ListJobsResponse()); 2321 var resp = convert.JSON.encode(buildGoogleCloudMlV1ListJobsResponse());
2273 return new async.Future.value(stringResponse(200, h, resp)); 2322 return new async.Future.value(stringResponse(200, h, resp));
2274 }), true); 2323 }), true);
2275 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize, fil ter: arg_filter).then(unittest.expectAsync1(((api.GoogleCloudMlV1ListJobsRespons e response) { 2324 res.list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize, fil ter: arg_filter).then(unittest.expectAsync1(((api.GoogleCloudMlV1ListJobsRespons e response) {
2276 checkGoogleCloudMlV1ListJobsResponse(response); 2325 checkGoogleCloudMlV1ListJobsResponse(response);
2277 }))); 2326 })));
2278 }); 2327 });
2279 2328
2329 unittest.test("method--setIamPolicy", () {
2330
2331 var mock = new HttpServerMock();
2332 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs;
2333 var arg_request = buildGoogleIamV1SetIamPolicyRequest();
2334 var arg_resource = "foo";
2335 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
2336 var obj = new api.GoogleIamV1SetIamPolicyRequest.fromJson(json);
2337 checkGoogleIamV1SetIamPolicyRequest(obj);
2338
2339 var path = (req.url).path;
2340 var pathOffset = 0;
2341 var index;
2342 var subPart;
2343 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
2344 pathOffset += 1;
2345 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
2346 pathOffset += 3;
2347 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
2348
2349 var query = (req.url).query;
2350 var queryOffset = 0;
2351 var queryMap = {};
2352 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
2353 parseBool(n) {
2354 if (n == "true") return true;
2355 if (n == "false") return false;
2356 if (n == null) return null;
2357 throw new core.ArgumentError("Invalid boolean: $n");
2358 }
2359 if (query.length > 0) {
2360 for (var part in query.split("&")) {
2361 var keyvalue = part.split("=");
2362 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
2363 }
2364 }
2365
2366
2367 var h = {
2368 "content-type" : "application/json; charset=utf-8",
2369 };
2370 var resp = convert.JSON.encode(buildGoogleIamV1Policy());
2371 return new async.Future.value(stringResponse(200, h, resp));
2372 }), true);
2373 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a pi.GoogleIamV1Policy response) {
2374 checkGoogleIamV1Policy(response);
2375 })));
2376 });
2377
2378 unittest.test("method--testIamPermissions", () {
2379
2380 var mock = new HttpServerMock();
2381 api.ProjectsJobsResourceApi res = new api.MlApi(mock).projects.jobs;
2382 var arg_request = buildGoogleIamV1TestIamPermissionsRequest();
2383 var arg_resource = "foo";
2384 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
2385 var obj = new api.GoogleIamV1TestIamPermissionsRequest.fromJson(json);
2386 checkGoogleIamV1TestIamPermissionsRequest(obj);
2387
2388 var path = (req.url).path;
2389 var pathOffset = 0;
2390 var index;
2391 var subPart;
2392 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
2393 pathOffset += 1;
2394 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
2395 pathOffset += 3;
2396 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
2397
2398 var query = (req.url).query;
2399 var queryOffset = 0;
2400 var queryMap = {};
2401 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
2402 parseBool(n) {
2403 if (n == "true") return true;
2404 if (n == "false") return false;
2405 if (n == null) return null;
2406 throw new core.ArgumentError("Invalid boolean: $n");
2407 }
2408 if (query.length > 0) {
2409 for (var part in query.split("&")) {
2410 var keyvalue = part.split("=");
2411 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
2412 }
2413 }
2414
2415
2416 var h = {
2417 "content-type" : "application/json; charset=utf-8",
2418 };
2419 var resp = convert.JSON.encode(buildGoogleIamV1TestIamPermissionsRespons e());
2420 return new async.Future.value(stringResponse(200, h, resp));
2421 }), true);
2422 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn c1(((api.GoogleIamV1TestIamPermissionsResponse response) {
2423 checkGoogleIamV1TestIamPermissionsResponse(response);
2424 })));
2425 });
2426
2280 }); 2427 });
2281 2428
2282 2429
2283 unittest.group("resource-ProjectsModelsResourceApi", () { 2430 unittest.group("resource-ProjectsModelsResourceApi", () {
2284 unittest.test("method--create", () { 2431 unittest.test("method--create", () {
2285 2432
2286 var mock = new HttpServerMock(); 2433 var mock = new HttpServerMock();
2287 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models; 2434 api.ProjectsModelsResourceApi res = new api.MlApi(mock).projects.models;
2288 var arg_request = buildGoogleCloudMlV1Model(); 2435 var arg_request = buildGoogleCloudMlV1Model();
2289 var arg_parent = "foo"; 2436 var arg_parent = "foo";
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 res.get(arg_name).then(unittest.expectAsync1(((api.GoogleLongrunningOperat ion response) { 3137 res.get(arg_name).then(unittest.expectAsync1(((api.GoogleLongrunningOperat ion response) {
2991 checkGoogleLongrunningOperation(response); 3138 checkGoogleLongrunningOperation(response);
2992 }))); 3139 })));
2993 }); 3140 });
2994 3141
2995 unittest.test("method--list", () { 3142 unittest.test("method--list", () {
2996 3143
2997 var mock = new HttpServerMock(); 3144 var mock = new HttpServerMock();
2998 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera tions; 3145 api.ProjectsOperationsResourceApi res = new api.MlApi(mock).projects.opera tions;
2999 var arg_name = "foo"; 3146 var arg_name = "foo";
3000 var arg_filter = "foo";
3001 var arg_pageToken = "foo"; 3147 var arg_pageToken = "foo";
3002 var arg_pageSize = 42; 3148 var arg_pageSize = 42;
3149 var arg_filter = "foo";
3003 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 3150 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
3004 var path = (req.url).path; 3151 var path = (req.url).path;
3005 var pathOffset = 0; 3152 var pathOffset = 0;
3006 var index; 3153 var index;
3007 var subPart; 3154 var subPart;
3008 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 3155 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
3009 pathOffset += 1; 3156 pathOffset += 1;
3010 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/")); 3157 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ als("v1/"));
3011 pathOffset += 3; 3158 pathOffset += 3;
3012 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 3159 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
3013 3160
3014 var query = (req.url).query; 3161 var query = (req.url).query;
3015 var queryOffset = 0; 3162 var queryOffset = 0;
3016 var queryMap = {}; 3163 var queryMap = {};
3017 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 3164 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
3018 parseBool(n) { 3165 parseBool(n) {
3019 if (n == "true") return true; 3166 if (n == "true") return true;
3020 if (n == "false") return false; 3167 if (n == "false") return false;
3021 if (n == null) return null; 3168 if (n == null) return null;
3022 throw new core.ArgumentError("Invalid boolean: $n"); 3169 throw new core.ArgumentError("Invalid boolean: $n");
3023 } 3170 }
3024 if (query.length > 0) { 3171 if (query.length > 0) {
3025 for (var part in query.split("&")) { 3172 for (var part in query.split("&")) {
3026 var keyvalue = part.split("="); 3173 var keyvalue = part.split("=");
3027 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 3174 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1]));
3028 } 3175 }
3029 } 3176 }
3030 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter));
3031 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 3177 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en));
3032 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize)); 3178 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize));
3179 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter));
3033 3180
3034 3181
3035 var h = { 3182 var h = {
3036 "content-type" : "application/json; charset=utf-8", 3183 "content-type" : "application/json; charset=utf-8",
3037 }; 3184 };
3038 var resp = convert.JSON.encode(buildGoogleLongrunningListOperationsRespo nse()); 3185 var resp = convert.JSON.encode(buildGoogleLongrunningListOperationsRespo nse());
3039 return new async.Future.value(stringResponse(200, h, resp)); 3186 return new async.Future.value(stringResponse(200, h, resp));
3040 }), true); 3187 }), true);
3041 res.list(arg_name, filter: arg_filter, pageToken: arg_pageToken, pageSize: arg_pageSize).then(unittest.expectAsync1(((api.GoogleLongrunningListOperationsR esponse response) { 3188 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize, filte r: arg_filter).then(unittest.expectAsync1(((api.GoogleLongrunningListOperationsR esponse response) {
3042 checkGoogleLongrunningListOperationsResponse(response); 3189 checkGoogleLongrunningListOperationsResponse(response);
3043 }))); 3190 })));
3044 }); 3191 });
3045 3192
3046 }); 3193 });
3047 3194
3048 3195
3049 } 3196 }
3050 3197
OLDNEW
« no previous file with comments | « generated/googleapis/test/mirror/v1_test.dart ('k') | generated/googleapis/test/oauth2/v2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698