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

Unified Diff: generated/googleapis/test/servicecontrol/v1_test.dart

Issue 2226653002: Api-roll 40: 2016-08-08 (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Addressed review comments Created 4 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 side-by-side diff with in-line comments
Download patch
Index: generated/googleapis/test/servicecontrol/v1_test.dart
diff --git a/generated/googleapis/test/servicecontrol/v1_test.dart b/generated/googleapis/test/servicecontrol/v1_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..9fd5766f3c5cba89f6ddcafee4ba715921084a16
--- /dev/null
+++ b/generated/googleapis/test/servicecontrol/v1_test.dart
@@ -0,0 +1,866 @@
+library googleapis.servicecontrol.v1.test;
+
+import "dart:core" as core;
+import "dart:collection" as collection;
+import "dart:async" as async;
+import "dart:convert" as convert;
+
+import 'package:http/http.dart' as http;
+import 'package:http/testing.dart' as http_testing;
+import 'package:unittest/unittest.dart' as unittest;
+
+import 'package:googleapis/servicecontrol/v1.dart' as api;
+
+class HttpServerMock extends http.BaseClient {
+ core.Function _callback;
+ core.bool _expectJson;
+
+ void register(core.Function callback, core.bool expectJson) {
+ _callback = callback;
+ _expectJson = expectJson;
+ }
+
+ async.Future<http.StreamedResponse> send(http.BaseRequest request) {
+ if (_expectJson) {
+ return request.finalize()
+ .transform(convert.UTF8.decoder)
+ .join('')
+ .then((core.String jsonString) {
+ if (jsonString.isEmpty) {
+ return _callback(request, null);
+ } else {
+ return _callback(request, convert.JSON.decode(jsonString));
+ }
+ });
+ } else {
+ var stream = request.finalize();
+ if (stream == null) {
+ return _callback(request, []);
+ } else {
+ return stream.toBytes().then((data) {
+ return _callback(request, data);
+ });
+ }
+ }
+ }
+}
+
+http.StreamedResponse stringResponse(
+ core.int status, core.Map headers, core.String body) {
+ var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
+ return new http.StreamedResponse(stream, status, headers: headers);
+}
+
+core.int buildCounterCheckError = 0;
+buildCheckError() {
+ var o = new api.CheckError();
+ buildCounterCheckError++;
+ if (buildCounterCheckError < 3) {
+ o.code = "foo";
+ o.detail = "foo";
+ }
+ buildCounterCheckError--;
+ return o;
+}
+
+checkCheckError(api.CheckError o) {
+ buildCounterCheckError++;
+ if (buildCounterCheckError < 3) {
+ unittest.expect(o.code, unittest.equals('foo'));
+ unittest.expect(o.detail, unittest.equals('foo'));
+ }
+ buildCounterCheckError--;
+}
+
+core.int buildCounterCheckRequest = 0;
+buildCheckRequest() {
+ var o = new api.CheckRequest();
+ buildCounterCheckRequest++;
+ if (buildCounterCheckRequest < 3) {
+ o.operation = buildOperation();
+ }
+ buildCounterCheckRequest--;
+ return o;
+}
+
+checkCheckRequest(api.CheckRequest o) {
+ buildCounterCheckRequest++;
+ if (buildCounterCheckRequest < 3) {
+ checkOperation(o.operation);
+ }
+ buildCounterCheckRequest--;
+}
+
+buildUnnamed3062() {
+ var o = new core.List<api.CheckError>();
+ o.add(buildCheckError());
+ o.add(buildCheckError());
+ return o;
+}
+
+checkUnnamed3062(core.List<api.CheckError> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ checkCheckError(o[0]);
+ checkCheckError(o[1]);
+}
+
+core.int buildCounterCheckResponse = 0;
+buildCheckResponse() {
+ var o = new api.CheckResponse();
+ buildCounterCheckResponse++;
+ if (buildCounterCheckResponse < 3) {
+ o.checkErrors = buildUnnamed3062();
+ o.operationId = "foo";
+ }
+ buildCounterCheckResponse--;
+ return o;
+}
+
+checkCheckResponse(api.CheckResponse o) {
+ buildCounterCheckResponse++;
+ if (buildCounterCheckResponse < 3) {
+ checkUnnamed3062(o.checkErrors);
+ unittest.expect(o.operationId, unittest.equals('foo'));
+ }
+ buildCounterCheckResponse--;
+}
+
+buildUnnamed3063() {
+ var o = new core.List<core.String>();
+ o.add("foo");
+ o.add("foo");
+ return o;
+}
+
+checkUnnamed3063(core.List<core.String> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ unittest.expect(o[0], unittest.equals('foo'));
+ unittest.expect(o[1], unittest.equals('foo'));
+}
+
+core.int buildCounterDistribution = 0;
+buildDistribution() {
+ var o = new api.Distribution();
+ buildCounterDistribution++;
+ if (buildCounterDistribution < 3) {
+ o.bucketCounts = buildUnnamed3063();
+ o.count = "foo";
+ o.explicitBuckets = buildExplicitBuckets();
+ o.exponentialBuckets = buildExponentialBuckets();
+ o.linearBuckets = buildLinearBuckets();
+ o.maximum = 42.0;
+ o.mean = 42.0;
+ o.minimum = 42.0;
+ o.sumOfSquaredDeviation = 42.0;
+ }
+ buildCounterDistribution--;
+ return o;
+}
+
+checkDistribution(api.Distribution o) {
+ buildCounterDistribution++;
+ if (buildCounterDistribution < 3) {
+ checkUnnamed3063(o.bucketCounts);
+ unittest.expect(o.count, unittest.equals('foo'));
+ checkExplicitBuckets(o.explicitBuckets);
+ checkExponentialBuckets(o.exponentialBuckets);
+ checkLinearBuckets(o.linearBuckets);
+ unittest.expect(o.maximum, unittest.equals(42.0));
+ unittest.expect(o.mean, unittest.equals(42.0));
+ unittest.expect(o.minimum, unittest.equals(42.0));
+ unittest.expect(o.sumOfSquaredDeviation, unittest.equals(42.0));
+ }
+ buildCounterDistribution--;
+}
+
+buildUnnamed3064() {
+ var o = new core.List<core.double>();
+ o.add(42.0);
+ o.add(42.0);
+ return o;
+}
+
+checkUnnamed3064(core.List<core.double> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ unittest.expect(o[0], unittest.equals(42.0));
+ unittest.expect(o[1], unittest.equals(42.0));
+}
+
+core.int buildCounterExplicitBuckets = 0;
+buildExplicitBuckets() {
+ var o = new api.ExplicitBuckets();
+ buildCounterExplicitBuckets++;
+ if (buildCounterExplicitBuckets < 3) {
+ o.bounds = buildUnnamed3064();
+ }
+ buildCounterExplicitBuckets--;
+ return o;
+}
+
+checkExplicitBuckets(api.ExplicitBuckets o) {
+ buildCounterExplicitBuckets++;
+ if (buildCounterExplicitBuckets < 3) {
+ checkUnnamed3064(o.bounds);
+ }
+ buildCounterExplicitBuckets--;
+}
+
+core.int buildCounterExponentialBuckets = 0;
+buildExponentialBuckets() {
+ var o = new api.ExponentialBuckets();
+ buildCounterExponentialBuckets++;
+ if (buildCounterExponentialBuckets < 3) {
+ o.growthFactor = 42.0;
+ o.numFiniteBuckets = 42;
+ o.scale = 42.0;
+ }
+ buildCounterExponentialBuckets--;
+ return o;
+}
+
+checkExponentialBuckets(api.ExponentialBuckets o) {
+ buildCounterExponentialBuckets++;
+ if (buildCounterExponentialBuckets < 3) {
+ unittest.expect(o.growthFactor, unittest.equals(42.0));
+ unittest.expect(o.numFiniteBuckets, unittest.equals(42));
+ unittest.expect(o.scale, unittest.equals(42.0));
+ }
+ buildCounterExponentialBuckets--;
+}
+
+core.int buildCounterLinearBuckets = 0;
+buildLinearBuckets() {
+ var o = new api.LinearBuckets();
+ buildCounterLinearBuckets++;
+ if (buildCounterLinearBuckets < 3) {
+ o.numFiniteBuckets = 42;
+ o.offset = 42.0;
+ o.width = 42.0;
+ }
+ buildCounterLinearBuckets--;
+ return o;
+}
+
+checkLinearBuckets(api.LinearBuckets o) {
+ buildCounterLinearBuckets++;
+ if (buildCounterLinearBuckets < 3) {
+ unittest.expect(o.numFiniteBuckets, unittest.equals(42));
+ unittest.expect(o.offset, unittest.equals(42.0));
+ unittest.expect(o.width, unittest.equals(42.0));
+ }
+ buildCounterLinearBuckets--;
+}
+
+buildUnnamed3065() {
+ var o = new core.Map<core.String, core.String>();
+ o["x"] = "foo";
+ o["y"] = "foo";
+ return o;
+}
+
+checkUnnamed3065(core.Map<core.String, core.String> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ unittest.expect(o["x"], unittest.equals('foo'));
+ unittest.expect(o["y"], unittest.equals('foo'));
+}
+
+buildUnnamed3066() {
+ var o = new core.Map<core.String, core.Object>();
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
+ return o;
+}
+
+checkUnnamed3066(core.Map<core.String, core.Object> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLength(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], unittest.equals('foo'));
+ var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLength(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], unittest.equals('foo'));
+}
+
+buildUnnamed3067() {
+ var o = new core.Map<core.String, core.Object>();
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
+ return o;
+}
+
+checkUnnamed3067(core.Map<core.String, core.Object> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ var casted3 = (o["x"]) as core.Map; unittest.expect(casted3, unittest.hasLength(3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.expect(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"], unittest.equals('foo'));
+ var casted4 = (o["y"]) as core.Map; unittest.expect(casted4, unittest.hasLength(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.expect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"], unittest.equals('foo'));
+}
+
+core.int buildCounterLogEntry = 0;
+buildLogEntry() {
+ var o = new api.LogEntry();
+ buildCounterLogEntry++;
+ if (buildCounterLogEntry < 3) {
+ o.insertId = "foo";
+ o.labels = buildUnnamed3065();
+ o.name = "foo";
+ o.protoPayload = buildUnnamed3066();
+ o.severity = "foo";
+ o.structPayload = buildUnnamed3067();
+ o.textPayload = "foo";
+ o.timestamp = "foo";
+ }
+ buildCounterLogEntry--;
+ return o;
+}
+
+checkLogEntry(api.LogEntry o) {
+ buildCounterLogEntry++;
+ if (buildCounterLogEntry < 3) {
+ unittest.expect(o.insertId, unittest.equals('foo'));
+ checkUnnamed3065(o.labels);
+ unittest.expect(o.name, unittest.equals('foo'));
+ checkUnnamed3066(o.protoPayload);
+ unittest.expect(o.severity, unittest.equals('foo'));
+ checkUnnamed3067(o.structPayload);
+ unittest.expect(o.textPayload, unittest.equals('foo'));
+ unittest.expect(o.timestamp, unittest.equals('foo'));
+ }
+ buildCounterLogEntry--;
+}
+
+buildUnnamed3068() {
+ var o = new core.Map<core.String, core.String>();
+ o["x"] = "foo";
+ o["y"] = "foo";
+ return o;
+}
+
+checkUnnamed3068(core.Map<core.String, core.String> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ unittest.expect(o["x"], unittest.equals('foo'));
+ unittest.expect(o["y"], unittest.equals('foo'));
+}
+
+core.int buildCounterMetricValue = 0;
+buildMetricValue() {
+ var o = new api.MetricValue();
+ buildCounterMetricValue++;
+ if (buildCounterMetricValue < 3) {
+ o.boolValue = true;
+ o.distributionValue = buildDistribution();
+ o.doubleValue = 42.0;
+ o.endTime = "foo";
+ o.int64Value = "foo";
+ o.labels = buildUnnamed3068();
+ o.startTime = "foo";
+ o.stringValue = "foo";
+ }
+ buildCounterMetricValue--;
+ return o;
+}
+
+checkMetricValue(api.MetricValue o) {
+ buildCounterMetricValue++;
+ if (buildCounterMetricValue < 3) {
+ unittest.expect(o.boolValue, unittest.isTrue);
+ checkDistribution(o.distributionValue);
+ unittest.expect(o.doubleValue, unittest.equals(42.0));
+ unittest.expect(o.endTime, unittest.equals('foo'));
+ unittest.expect(o.int64Value, unittest.equals('foo'));
+ checkUnnamed3068(o.labels);
+ unittest.expect(o.startTime, unittest.equals('foo'));
+ unittest.expect(o.stringValue, unittest.equals('foo'));
+ }
+ buildCounterMetricValue--;
+}
+
+buildUnnamed3069() {
+ var o = new core.List<api.MetricValue>();
+ o.add(buildMetricValue());
+ o.add(buildMetricValue());
+ return o;
+}
+
+checkUnnamed3069(core.List<api.MetricValue> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ checkMetricValue(o[0]);
+ checkMetricValue(o[1]);
+}
+
+core.int buildCounterMetricValueSet = 0;
+buildMetricValueSet() {
+ var o = new api.MetricValueSet();
+ buildCounterMetricValueSet++;
+ if (buildCounterMetricValueSet < 3) {
+ o.metricName = "foo";
+ o.metricValues = buildUnnamed3069();
+ }
+ buildCounterMetricValueSet--;
+ return o;
+}
+
+checkMetricValueSet(api.MetricValueSet o) {
+ buildCounterMetricValueSet++;
+ if (buildCounterMetricValueSet < 3) {
+ unittest.expect(o.metricName, unittest.equals('foo'));
+ checkUnnamed3069(o.metricValues);
+ }
+ buildCounterMetricValueSet--;
+}
+
+buildUnnamed3070() {
+ var o = new core.Map<core.String, core.String>();
+ o["x"] = "foo";
+ o["y"] = "foo";
+ return o;
+}
+
+checkUnnamed3070(core.Map<core.String, core.String> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ unittest.expect(o["x"], unittest.equals('foo'));
+ unittest.expect(o["y"], unittest.equals('foo'));
+}
+
+buildUnnamed3071() {
+ var o = new core.List<api.LogEntry>();
+ o.add(buildLogEntry());
+ o.add(buildLogEntry());
+ return o;
+}
+
+checkUnnamed3071(core.List<api.LogEntry> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ checkLogEntry(o[0]);
+ checkLogEntry(o[1]);
+}
+
+buildUnnamed3072() {
+ var o = new core.List<api.MetricValueSet>();
+ o.add(buildMetricValueSet());
+ o.add(buildMetricValueSet());
+ return o;
+}
+
+checkUnnamed3072(core.List<api.MetricValueSet> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ checkMetricValueSet(o[0]);
+ checkMetricValueSet(o[1]);
+}
+
+core.int buildCounterOperation = 0;
+buildOperation() {
+ var o = new api.Operation();
+ buildCounterOperation++;
+ if (buildCounterOperation < 3) {
+ o.consumerId = "foo";
+ o.endTime = "foo";
+ o.importance = "foo";
+ o.labels = buildUnnamed3070();
+ o.logEntries = buildUnnamed3071();
+ o.metricValueSets = buildUnnamed3072();
+ o.operationId = "foo";
+ o.operationName = "foo";
+ o.startTime = "foo";
+ }
+ buildCounterOperation--;
+ return o;
+}
+
+checkOperation(api.Operation o) {
+ buildCounterOperation++;
+ if (buildCounterOperation < 3) {
+ unittest.expect(o.consumerId, unittest.equals('foo'));
+ unittest.expect(o.endTime, unittest.equals('foo'));
+ unittest.expect(o.importance, unittest.equals('foo'));
+ checkUnnamed3070(o.labels);
+ checkUnnamed3071(o.logEntries);
+ checkUnnamed3072(o.metricValueSets);
+ unittest.expect(o.operationId, unittest.equals('foo'));
+ unittest.expect(o.operationName, unittest.equals('foo'));
+ unittest.expect(o.startTime, unittest.equals('foo'));
+ }
+ buildCounterOperation--;
+}
+
+core.int buildCounterReportError = 0;
+buildReportError() {
+ var o = new api.ReportError();
+ buildCounterReportError++;
+ if (buildCounterReportError < 3) {
+ o.operationId = "foo";
+ o.status = buildStatus();
+ }
+ buildCounterReportError--;
+ return o;
+}
+
+checkReportError(api.ReportError o) {
+ buildCounterReportError++;
+ if (buildCounterReportError < 3) {
+ unittest.expect(o.operationId, unittest.equals('foo'));
+ checkStatus(o.status);
+ }
+ buildCounterReportError--;
+}
+
+buildUnnamed3073() {
+ var o = new core.List<api.Operation>();
+ o.add(buildOperation());
+ o.add(buildOperation());
+ return o;
+}
+
+checkUnnamed3073(core.List<api.Operation> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ checkOperation(o[0]);
+ checkOperation(o[1]);
+}
+
+core.int buildCounterReportRequest = 0;
+buildReportRequest() {
+ var o = new api.ReportRequest();
+ buildCounterReportRequest++;
+ if (buildCounterReportRequest < 3) {
+ o.operations = buildUnnamed3073();
+ }
+ buildCounterReportRequest--;
+ return o;
+}
+
+checkReportRequest(api.ReportRequest o) {
+ buildCounterReportRequest++;
+ if (buildCounterReportRequest < 3) {
+ checkUnnamed3073(o.operations);
+ }
+ buildCounterReportRequest--;
+}
+
+buildUnnamed3074() {
+ var o = new core.List<api.ReportError>();
+ o.add(buildReportError());
+ o.add(buildReportError());
+ return o;
+}
+
+checkUnnamed3074(core.List<api.ReportError> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ checkReportError(o[0]);
+ checkReportError(o[1]);
+}
+
+core.int buildCounterReportResponse = 0;
+buildReportResponse() {
+ var o = new api.ReportResponse();
+ buildCounterReportResponse++;
+ if (buildCounterReportResponse < 3) {
+ o.reportErrors = buildUnnamed3074();
+ }
+ buildCounterReportResponse--;
+ return o;
+}
+
+checkReportResponse(api.ReportResponse o) {
+ buildCounterReportResponse++;
+ if (buildCounterReportResponse < 3) {
+ checkUnnamed3074(o.reportErrors);
+ }
+ buildCounterReportResponse--;
+}
+
+buildUnnamed3075() {
+ var o = new core.Map<core.String, core.Object>();
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'};
+ return o;
+}
+
+checkUnnamed3075(core.Map<core.String, core.Object> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ var casted5 = (o["x"]) as core.Map; unittest.expect(casted5, unittest.hasLength(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.expect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"], unittest.equals('foo'));
+ var casted6 = (o["y"]) as core.Map; unittest.expect(casted6, unittest.hasLength(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.expect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"], unittest.equals('foo'));
+}
+
+buildUnnamed3076() {
+ var o = new core.List<core.Map<core.String, core.Object>>();
+ o.add(buildUnnamed3075());
+ o.add(buildUnnamed3075());
+ return o;
+}
+
+checkUnnamed3076(core.List<core.Map<core.String, core.Object>> o) {
+ unittest.expect(o, unittest.hasLength(2));
+ checkUnnamed3075(o[0]);
+ checkUnnamed3075(o[1]);
+}
+
+core.int buildCounterStatus = 0;
+buildStatus() {
+ var o = new api.Status();
+ buildCounterStatus++;
+ if (buildCounterStatus < 3) {
+ o.code = 42;
+ o.details = buildUnnamed3076();
+ o.message = "foo";
+ }
+ buildCounterStatus--;
+ return o;
+}
+
+checkStatus(api.Status o) {
+ buildCounterStatus++;
+ if (buildCounterStatus < 3) {
+ unittest.expect(o.code, unittest.equals(42));
+ checkUnnamed3076(o.details);
+ unittest.expect(o.message, unittest.equals('foo'));
+ }
+ buildCounterStatus--;
+}
+
+
+main() {
+ unittest.group("obj-schema-CheckError", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildCheckError();
+ var od = new api.CheckError.fromJson(o.toJson());
+ checkCheckError(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-CheckRequest", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildCheckRequest();
+ var od = new api.CheckRequest.fromJson(o.toJson());
+ checkCheckRequest(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-CheckResponse", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildCheckResponse();
+ var od = new api.CheckResponse.fromJson(o.toJson());
+ checkCheckResponse(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-Distribution", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildDistribution();
+ var od = new api.Distribution.fromJson(o.toJson());
+ checkDistribution(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-ExplicitBuckets", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildExplicitBuckets();
+ var od = new api.ExplicitBuckets.fromJson(o.toJson());
+ checkExplicitBuckets(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-ExponentialBuckets", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildExponentialBuckets();
+ var od = new api.ExponentialBuckets.fromJson(o.toJson());
+ checkExponentialBuckets(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-LinearBuckets", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildLinearBuckets();
+ var od = new api.LinearBuckets.fromJson(o.toJson());
+ checkLinearBuckets(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-LogEntry", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildLogEntry();
+ var od = new api.LogEntry.fromJson(o.toJson());
+ checkLogEntry(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-MetricValue", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildMetricValue();
+ var od = new api.MetricValue.fromJson(o.toJson());
+ checkMetricValue(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-MetricValueSet", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildMetricValueSet();
+ var od = new api.MetricValueSet.fromJson(o.toJson());
+ checkMetricValueSet(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-Operation", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildOperation();
+ var od = new api.Operation.fromJson(o.toJson());
+ checkOperation(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-ReportError", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildReportError();
+ var od = new api.ReportError.fromJson(o.toJson());
+ checkReportError(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-ReportRequest", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildReportRequest();
+ var od = new api.ReportRequest.fromJson(o.toJson());
+ checkReportRequest(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-ReportResponse", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildReportResponse();
+ var od = new api.ReportResponse.fromJson(o.toJson());
+ checkReportResponse(od);
+ });
+ });
+
+
+ unittest.group("obj-schema-Status", () {
+ unittest.test("to-json--from-json", () {
+ var o = buildStatus();
+ var od = new api.Status.fromJson(o.toJson());
+ checkStatus(od);
+ });
+ });
+
+
+ unittest.group("resource-ServicesResourceApi", () {
+ unittest.test("method--check", () {
+
+ var mock = new HttpServerMock();
+ api.ServicesResourceApi res = new api.ServicecontrolApi(mock).services;
+ var arg_request = buildCheckRequest();
+ var arg_serviceName = "foo";
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) {
+ var obj = new api.CheckRequest.fromJson(json);
+ checkCheckRequest(obj);
+
+ var path = (req.url).path;
+ var pathOffset = 0;
+ var index;
+ var subPart;
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
+ pathOffset += 1;
+ unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.equals("v1/services/"));
+ pathOffset += 12;
+ index = path.indexOf(":check", pathOffset);
+ unittest.expect(index >= 0, unittest.isTrue);
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
+ pathOffset = index;
+ unittest.expect(subPart, unittest.equals("$arg_serviceName"));
+ unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equals(":check"));
+ pathOffset += 6;
+
+ var query = (req.url).query;
+ var queryOffset = 0;
+ var queryMap = {};
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
+ parseBool(n) {
+ if (n == "true") return true;
+ if (n == "false") return false;
+ if (n == null) return null;
+ throw new core.ArgumentError("Invalid boolean: $n");
+ }
+ if (query.length > 0) {
+ for (var part in query.split("&")) {
+ var keyvalue = part.split("=");
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1]));
+ }
+ }
+
+
+ var h = {
+ "content-type" : "application/json; charset=utf-8",
+ };
+ var resp = convert.JSON.encode(buildCheckResponse());
+ return new async.Future.value(stringResponse(200, h, resp));
+ }), true);
+ res.check(arg_request, arg_serviceName).then(unittest.expectAsync(((api.CheckResponse response) {
+ checkCheckResponse(response);
+ })));
+ });
+
+ unittest.test("method--report", () {
+
+ var mock = new HttpServerMock();
+ api.ServicesResourceApi res = new api.ServicecontrolApi(mock).services;
+ var arg_request = buildReportRequest();
+ var arg_serviceName = "foo";
+ mock.register(unittest.expectAsync((http.BaseRequest req, json) {
+ var obj = new api.ReportRequest.fromJson(json);
+ checkReportRequest(obj);
+
+ var path = (req.url).path;
+ var pathOffset = 0;
+ var index;
+ var subPart;
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
+ pathOffset += 1;
+ unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.equals("v1/services/"));
+ pathOffset += 12;
+ index = path.indexOf(":report", pathOffset);
+ unittest.expect(index >= 0, unittest.isTrue);
+ subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
+ pathOffset = index;
+ unittest.expect(subPart, unittest.equals("$arg_serviceName"));
+ unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equals(":report"));
+ pathOffset += 7;
+
+ var query = (req.url).query;
+ var queryOffset = 0;
+ var queryMap = {};
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
+ parseBool(n) {
+ if (n == "true") return true;
+ if (n == "false") return false;
+ if (n == null) return null;
+ throw new core.ArgumentError("Invalid boolean: $n");
+ }
+ if (query.length > 0) {
+ for (var part in query.split("&")) {
+ var keyvalue = part.split("=");
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1]));
+ }
+ }
+
+
+ var h = {
+ "content-type" : "application/json; charset=utf-8",
+ };
+ var resp = convert.JSON.encode(buildReportResponse());
+ return new async.Future.value(stringResponse(200, h, resp));
+ }), true);
+ res.report(arg_request, arg_serviceName).then(unittest.expectAsync(((api.ReportResponse response) {
+ checkReportResponse(response);
+ })));
+ });
+
+ });
+
+
+}
+
« no previous file with comments | « generated/googleapis/test/script/v1_test.dart ('k') | generated/googleapis/test/servicemanagement/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698