blob: 3ca798048c94ed2a3177a6471e78de33486a757e [file] [log] [blame]
library googleapis_beta.logging.v2beta1.test;
import "dart:core" as core;
import "dart:async" as async;
import "dart:convert" as convert;
import 'package:http/http.dart' as http;
import 'package:test/test.dart' as unittest;
import 'package:googleapis_beta/logging/v2beta1.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<core.String, core.String> headers, core.String body) {
var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
return new http.StreamedResponse(stream, status, headers: headers);
}
core.int buildCounterBucketOptions = 0;
buildBucketOptions() {
var o = new api.BucketOptions();
buildCounterBucketOptions++;
if (buildCounterBucketOptions < 3) {
o.explicitBuckets = buildExplicit();
o.exponentialBuckets = buildExponential();
o.linearBuckets = buildLinear();
}
buildCounterBucketOptions--;
return o;
}
checkBucketOptions(api.BucketOptions o) {
buildCounterBucketOptions++;
if (buildCounterBucketOptions < 3) {
checkExplicit(o.explicitBuckets);
checkExponential(o.exponentialBuckets);
checkLinear(o.linearBuckets);
}
buildCounterBucketOptions--;
}
core.int buildCounterEmpty = 0;
buildEmpty() {
var o = new api.Empty();
buildCounterEmpty++;
if (buildCounterEmpty < 3) {}
buildCounterEmpty--;
return o;
}
checkEmpty(api.Empty o) {
buildCounterEmpty++;
if (buildCounterEmpty < 3) {}
buildCounterEmpty--;
}
buildUnnamed3937() {
var o = new core.List<core.double>();
o.add(42.0);
o.add(42.0);
return o;
}
checkUnnamed3937(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 buildCounterExplicit = 0;
buildExplicit() {
var o = new api.Explicit();
buildCounterExplicit++;
if (buildCounterExplicit < 3) {
o.bounds = buildUnnamed3937();
}
buildCounterExplicit--;
return o;
}
checkExplicit(api.Explicit o) {
buildCounterExplicit++;
if (buildCounterExplicit < 3) {
checkUnnamed3937(o.bounds);
}
buildCounterExplicit--;
}
core.int buildCounterExponential = 0;
buildExponential() {
var o = new api.Exponential();
buildCounterExponential++;
if (buildCounterExponential < 3) {
o.growthFactor = 42.0;
o.numFiniteBuckets = 42;
o.scale = 42.0;
}
buildCounterExponential--;
return o;
}
checkExponential(api.Exponential o) {
buildCounterExponential++;
if (buildCounterExponential < 3) {
unittest.expect(o.growthFactor, unittest.equals(42.0));
unittest.expect(o.numFiniteBuckets, unittest.equals(42));
unittest.expect(o.scale, unittest.equals(42.0));
}
buildCounterExponential--;
}
core.int buildCounterHttpRequest = 0;
buildHttpRequest() {
var o = new api.HttpRequest();
buildCounterHttpRequest++;
if (buildCounterHttpRequest < 3) {
o.cacheFillBytes = "foo";
o.cacheHit = true;
o.cacheLookup = true;
o.cacheValidatedWithOriginServer = true;
o.latency = "foo";
o.protocol = "foo";
o.referer = "foo";
o.remoteIp = "foo";
o.requestMethod = "foo";
o.requestSize = "foo";
o.requestUrl = "foo";
o.responseSize = "foo";
o.serverIp = "foo";
o.status = 42;
o.userAgent = "foo";
}
buildCounterHttpRequest--;
return o;
}
checkHttpRequest(api.HttpRequest o) {
buildCounterHttpRequest++;
if (buildCounterHttpRequest < 3) {
unittest.expect(o.cacheFillBytes, unittest.equals('foo'));
unittest.expect(o.cacheHit, unittest.isTrue);
unittest.expect(o.cacheLookup, unittest.isTrue);
unittest.expect(o.cacheValidatedWithOriginServer, unittest.isTrue);
unittest.expect(o.latency, unittest.equals('foo'));
unittest.expect(o.protocol, unittest.equals('foo'));
unittest.expect(o.referer, unittest.equals('foo'));
unittest.expect(o.remoteIp, unittest.equals('foo'));
unittest.expect(o.requestMethod, unittest.equals('foo'));
unittest.expect(o.requestSize, unittest.equals('foo'));
unittest.expect(o.requestUrl, unittest.equals('foo'));
unittest.expect(o.responseSize, unittest.equals('foo'));
unittest.expect(o.serverIp, unittest.equals('foo'));
unittest.expect(o.status, unittest.equals(42));
unittest.expect(o.userAgent, unittest.equals('foo'));
}
buildCounterHttpRequest--;
}
core.int buildCounterLabelDescriptor = 0;
buildLabelDescriptor() {
var o = new api.LabelDescriptor();
buildCounterLabelDescriptor++;
if (buildCounterLabelDescriptor < 3) {
o.description = "foo";
o.key = "foo";
o.valueType = "foo";
}
buildCounterLabelDescriptor--;
return o;
}
checkLabelDescriptor(api.LabelDescriptor o) {
buildCounterLabelDescriptor++;
if (buildCounterLabelDescriptor < 3) {
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.key, unittest.equals('foo'));
unittest.expect(o.valueType, unittest.equals('foo'));
}
buildCounterLabelDescriptor--;
}
core.int buildCounterLinear = 0;
buildLinear() {
var o = new api.Linear();
buildCounterLinear++;
if (buildCounterLinear < 3) {
o.numFiniteBuckets = 42;
o.offset = 42.0;
o.width = 42.0;
}
buildCounterLinear--;
return o;
}
checkLinear(api.Linear o) {
buildCounterLinear++;
if (buildCounterLinear < 3) {
unittest.expect(o.numFiniteBuckets, unittest.equals(42));
unittest.expect(o.offset, unittest.equals(42.0));
unittest.expect(o.width, unittest.equals(42.0));
}
buildCounterLinear--;
}
buildUnnamed3938() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed3938(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'));
}
buildUnnamed3939() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed3939(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 buildCounterListLogEntriesRequest = 0;
buildListLogEntriesRequest() {
var o = new api.ListLogEntriesRequest();
buildCounterListLogEntriesRequest++;
if (buildCounterListLogEntriesRequest < 3) {
o.filter = "foo";
o.orderBy = "foo";
o.pageSize = 42;
o.pageToken = "foo";
o.projectIds = buildUnnamed3938();
o.resourceNames = buildUnnamed3939();
}
buildCounterListLogEntriesRequest--;
return o;
}
checkListLogEntriesRequest(api.ListLogEntriesRequest o) {
buildCounterListLogEntriesRequest++;
if (buildCounterListLogEntriesRequest < 3) {
unittest.expect(o.filter, unittest.equals('foo'));
unittest.expect(o.orderBy, unittest.equals('foo'));
unittest.expect(o.pageSize, unittest.equals(42));
unittest.expect(o.pageToken, unittest.equals('foo'));
checkUnnamed3938(o.projectIds);
checkUnnamed3939(o.resourceNames);
}
buildCounterListLogEntriesRequest--;
}
buildUnnamed3940() {
var o = new core.List<api.LogEntry>();
o.add(buildLogEntry());
o.add(buildLogEntry());
return o;
}
checkUnnamed3940(core.List<api.LogEntry> o) {
unittest.expect(o, unittest.hasLength(2));
checkLogEntry(o[0]);
checkLogEntry(o[1]);
}
core.int buildCounterListLogEntriesResponse = 0;
buildListLogEntriesResponse() {
var o = new api.ListLogEntriesResponse();
buildCounterListLogEntriesResponse++;
if (buildCounterListLogEntriesResponse < 3) {
o.entries = buildUnnamed3940();
o.nextPageToken = "foo";
}
buildCounterListLogEntriesResponse--;
return o;
}
checkListLogEntriesResponse(api.ListLogEntriesResponse o) {
buildCounterListLogEntriesResponse++;
if (buildCounterListLogEntriesResponse < 3) {
checkUnnamed3940(o.entries);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListLogEntriesResponse--;
}
buildUnnamed3941() {
var o = new core.List<api.LogMetric>();
o.add(buildLogMetric());
o.add(buildLogMetric());
return o;
}
checkUnnamed3941(core.List<api.LogMetric> o) {
unittest.expect(o, unittest.hasLength(2));
checkLogMetric(o[0]);
checkLogMetric(o[1]);
}
core.int buildCounterListLogMetricsResponse = 0;
buildListLogMetricsResponse() {
var o = new api.ListLogMetricsResponse();
buildCounterListLogMetricsResponse++;
if (buildCounterListLogMetricsResponse < 3) {
o.metrics = buildUnnamed3941();
o.nextPageToken = "foo";
}
buildCounterListLogMetricsResponse--;
return o;
}
checkListLogMetricsResponse(api.ListLogMetricsResponse o) {
buildCounterListLogMetricsResponse++;
if (buildCounterListLogMetricsResponse < 3) {
checkUnnamed3941(o.metrics);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListLogMetricsResponse--;
}
buildUnnamed3942() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
checkUnnamed3942(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 buildCounterListLogsResponse = 0;
buildListLogsResponse() {
var o = new api.ListLogsResponse();
buildCounterListLogsResponse++;
if (buildCounterListLogsResponse < 3) {
o.logNames = buildUnnamed3942();
o.nextPageToken = "foo";
}
buildCounterListLogsResponse--;
return o;
}
checkListLogsResponse(api.ListLogsResponse o) {
buildCounterListLogsResponse++;
if (buildCounterListLogsResponse < 3) {
checkUnnamed3942(o.logNames);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListLogsResponse--;
}
buildUnnamed3943() {
var o = new core.List<api.MonitoredResourceDescriptor>();
o.add(buildMonitoredResourceDescriptor());
o.add(buildMonitoredResourceDescriptor());
return o;
}
checkUnnamed3943(core.List<api.MonitoredResourceDescriptor> o) {
unittest.expect(o, unittest.hasLength(2));
checkMonitoredResourceDescriptor(o[0]);
checkMonitoredResourceDescriptor(o[1]);
}
core.int buildCounterListMonitoredResourceDescriptorsResponse = 0;
buildListMonitoredResourceDescriptorsResponse() {
var o = new api.ListMonitoredResourceDescriptorsResponse();
buildCounterListMonitoredResourceDescriptorsResponse++;
if (buildCounterListMonitoredResourceDescriptorsResponse < 3) {
o.nextPageToken = "foo";
o.resourceDescriptors = buildUnnamed3943();
}
buildCounterListMonitoredResourceDescriptorsResponse--;
return o;
}
checkListMonitoredResourceDescriptorsResponse(
api.ListMonitoredResourceDescriptorsResponse o) {
buildCounterListMonitoredResourceDescriptorsResponse++;
if (buildCounterListMonitoredResourceDescriptorsResponse < 3) {
unittest.expect(o.nextPageToken, unittest.equals('foo'));
checkUnnamed3943(o.resourceDescriptors);
}
buildCounterListMonitoredResourceDescriptorsResponse--;
}
buildUnnamed3944() {
var o = new core.List<api.LogSink>();
o.add(buildLogSink());
o.add(buildLogSink());
return o;
}
checkUnnamed3944(core.List<api.LogSink> o) {
unittest.expect(o, unittest.hasLength(2));
checkLogSink(o[0]);
checkLogSink(o[1]);
}
core.int buildCounterListSinksResponse = 0;
buildListSinksResponse() {
var o = new api.ListSinksResponse();
buildCounterListSinksResponse++;
if (buildCounterListSinksResponse < 3) {
o.nextPageToken = "foo";
o.sinks = buildUnnamed3944();
}
buildCounterListSinksResponse--;
return o;
}
checkListSinksResponse(api.ListSinksResponse o) {
buildCounterListSinksResponse++;
if (buildCounterListSinksResponse < 3) {
unittest.expect(o.nextPageToken, unittest.equals('foo'));
checkUnnamed3944(o.sinks);
}
buildCounterListSinksResponse--;
}
buildUnnamed3945() {
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;
}
checkUnnamed3945(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'));
}
buildUnnamed3946() {
var o = new core.Map<core.String, core.String>();
o["x"] = "foo";
o["y"] = "foo";
return o;
}
checkUnnamed3946(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'));
}
buildUnnamed3947() {
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;
}
checkUnnamed3947(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.httpRequest = buildHttpRequest();
o.insertId = "foo";
o.jsonPayload = buildUnnamed3945();
o.labels = buildUnnamed3946();
o.logName = "foo";
o.operation = buildLogEntryOperation();
o.protoPayload = buildUnnamed3947();
o.receiveTimestamp = "foo";
o.resource = buildMonitoredResource();
o.severity = "foo";
o.sourceLocation = buildLogEntrySourceLocation();
o.spanId = "foo";
o.textPayload = "foo";
o.timestamp = "foo";
o.trace = "foo";
}
buildCounterLogEntry--;
return o;
}
checkLogEntry(api.LogEntry o) {
buildCounterLogEntry++;
if (buildCounterLogEntry < 3) {
checkHttpRequest(o.httpRequest);
unittest.expect(o.insertId, unittest.equals('foo'));
checkUnnamed3945(o.jsonPayload);
checkUnnamed3946(o.labels);
unittest.expect(o.logName, unittest.equals('foo'));
checkLogEntryOperation(o.operation);
checkUnnamed3947(o.protoPayload);
unittest.expect(o.receiveTimestamp, unittest.equals('foo'));
checkMonitoredResource(o.resource);
unittest.expect(o.severity, unittest.equals('foo'));
checkLogEntrySourceLocation(o.sourceLocation);
unittest.expect(o.spanId, unittest.equals('foo'));
unittest.expect(o.textPayload, unittest.equals('foo'));
unittest.expect(o.timestamp, unittest.equals('foo'));
unittest.expect(o.trace, unittest.equals('foo'));
}
buildCounterLogEntry--;
}
core.int buildCounterLogEntryOperation = 0;
buildLogEntryOperation() {
var o = new api.LogEntryOperation();
buildCounterLogEntryOperation++;
if (buildCounterLogEntryOperation < 3) {
o.first = true;
o.id = "foo";
o.last = true;
o.producer = "foo";
}
buildCounterLogEntryOperation--;
return o;
}
checkLogEntryOperation(api.LogEntryOperation o) {
buildCounterLogEntryOperation++;
if (buildCounterLogEntryOperation < 3) {
unittest.expect(o.first, unittest.isTrue);
unittest.expect(o.id, unittest.equals('foo'));
unittest.expect(o.last, unittest.isTrue);
unittest.expect(o.producer, unittest.equals('foo'));
}
buildCounterLogEntryOperation--;
}
core.int buildCounterLogEntrySourceLocation = 0;
buildLogEntrySourceLocation() {
var o = new api.LogEntrySourceLocation();
buildCounterLogEntrySourceLocation++;
if (buildCounterLogEntrySourceLocation < 3) {
o.file = "foo";
o.function = "foo";
o.line = "foo";
}
buildCounterLogEntrySourceLocation--;
return o;
}
checkLogEntrySourceLocation(api.LogEntrySourceLocation o) {
buildCounterLogEntrySourceLocation++;
if (buildCounterLogEntrySourceLocation < 3) {
unittest.expect(o.file, unittest.equals('foo'));
unittest.expect(o.function, unittest.equals('foo'));
unittest.expect(o.line, unittest.equals('foo'));
}
buildCounterLogEntrySourceLocation--;
}
core.int buildCounterLogLine = 0;
buildLogLine() {
var o = new api.LogLine();
buildCounterLogLine++;
if (buildCounterLogLine < 3) {
o.logMessage = "foo";
o.severity = "foo";
o.sourceLocation = buildSourceLocation();
o.time = "foo";
}
buildCounterLogLine--;
return o;
}
checkLogLine(api.LogLine o) {
buildCounterLogLine++;
if (buildCounterLogLine < 3) {
unittest.expect(o.logMessage, unittest.equals('foo'));
unittest.expect(o.severity, unittest.equals('foo'));
checkSourceLocation(o.sourceLocation);
unittest.expect(o.time, unittest.equals('foo'));
}
buildCounterLogLine--;
}
buildUnnamed3948() {
var o = new core.Map<core.String, core.String>();
o["x"] = "foo";
o["y"] = "foo";
return o;
}
checkUnnamed3948(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 buildCounterLogMetric = 0;
buildLogMetric() {
var o = new api.LogMetric();
buildCounterLogMetric++;
if (buildCounterLogMetric < 3) {
o.bucketOptions = buildBucketOptions();
o.description = "foo";
o.filter = "foo";
o.labelExtractors = buildUnnamed3948();
o.metricDescriptor = buildMetricDescriptor();
o.name = "foo";
o.valueExtractor = "foo";
o.version = "foo";
}
buildCounterLogMetric--;
return o;
}
checkLogMetric(api.LogMetric o) {
buildCounterLogMetric++;
if (buildCounterLogMetric < 3) {
checkBucketOptions(o.bucketOptions);
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.filter, unittest.equals('foo'));
checkUnnamed3948(o.labelExtractors);
checkMetricDescriptor(o.metricDescriptor);
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.valueExtractor, unittest.equals('foo'));
unittest.expect(o.version, unittest.equals('foo'));
}
buildCounterLogMetric--;
}
core.int buildCounterLogSink = 0;
buildLogSink() {
var o = new api.LogSink();
buildCounterLogSink++;
if (buildCounterLogSink < 3) {
o.destination = "foo";
o.endTime = "foo";
o.filter = "foo";
o.includeChildren = true;
o.name = "foo";
o.outputVersionFormat = "foo";
o.startTime = "foo";
o.writerIdentity = "foo";
}
buildCounterLogSink--;
return o;
}
checkLogSink(api.LogSink o) {
buildCounterLogSink++;
if (buildCounterLogSink < 3) {
unittest.expect(o.destination, unittest.equals('foo'));
unittest.expect(o.endTime, unittest.equals('foo'));
unittest.expect(o.filter, unittest.equals('foo'));
unittest.expect(o.includeChildren, unittest.isTrue);
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.outputVersionFormat, unittest.equals('foo'));
unittest.expect(o.startTime, unittest.equals('foo'));
unittest.expect(o.writerIdentity, unittest.equals('foo'));
}
buildCounterLogSink--;
}
buildUnnamed3949() {
var o = new core.List<api.LabelDescriptor>();
o.add(buildLabelDescriptor());
o.add(buildLabelDescriptor());
return o;
}
checkUnnamed3949(core.List<api.LabelDescriptor> o) {
unittest.expect(o, unittest.hasLength(2));
checkLabelDescriptor(o[0]);
checkLabelDescriptor(o[1]);
}
core.int buildCounterMetricDescriptor = 0;
buildMetricDescriptor() {
var o = new api.MetricDescriptor();
buildCounterMetricDescriptor++;
if (buildCounterMetricDescriptor < 3) {
o.description = "foo";
o.displayName = "foo";
o.labels = buildUnnamed3949();
o.metricKind = "foo";
o.name = "foo";
o.type = "foo";
o.unit = "foo";
o.valueType = "foo";
}
buildCounterMetricDescriptor--;
return o;
}
checkMetricDescriptor(api.MetricDescriptor o) {
buildCounterMetricDescriptor++;
if (buildCounterMetricDescriptor < 3) {
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.displayName, unittest.equals('foo'));
checkUnnamed3949(o.labels);
unittest.expect(o.metricKind, unittest.equals('foo'));
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.type, unittest.equals('foo'));
unittest.expect(o.unit, unittest.equals('foo'));
unittest.expect(o.valueType, unittest.equals('foo'));
}
buildCounterMetricDescriptor--;
}
buildUnnamed3950() {
var o = new core.Map<core.String, core.String>();
o["x"] = "foo";
o["y"] = "foo";
return o;
}
checkUnnamed3950(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 buildCounterMonitoredResource = 0;
buildMonitoredResource() {
var o = new api.MonitoredResource();
buildCounterMonitoredResource++;
if (buildCounterMonitoredResource < 3) {
o.labels = buildUnnamed3950();
o.type = "foo";
}
buildCounterMonitoredResource--;
return o;
}
checkMonitoredResource(api.MonitoredResource o) {
buildCounterMonitoredResource++;
if (buildCounterMonitoredResource < 3) {
checkUnnamed3950(o.labels);
unittest.expect(o.type, unittest.equals('foo'));
}
buildCounterMonitoredResource--;
}
buildUnnamed3951() {
var o = new core.List<api.LabelDescriptor>();
o.add(buildLabelDescriptor());
o.add(buildLabelDescriptor());
return o;
}
checkUnnamed3951(core.List<api.LabelDescriptor> o) {
unittest.expect(o, unittest.hasLength(2));
checkLabelDescriptor(o[0]);
checkLabelDescriptor(o[1]);
}
core.int buildCounterMonitoredResourceDescriptor = 0;
buildMonitoredResourceDescriptor() {
var o = new api.MonitoredResourceDescriptor();
buildCounterMonitoredResourceDescriptor++;
if (buildCounterMonitoredResourceDescriptor < 3) {
o.description = "foo";
o.displayName = "foo";
o.labels = buildUnnamed3951();
o.name = "foo";
o.type = "foo";
}
buildCounterMonitoredResourceDescriptor--;
return o;
}
checkMonitoredResourceDescriptor(api.MonitoredResourceDescriptor o) {
buildCounterMonitoredResourceDescriptor++;
if (buildCounterMonitoredResourceDescriptor < 3) {
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.displayName, unittest.equals('foo'));
checkUnnamed3951(o.labels);
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.type, unittest.equals('foo'));
}
buildCounterMonitoredResourceDescriptor--;
}
buildUnnamed3952() {
var o = new core.List<api.LogLine>();
o.add(buildLogLine());
o.add(buildLogLine());
return o;
}
checkUnnamed3952(core.List<api.LogLine> o) {
unittest.expect(o, unittest.hasLength(2));
checkLogLine(o[0]);
checkLogLine(o[1]);
}
buildUnnamed3953() {
var o = new core.List<api.SourceReference>();
o.add(buildSourceReference());
o.add(buildSourceReference());
return o;
}
checkUnnamed3953(core.List<api.SourceReference> o) {
unittest.expect(o, unittest.hasLength(2));
checkSourceReference(o[0]);
checkSourceReference(o[1]);
}
core.int buildCounterRequestLog = 0;
buildRequestLog() {
var o = new api.RequestLog();
buildCounterRequestLog++;
if (buildCounterRequestLog < 3) {
o.appEngineRelease = "foo";
o.appId = "foo";
o.cost = 42.0;
o.endTime = "foo";
o.finished = true;
o.first = true;
o.host = "foo";
o.httpVersion = "foo";
o.instanceId = "foo";
o.instanceIndex = 42;
o.ip = "foo";
o.latency = "foo";
o.line = buildUnnamed3952();
o.megaCycles = "foo";
o.method = "foo";
o.moduleId = "foo";
o.nickname = "foo";
o.pendingTime = "foo";
o.referrer = "foo";
o.requestId = "foo";
o.resource = "foo";
o.responseSize = "foo";
o.sourceReference = buildUnnamed3953();
o.startTime = "foo";
o.status = 42;
o.taskName = "foo";
o.taskQueueName = "foo";
o.traceId = "foo";
o.urlMapEntry = "foo";
o.userAgent = "foo";
o.versionId = "foo";
o.wasLoadingRequest = true;
}
buildCounterRequestLog--;
return o;
}
checkRequestLog(api.RequestLog o) {
buildCounterRequestLog++;
if (buildCounterRequestLog < 3) {
unittest.expect(o.appEngineRelease, unittest.equals('foo'));
unittest.expect(o.appId, unittest.equals('foo'));
unittest.expect(o.cost, unittest.equals(42.0));
unittest.expect(o.endTime, unittest.equals('foo'));
unittest.expect(o.finished, unittest.isTrue);
unittest.expect(o.first, unittest.isTrue);
unittest.expect(o.host, unittest.equals('foo'));
unittest.expect(o.httpVersion, unittest.equals('foo'));
unittest.expect(o.instanceId, unittest.equals('foo'));
unittest.expect(o.instanceIndex, unittest.equals(42));
unittest.expect(o.ip, unittest.equals('foo'));
unittest.expect(o.latency, unittest.equals('foo'));
checkUnnamed3952(o.line);
unittest.expect(o.megaCycles, unittest.equals('foo'));
unittest.expect(o.method, unittest.equals('foo'));
unittest.expect(o.moduleId, unittest.equals('foo'));
unittest.expect(o.nickname, unittest.equals('foo'));
unittest.expect(o.pendingTime, unittest.equals('foo'));
unittest.expect(o.referrer, unittest.equals('foo'));
unittest.expect(o.requestId, unittest.equals('foo'));
unittest.expect(o.resource, unittest.equals('foo'));
unittest.expect(o.responseSize, unittest.equals('foo'));
checkUnnamed3953(o.sourceReference);
unittest.expect(o.startTime, unittest.equals('foo'));
unittest.expect(o.status, unittest.equals(42));
unittest.expect(o.taskName, unittest.equals('foo'));
unittest.expect(o.taskQueueName, unittest.equals('foo'));
unittest.expect(o.traceId, unittest.equals('foo'));
unittest.expect(o.urlMapEntry, unittest.equals('foo'));
unittest.expect(o.userAgent, unittest.equals('foo'));
unittest.expect(o.versionId, unittest.equals('foo'));
unittest.expect(o.wasLoadingRequest, unittest.isTrue);
}
buildCounterRequestLog--;
}
core.int buildCounterSourceLocation = 0;
buildSourceLocation() {
var o = new api.SourceLocation();
buildCounterSourceLocation++;
if (buildCounterSourceLocation < 3) {
o.file = "foo";
o.functionName = "foo";
o.line = "foo";
}
buildCounterSourceLocation--;
return o;
}
checkSourceLocation(api.SourceLocation o) {
buildCounterSourceLocation++;
if (buildCounterSourceLocation < 3) {
unittest.expect(o.file, unittest.equals('foo'));
unittest.expect(o.functionName, unittest.equals('foo'));
unittest.expect(o.line, unittest.equals('foo'));
}
buildCounterSourceLocation--;
}
core.int buildCounterSourceReference = 0;
buildSourceReference() {
var o = new api.SourceReference();
buildCounterSourceReference++;
if (buildCounterSourceReference < 3) {
o.repository = "foo";
o.revisionId = "foo";
}
buildCounterSourceReference--;
return o;
}
checkSourceReference(api.SourceReference o) {
buildCounterSourceReference++;
if (buildCounterSourceReference < 3) {
unittest.expect(o.repository, unittest.equals('foo'));
unittest.expect(o.revisionId, unittest.equals('foo'));
}
buildCounterSourceReference--;
}
buildUnnamed3954() {
var o = new core.List<api.LogEntry>();
o.add(buildLogEntry());
o.add(buildLogEntry());
return o;
}
checkUnnamed3954(core.List<api.LogEntry> o) {
unittest.expect(o, unittest.hasLength(2));
checkLogEntry(o[0]);
checkLogEntry(o[1]);
}
buildUnnamed3955() {
var o = new core.Map<core.String, core.String>();
o["x"] = "foo";
o["y"] = "foo";
return o;
}
checkUnnamed3955(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 buildCounterWriteLogEntriesRequest = 0;
buildWriteLogEntriesRequest() {
var o = new api.WriteLogEntriesRequest();
buildCounterWriteLogEntriesRequest++;
if (buildCounterWriteLogEntriesRequest < 3) {
o.entries = buildUnnamed3954();
o.labels = buildUnnamed3955();
o.logName = "foo";
o.partialSuccess = true;
o.resource = buildMonitoredResource();
}
buildCounterWriteLogEntriesRequest--;
return o;
}
checkWriteLogEntriesRequest(api.WriteLogEntriesRequest o) {
buildCounterWriteLogEntriesRequest++;
if (buildCounterWriteLogEntriesRequest < 3) {
checkUnnamed3954(o.entries);
checkUnnamed3955(o.labels);
unittest.expect(o.logName, unittest.equals('foo'));
unittest.expect(o.partialSuccess, unittest.isTrue);
checkMonitoredResource(o.resource);
}
buildCounterWriteLogEntriesRequest--;
}
core.int buildCounterWriteLogEntriesResponse = 0;
buildWriteLogEntriesResponse() {
var o = new api.WriteLogEntriesResponse();
buildCounterWriteLogEntriesResponse++;
if (buildCounterWriteLogEntriesResponse < 3) {}
buildCounterWriteLogEntriesResponse--;
return o;
}
checkWriteLogEntriesResponse(api.WriteLogEntriesResponse o) {
buildCounterWriteLogEntriesResponse++;
if (buildCounterWriteLogEntriesResponse < 3) {}
buildCounterWriteLogEntriesResponse--;
}
main() {
unittest.group("obj-schema-BucketOptions", () {
unittest.test("to-json--from-json", () {
var o = buildBucketOptions();
var od = new api.BucketOptions.fromJson(o.toJson());
checkBucketOptions(od);
});
});
unittest.group("obj-schema-Empty", () {
unittest.test("to-json--from-json", () {
var o = buildEmpty();
var od = new api.Empty.fromJson(o.toJson());
checkEmpty(od);
});
});
unittest.group("obj-schema-Explicit", () {
unittest.test("to-json--from-json", () {
var o = buildExplicit();
var od = new api.Explicit.fromJson(o.toJson());
checkExplicit(od);
});
});
unittest.group("obj-schema-Exponential", () {
unittest.test("to-json--from-json", () {
var o = buildExponential();
var od = new api.Exponential.fromJson(o.toJson());
checkExponential(od);
});
});
unittest.group("obj-schema-HttpRequest", () {
unittest.test("to-json--from-json", () {
var o = buildHttpRequest();
var od = new api.HttpRequest.fromJson(o.toJson());
checkHttpRequest(od);
});
});
unittest.group("obj-schema-LabelDescriptor", () {
unittest.test("to-json--from-json", () {
var o = buildLabelDescriptor();
var od = new api.LabelDescriptor.fromJson(o.toJson());
checkLabelDescriptor(od);
});
});
unittest.group("obj-schema-Linear", () {
unittest.test("to-json--from-json", () {
var o = buildLinear();
var od = new api.Linear.fromJson(o.toJson());
checkLinear(od);
});
});
unittest.group("obj-schema-ListLogEntriesRequest", () {
unittest.test("to-json--from-json", () {
var o = buildListLogEntriesRequest();
var od = new api.ListLogEntriesRequest.fromJson(o.toJson());
checkListLogEntriesRequest(od);
});
});
unittest.group("obj-schema-ListLogEntriesResponse", () {
unittest.test("to-json--from-json", () {
var o = buildListLogEntriesResponse();
var od = new api.ListLogEntriesResponse.fromJson(o.toJson());
checkListLogEntriesResponse(od);
});
});
unittest.group("obj-schema-ListLogMetricsResponse", () {
unittest.test("to-json--from-json", () {
var o = buildListLogMetricsResponse();
var od = new api.ListLogMetricsResponse.fromJson(o.toJson());
checkListLogMetricsResponse(od);
});
});
unittest.group("obj-schema-ListLogsResponse", () {
unittest.test("to-json--from-json", () {
var o = buildListLogsResponse();
var od = new api.ListLogsResponse.fromJson(o.toJson());
checkListLogsResponse(od);
});
});
unittest.group("obj-schema-ListMonitoredResourceDescriptorsResponse", () {
unittest.test("to-json--from-json", () {
var o = buildListMonitoredResourceDescriptorsResponse();
var od =
new api.ListMonitoredResourceDescriptorsResponse.fromJson(o.toJson());
checkListMonitoredResourceDescriptorsResponse(od);
});
});
unittest.group("obj-schema-ListSinksResponse", () {
unittest.test("to-json--from-json", () {
var o = buildListSinksResponse();
var od = new api.ListSinksResponse.fromJson(o.toJson());
checkListSinksResponse(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-LogEntryOperation", () {
unittest.test("to-json--from-json", () {
var o = buildLogEntryOperation();
var od = new api.LogEntryOperation.fromJson(o.toJson());
checkLogEntryOperation(od);
});
});
unittest.group("obj-schema-LogEntrySourceLocation", () {
unittest.test("to-json--from-json", () {
var o = buildLogEntrySourceLocation();
var od = new api.LogEntrySourceLocation.fromJson(o.toJson());
checkLogEntrySourceLocation(od);
});
});
unittest.group("obj-schema-LogLine", () {
unittest.test("to-json--from-json", () {
var o = buildLogLine();
var od = new api.LogLine.fromJson(o.toJson());
checkLogLine(od);
});
});
unittest.group("obj-schema-LogMetric", () {
unittest.test("to-json--from-json", () {
var o = buildLogMetric();
var od = new api.LogMetric.fromJson(o.toJson());
checkLogMetric(od);
});
});
unittest.group("obj-schema-LogSink", () {
unittest.test("to-json--from-json", () {
var o = buildLogSink();
var od = new api.LogSink.fromJson(o.toJson());
checkLogSink(od);
});
});
unittest.group("obj-schema-MetricDescriptor", () {
unittest.test("to-json--from-json", () {
var o = buildMetricDescriptor();
var od = new api.MetricDescriptor.fromJson(o.toJson());
checkMetricDescriptor(od);
});
});
unittest.group("obj-schema-MonitoredResource", () {
unittest.test("to-json--from-json", () {
var o = buildMonitoredResource();
var od = new api.MonitoredResource.fromJson(o.toJson());
checkMonitoredResource(od);
});
});
unittest.group("obj-schema-MonitoredResourceDescriptor", () {
unittest.test("to-json--from-json", () {
var o = buildMonitoredResourceDescriptor();
var od = new api.MonitoredResourceDescriptor.fromJson(o.toJson());
checkMonitoredResourceDescriptor(od);
});
});
unittest.group("obj-schema-RequestLog", () {
unittest.test("to-json--from-json", () {
var o = buildRequestLog();
var od = new api.RequestLog.fromJson(o.toJson());
checkRequestLog(od);
});
});
unittest.group("obj-schema-SourceLocation", () {
unittest.test("to-json--from-json", () {
var o = buildSourceLocation();
var od = new api.SourceLocation.fromJson(o.toJson());
checkSourceLocation(od);
});
});
unittest.group("obj-schema-SourceReference", () {
unittest.test("to-json--from-json", () {
var o = buildSourceReference();
var od = new api.SourceReference.fromJson(o.toJson());
checkSourceReference(od);
});
});
unittest.group("obj-schema-WriteLogEntriesRequest", () {
unittest.test("to-json--from-json", () {
var o = buildWriteLogEntriesRequest();
var od = new api.WriteLogEntriesRequest.fromJson(o.toJson());
checkWriteLogEntriesRequest(od);
});
});
unittest.group("obj-schema-WriteLogEntriesResponse", () {
unittest.test("to-json--from-json", () {
var o = buildWriteLogEntriesResponse();
var od = new api.WriteLogEntriesResponse.fromJson(o.toJson());
checkWriteLogEntriesResponse(od);
});
});
unittest.group("resource-BillingAccountsLogsResourceApi", () {
unittest.test("method--delete", () {
var mock = new HttpServerMock();
api.BillingAccountsLogsResourceApi res =
new api.LoggingApi(mock).billingAccounts.logs;
var arg_logName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildEmpty());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_logName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.BillingAccountsLogsResourceApi res =
new api.LoggingApi(mock).billingAccounts.logs;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_parent,
pageToken: arg_pageToken,
pageSize: arg_pageSize,
$fields: arg_$fields)
.then(unittest.expectAsync1(((api.ListLogsResponse response) {
checkListLogsResponse(response);
})));
});
});
unittest.group("resource-EntriesResourceApi", () {
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.EntriesResourceApi res = new api.LoggingApi(mock).entries;
var arg_request = buildListLogEntriesRequest();
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.ListLogEntriesRequest.fromJson(json);
checkListLogEntriesRequest(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 + 20),
unittest.equals("v2beta1/entries:list"));
pathOffset += 20;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogEntriesResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_request, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.ListLogEntriesResponse response) {
checkListLogEntriesResponse(response);
})));
});
unittest.test("method--write", () {
var mock = new HttpServerMock();
api.EntriesResourceApi res = new api.LoggingApi(mock).entries;
var arg_request = buildWriteLogEntriesRequest();
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.WriteLogEntriesRequest.fromJson(json);
checkWriteLogEntriesRequest(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 + 21),
unittest.equals("v2beta1/entries:write"));
pathOffset += 21;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildWriteLogEntriesResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.write(arg_request, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.WriteLogEntriesResponse response) {
checkWriteLogEntriesResponse(response);
})));
});
});
unittest.group("resource-MonitoredResourceDescriptorsResourceApi", () {
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.MonitoredResourceDescriptorsResourceApi res =
new api.LoggingApi(mock).monitoredResourceDescriptors;
var arg_pageToken = "foo";
var arg_pageSize = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 36),
unittest.equals("v2beta1/monitoredResourceDescriptors"));
pathOffset += 36;
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]));
}
}
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON
.encode(buildListMonitoredResourceDescriptorsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(
pageToken: arg_pageToken,
pageSize: arg_pageSize,
$fields: arg_$fields)
.then(unittest.expectAsync1(
((api.ListMonitoredResourceDescriptorsResponse response) {
checkListMonitoredResourceDescriptorsResponse(response);
})));
});
});
unittest.group("resource-OrganizationsLogsResourceApi", () {
unittest.test("method--delete", () {
var mock = new HttpServerMock();
api.OrganizationsLogsResourceApi res =
new api.LoggingApi(mock).organizations.logs;
var arg_logName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildEmpty());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_logName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.OrganizationsLogsResourceApi res =
new api.LoggingApi(mock).organizations.logs;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_parent,
pageToken: arg_pageToken,
pageSize: arg_pageSize,
$fields: arg_$fields)
.then(unittest.expectAsync1(((api.ListLogsResponse response) {
checkListLogsResponse(response);
})));
});
});
unittest.group("resource-ProjectsLogsResourceApi", () {
unittest.test("method--delete", () {
var mock = new HttpServerMock();
api.ProjectsLogsResourceApi res = new api.LoggingApi(mock).projects.logs;
var arg_logName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildEmpty());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_logName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.ProjectsLogsResourceApi res = new api.LoggingApi(mock).projects.logs;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_parent,
pageToken: arg_pageToken,
pageSize: arg_pageSize,
$fields: arg_$fields)
.then(unittest.expectAsync1(((api.ListLogsResponse response) {
checkListLogsResponse(response);
})));
});
});
unittest.group("resource-ProjectsMetricsResourceApi", () {
unittest.test("method--create", () {
var mock = new HttpServerMock();
api.ProjectsMetricsResourceApi res =
new api.LoggingApi(mock).projects.metrics;
var arg_request = buildLogMetric();
var arg_parent = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.LogMetric.fromJson(json);
checkLogMetric(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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildLogMetric());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_parent, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.LogMetric response) {
checkLogMetric(response);
})));
});
unittest.test("method--delete", () {
var mock = new HttpServerMock();
api.ProjectsMetricsResourceApi res =
new api.LoggingApi(mock).projects.metrics;
var arg_metricName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildEmpty());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_metricName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--get", () {
var mock = new HttpServerMock();
api.ProjectsMetricsResourceApi res =
new api.LoggingApi(mock).projects.metrics;
var arg_metricName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildLogMetric());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_metricName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.LogMetric response) {
checkLogMetric(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.ProjectsMetricsResourceApi res =
new api.LoggingApi(mock).projects.metrics;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListLogMetricsResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_parent,
pageToken: arg_pageToken,
pageSize: arg_pageSize,
$fields: arg_$fields)
.then(unittest.expectAsync1(((api.ListLogMetricsResponse response) {
checkListLogMetricsResponse(response);
})));
});
unittest.test("method--update", () {
var mock = new HttpServerMock();
api.ProjectsMetricsResourceApi res =
new api.LoggingApi(mock).projects.metrics;
var arg_request = buildLogMetric();
var arg_metricName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.LogMetric.fromJson(json);
checkLogMetric(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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildLogMetric());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.update(arg_request, arg_metricName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.LogMetric response) {
checkLogMetric(response);
})));
});
});
unittest.group("resource-ProjectsSinksResourceApi", () {
unittest.test("method--create", () {
var mock = new HttpServerMock();
api.ProjectsSinksResourceApi res =
new api.LoggingApi(mock).projects.sinks;
var arg_request = buildLogSink();
var arg_parent = "foo";
var arg_uniqueWriterIdentity = true;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.LogSink.fromJson(json);
checkLogSink(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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["uniqueWriterIdentity"].first,
unittest.equals("$arg_uniqueWriterIdentity"));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildLogSink());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_parent,
uniqueWriterIdentity: arg_uniqueWriterIdentity,
$fields: arg_$fields)
.then(unittest.expectAsync1(((api.LogSink response) {
checkLogSink(response);
})));
});
unittest.test("method--delete", () {
var mock = new HttpServerMock();
api.ProjectsSinksResourceApi res =
new api.LoggingApi(mock).projects.sinks;
var arg_sinkName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildEmpty());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_sinkName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.Empty response) {
checkEmpty(response);
})));
});
unittest.test("method--get", () {
var mock = new HttpServerMock();
api.ProjectsSinksResourceApi res =
new api.LoggingApi(mock).projects.sinks;
var arg_sinkName = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildLogSink());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_sinkName, $fields: arg_$fields)
.then(unittest.expectAsync1(((api.LogSink response) {
checkLogSink(response);
})));
});
unittest.test("method--list", () {
var mock = new HttpServerMock();
api.ProjectsSinksResourceApi res =
new api.LoggingApi(mock).projects.sinks;
var arg_parent = "foo";
var arg_pageToken = "foo";
var arg_pageSize = 42;
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(core.int.parse(queryMap["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildListSinksResponse());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_parent,
pageToken: arg_pageToken,
pageSize: arg_pageSize,
$fields: arg_$fields)
.then(unittest.expectAsync1(((api.ListSinksResponse response) {
checkListSinksResponse(response);
})));
});
unittest.test("method--update", () {
var mock = new HttpServerMock();
api.ProjectsSinksResourceApi res =
new api.LoggingApi(mock).projects.sinks;
var arg_request = buildLogSink();
var arg_sinkName = "foo";
var arg_uniqueWriterIdentity = true;
var arg_updateMask = "foo";
var arg_$fields = "foo";
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = new api.LogSink.fromJson(json);
checkLogSink(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 + 8),
unittest.equals("v2beta1/"));
pathOffset += 8;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
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]));
}
}
unittest.expect(queryMap["uniqueWriterIdentity"].first,
unittest.equals("$arg_uniqueWriterIdentity"));
unittest.expect(
queryMap["updateMask"].first, unittest.equals(arg_updateMask));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
"content-type": "application/json; charset=utf-8",
};
var resp = convert.JSON.encode(buildLogSink());
return new async.Future.value(stringResponse(200, h, resp));
}), true);
res
.update(arg_request, arg_sinkName,
uniqueWriterIdentity: arg_uniqueWriterIdentity,
updateMask: arg_updateMask,
$fields: arg_$fields)
.then(unittest.expectAsync1(((api.LogSink response) {
checkLogSink(response);
})));
});
});
}