blob: 9337602574c05899b00e210c111754ffaa7cd9a2 [file] [log] [blame]
// ignore_for_file: camel_case_types
// ignore_for_file: comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: directives_ordering
// ignore_for_file: file_names
// ignore_for_file: library_names
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: omit_local_variable_types
// ignore_for_file: prefer_expression_function_bodies
// ignore_for_file: prefer_final_locals
// ignore_for_file: prefer_interpolation_to_compose_strings
// ignore_for_file: unnecessary_brace_in_string_interps
// ignore_for_file: unnecessary_cast
// ignore_for_file: unnecessary_lambdas
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: unnecessary_string_interpolations
// ignore_for_file: avoid_returning_null
// ignore_for_file: cascade_invocations
// ignore_for_file: prefer_single_quotes
// ignore_for_file: unused_local_variable
library googleapis.sourcerepo.v1.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/sourcerepo/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;
}
@core.override
async.Future<http.StreamedResponse> send(http.BaseRequest request) async {
if (_expectJson) {
final jsonString =
await request.finalize().transform(convert.utf8.decoder).join('');
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 {
final data = await stream.toBytes();
return _callback(request, data);
}
}
}
}
http.StreamedResponse stringResponse(core.int status,
core.Map<core.String, core.String> headers, core.String body) {
var stream = async.Stream.fromIterable([convert.utf8.encode(body)]);
return http.StreamedResponse(stream, status, headers: headers);
}
core.List<api.AuditLogConfig> buildUnnamed3239() {
var o = <api.AuditLogConfig>[];
o.add(buildAuditLogConfig());
o.add(buildAuditLogConfig());
return o;
}
void checkUnnamed3239(core.List<api.AuditLogConfig> o) {
unittest.expect(o, unittest.hasLength(2));
checkAuditLogConfig(o[0]);
checkAuditLogConfig(o[1]);
}
core.int buildCounterAuditConfig = 0;
api.AuditConfig buildAuditConfig() {
var o = api.AuditConfig();
buildCounterAuditConfig++;
if (buildCounterAuditConfig < 3) {
o.auditLogConfigs = buildUnnamed3239();
o.service = 'foo';
}
buildCounterAuditConfig--;
return o;
}
void checkAuditConfig(api.AuditConfig o) {
buildCounterAuditConfig++;
if (buildCounterAuditConfig < 3) {
checkUnnamed3239(o.auditLogConfigs);
unittest.expect(o.service, unittest.equals('foo'));
}
buildCounterAuditConfig--;
}
core.List<core.String> buildUnnamed3240() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3240(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 buildCounterAuditLogConfig = 0;
api.AuditLogConfig buildAuditLogConfig() {
var o = api.AuditLogConfig();
buildCounterAuditLogConfig++;
if (buildCounterAuditLogConfig < 3) {
o.exemptedMembers = buildUnnamed3240();
o.logType = 'foo';
}
buildCounterAuditLogConfig--;
return o;
}
void checkAuditLogConfig(api.AuditLogConfig o) {
buildCounterAuditLogConfig++;
if (buildCounterAuditLogConfig < 3) {
checkUnnamed3240(o.exemptedMembers);
unittest.expect(o.logType, unittest.equals('foo'));
}
buildCounterAuditLogConfig--;
}
core.List<core.String> buildUnnamed3241() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3241(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 buildCounterBinding = 0;
api.Binding buildBinding() {
var o = api.Binding();
buildCounterBinding++;
if (buildCounterBinding < 3) {
o.condition = buildExpr();
o.members = buildUnnamed3241();
o.role = 'foo';
}
buildCounterBinding--;
return o;
}
void checkBinding(api.Binding o) {
buildCounterBinding++;
if (buildCounterBinding < 3) {
checkExpr(o.condition);
checkUnnamed3241(o.members);
unittest.expect(o.role, unittest.equals('foo'));
}
buildCounterBinding--;
}
core.int buildCounterEmpty = 0;
api.Empty buildEmpty() {
var o = api.Empty();
buildCounterEmpty++;
if (buildCounterEmpty < 3) {}
buildCounterEmpty--;
return o;
}
void checkEmpty(api.Empty o) {
buildCounterEmpty++;
if (buildCounterEmpty < 3) {}
buildCounterEmpty--;
}
core.int buildCounterExpr = 0;
api.Expr buildExpr() {
var o = api.Expr();
buildCounterExpr++;
if (buildCounterExpr < 3) {
o.description = 'foo';
o.expression = 'foo';
o.location = 'foo';
o.title = 'foo';
}
buildCounterExpr--;
return o;
}
void checkExpr(api.Expr o) {
buildCounterExpr++;
if (buildCounterExpr < 3) {
unittest.expect(o.description, unittest.equals('foo'));
unittest.expect(o.expression, unittest.equals('foo'));
unittest.expect(o.location, unittest.equals('foo'));
unittest.expect(o.title, unittest.equals('foo'));
}
buildCounterExpr--;
}
core.List<api.Repo> buildUnnamed3242() {
var o = <api.Repo>[];
o.add(buildRepo());
o.add(buildRepo());
return o;
}
void checkUnnamed3242(core.List<api.Repo> o) {
unittest.expect(o, unittest.hasLength(2));
checkRepo(o[0]);
checkRepo(o[1]);
}
core.int buildCounterListReposResponse = 0;
api.ListReposResponse buildListReposResponse() {
var o = api.ListReposResponse();
buildCounterListReposResponse++;
if (buildCounterListReposResponse < 3) {
o.nextPageToken = 'foo';
o.repos = buildUnnamed3242();
}
buildCounterListReposResponse--;
return o;
}
void checkListReposResponse(api.ListReposResponse o) {
buildCounterListReposResponse++;
if (buildCounterListReposResponse < 3) {
unittest.expect(o.nextPageToken, unittest.equals('foo'));
checkUnnamed3242(o.repos);
}
buildCounterListReposResponse--;
}
core.int buildCounterMirrorConfig = 0;
api.MirrorConfig buildMirrorConfig() {
var o = api.MirrorConfig();
buildCounterMirrorConfig++;
if (buildCounterMirrorConfig < 3) {
o.deployKeyId = 'foo';
o.url = 'foo';
o.webhookId = 'foo';
}
buildCounterMirrorConfig--;
return o;
}
void checkMirrorConfig(api.MirrorConfig o) {
buildCounterMirrorConfig++;
if (buildCounterMirrorConfig < 3) {
unittest.expect(o.deployKeyId, unittest.equals('foo'));
unittest.expect(o.url, unittest.equals('foo'));
unittest.expect(o.webhookId, unittest.equals('foo'));
}
buildCounterMirrorConfig--;
}
core.Map<core.String, core.Object> buildUnnamed3243() {
var o = <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;
}
void checkUnnamed3243(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'));
}
core.Map<core.String, core.Object> buildUnnamed3244() {
var o = <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;
}
void checkUnnamed3244(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 buildCounterOperation = 0;
api.Operation buildOperation() {
var o = api.Operation();
buildCounterOperation++;
if (buildCounterOperation < 3) {
o.done = true;
o.error = buildStatus();
o.metadata = buildUnnamed3243();
o.name = 'foo';
o.response = buildUnnamed3244();
}
buildCounterOperation--;
return o;
}
void checkOperation(api.Operation o) {
buildCounterOperation++;
if (buildCounterOperation < 3) {
unittest.expect(o.done, unittest.isTrue);
checkStatus(o.error);
checkUnnamed3243(o.metadata);
unittest.expect(o.name, unittest.equals('foo'));
checkUnnamed3244(o.response);
}
buildCounterOperation--;
}
core.List<api.AuditConfig> buildUnnamed3245() {
var o = <api.AuditConfig>[];
o.add(buildAuditConfig());
o.add(buildAuditConfig());
return o;
}
void checkUnnamed3245(core.List<api.AuditConfig> o) {
unittest.expect(o, unittest.hasLength(2));
checkAuditConfig(o[0]);
checkAuditConfig(o[1]);
}
core.List<api.Binding> buildUnnamed3246() {
var o = <api.Binding>[];
o.add(buildBinding());
o.add(buildBinding());
return o;
}
void checkUnnamed3246(core.List<api.Binding> o) {
unittest.expect(o, unittest.hasLength(2));
checkBinding(o[0]);
checkBinding(o[1]);
}
core.int buildCounterPolicy = 0;
api.Policy buildPolicy() {
var o = api.Policy();
buildCounterPolicy++;
if (buildCounterPolicy < 3) {
o.auditConfigs = buildUnnamed3245();
o.bindings = buildUnnamed3246();
o.etag = 'foo';
o.version = 42;
}
buildCounterPolicy--;
return o;
}
void checkPolicy(api.Policy o) {
buildCounterPolicy++;
if (buildCounterPolicy < 3) {
checkUnnamed3245(o.auditConfigs);
checkUnnamed3246(o.bindings);
unittest.expect(o.etag, unittest.equals('foo'));
unittest.expect(o.version, unittest.equals(42));
}
buildCounterPolicy--;
}
core.Map<core.String, api.PubsubConfig> buildUnnamed3247() {
var o = <core.String, api.PubsubConfig>{};
o['x'] = buildPubsubConfig();
o['y'] = buildPubsubConfig();
return o;
}
void checkUnnamed3247(core.Map<core.String, api.PubsubConfig> o) {
unittest.expect(o, unittest.hasLength(2));
checkPubsubConfig(o['x']);
checkPubsubConfig(o['y']);
}
core.int buildCounterProjectConfig = 0;
api.ProjectConfig buildProjectConfig() {
var o = api.ProjectConfig();
buildCounterProjectConfig++;
if (buildCounterProjectConfig < 3) {
o.enablePrivateKeyCheck = true;
o.name = 'foo';
o.pubsubConfigs = buildUnnamed3247();
}
buildCounterProjectConfig--;
return o;
}
void checkProjectConfig(api.ProjectConfig o) {
buildCounterProjectConfig++;
if (buildCounterProjectConfig < 3) {
unittest.expect(o.enablePrivateKeyCheck, unittest.isTrue);
unittest.expect(o.name, unittest.equals('foo'));
checkUnnamed3247(o.pubsubConfigs);
}
buildCounterProjectConfig--;
}
core.int buildCounterPubsubConfig = 0;
api.PubsubConfig buildPubsubConfig() {
var o = api.PubsubConfig();
buildCounterPubsubConfig++;
if (buildCounterPubsubConfig < 3) {
o.messageFormat = 'foo';
o.serviceAccountEmail = 'foo';
o.topic = 'foo';
}
buildCounterPubsubConfig--;
return o;
}
void checkPubsubConfig(api.PubsubConfig o) {
buildCounterPubsubConfig++;
if (buildCounterPubsubConfig < 3) {
unittest.expect(o.messageFormat, unittest.equals('foo'));
unittest.expect(o.serviceAccountEmail, unittest.equals('foo'));
unittest.expect(o.topic, unittest.equals('foo'));
}
buildCounterPubsubConfig--;
}
core.Map<core.String, api.PubsubConfig> buildUnnamed3248() {
var o = <core.String, api.PubsubConfig>{};
o['x'] = buildPubsubConfig();
o['y'] = buildPubsubConfig();
return o;
}
void checkUnnamed3248(core.Map<core.String, api.PubsubConfig> o) {
unittest.expect(o, unittest.hasLength(2));
checkPubsubConfig(o['x']);
checkPubsubConfig(o['y']);
}
core.int buildCounterRepo = 0;
api.Repo buildRepo() {
var o = api.Repo();
buildCounterRepo++;
if (buildCounterRepo < 3) {
o.mirrorConfig = buildMirrorConfig();
o.name = 'foo';
o.pubsubConfigs = buildUnnamed3248();
o.size = 'foo';
o.url = 'foo';
}
buildCounterRepo--;
return o;
}
void checkRepo(api.Repo o) {
buildCounterRepo++;
if (buildCounterRepo < 3) {
checkMirrorConfig(o.mirrorConfig);
unittest.expect(o.name, unittest.equals('foo'));
checkUnnamed3248(o.pubsubConfigs);
unittest.expect(o.size, unittest.equals('foo'));
unittest.expect(o.url, unittest.equals('foo'));
}
buildCounterRepo--;
}
core.int buildCounterSetIamPolicyRequest = 0;
api.SetIamPolicyRequest buildSetIamPolicyRequest() {
var o = api.SetIamPolicyRequest();
buildCounterSetIamPolicyRequest++;
if (buildCounterSetIamPolicyRequest < 3) {
o.policy = buildPolicy();
o.updateMask = 'foo';
}
buildCounterSetIamPolicyRequest--;
return o;
}
void checkSetIamPolicyRequest(api.SetIamPolicyRequest o) {
buildCounterSetIamPolicyRequest++;
if (buildCounterSetIamPolicyRequest < 3) {
checkPolicy(o.policy);
unittest.expect(o.updateMask, unittest.equals('foo'));
}
buildCounterSetIamPolicyRequest--;
}
core.Map<core.String, core.Object> buildUnnamed3249() {
var o = <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;
}
void checkUnnamed3249(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'));
}
core.List<core.Map<core.String, core.Object>> buildUnnamed3250() {
var o = <core.Map<core.String, core.Object>>[];
o.add(buildUnnamed3249());
o.add(buildUnnamed3249());
return o;
}
void checkUnnamed3250(core.List<core.Map<core.String, core.Object>> o) {
unittest.expect(o, unittest.hasLength(2));
checkUnnamed3249(o[0]);
checkUnnamed3249(o[1]);
}
core.int buildCounterStatus = 0;
api.Status buildStatus() {
var o = api.Status();
buildCounterStatus++;
if (buildCounterStatus < 3) {
o.code = 42;
o.details = buildUnnamed3250();
o.message = 'foo';
}
buildCounterStatus--;
return o;
}
void checkStatus(api.Status o) {
buildCounterStatus++;
if (buildCounterStatus < 3) {
unittest.expect(o.code, unittest.equals(42));
checkUnnamed3250(o.details);
unittest.expect(o.message, unittest.equals('foo'));
}
buildCounterStatus--;
}
core.int buildCounterSyncRepoMetadata = 0;
api.SyncRepoMetadata buildSyncRepoMetadata() {
var o = api.SyncRepoMetadata();
buildCounterSyncRepoMetadata++;
if (buildCounterSyncRepoMetadata < 3) {
o.name = 'foo';
o.startTime = 'foo';
o.statusMessage = 'foo';
o.updateTime = 'foo';
}
buildCounterSyncRepoMetadata--;
return o;
}
void checkSyncRepoMetadata(api.SyncRepoMetadata o) {
buildCounterSyncRepoMetadata++;
if (buildCounterSyncRepoMetadata < 3) {
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.startTime, unittest.equals('foo'));
unittest.expect(o.statusMessage, unittest.equals('foo'));
unittest.expect(o.updateTime, unittest.equals('foo'));
}
buildCounterSyncRepoMetadata--;
}
core.int buildCounterSyncRepoRequest = 0;
api.SyncRepoRequest buildSyncRepoRequest() {
var o = api.SyncRepoRequest();
buildCounterSyncRepoRequest++;
if (buildCounterSyncRepoRequest < 3) {}
buildCounterSyncRepoRequest--;
return o;
}
void checkSyncRepoRequest(api.SyncRepoRequest o) {
buildCounterSyncRepoRequest++;
if (buildCounterSyncRepoRequest < 3) {}
buildCounterSyncRepoRequest--;
}
core.List<core.String> buildUnnamed3251() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3251(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 buildCounterTestIamPermissionsRequest = 0;
api.TestIamPermissionsRequest buildTestIamPermissionsRequest() {
var o = api.TestIamPermissionsRequest();
buildCounterTestIamPermissionsRequest++;
if (buildCounterTestIamPermissionsRequest < 3) {
o.permissions = buildUnnamed3251();
}
buildCounterTestIamPermissionsRequest--;
return o;
}
void checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) {
buildCounterTestIamPermissionsRequest++;
if (buildCounterTestIamPermissionsRequest < 3) {
checkUnnamed3251(o.permissions);
}
buildCounterTestIamPermissionsRequest--;
}
core.List<core.String> buildUnnamed3252() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3252(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 buildCounterTestIamPermissionsResponse = 0;
api.TestIamPermissionsResponse buildTestIamPermissionsResponse() {
var o = api.TestIamPermissionsResponse();
buildCounterTestIamPermissionsResponse++;
if (buildCounterTestIamPermissionsResponse < 3) {
o.permissions = buildUnnamed3252();
}
buildCounterTestIamPermissionsResponse--;
return o;
}
void checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) {
buildCounterTestIamPermissionsResponse++;
if (buildCounterTestIamPermissionsResponse < 3) {
checkUnnamed3252(o.permissions);
}
buildCounterTestIamPermissionsResponse--;
}
core.int buildCounterUpdateProjectConfigRequest = 0;
api.UpdateProjectConfigRequest buildUpdateProjectConfigRequest() {
var o = api.UpdateProjectConfigRequest();
buildCounterUpdateProjectConfigRequest++;
if (buildCounterUpdateProjectConfigRequest < 3) {
o.projectConfig = buildProjectConfig();
o.updateMask = 'foo';
}
buildCounterUpdateProjectConfigRequest--;
return o;
}
void checkUpdateProjectConfigRequest(api.UpdateProjectConfigRequest o) {
buildCounterUpdateProjectConfigRequest++;
if (buildCounterUpdateProjectConfigRequest < 3) {
checkProjectConfig(o.projectConfig);
unittest.expect(o.updateMask, unittest.equals('foo'));
}
buildCounterUpdateProjectConfigRequest--;
}
core.int buildCounterUpdateRepoRequest = 0;
api.UpdateRepoRequest buildUpdateRepoRequest() {
var o = api.UpdateRepoRequest();
buildCounterUpdateRepoRequest++;
if (buildCounterUpdateRepoRequest < 3) {
o.repo = buildRepo();
o.updateMask = 'foo';
}
buildCounterUpdateRepoRequest--;
return o;
}
void checkUpdateRepoRequest(api.UpdateRepoRequest o) {
buildCounterUpdateRepoRequest++;
if (buildCounterUpdateRepoRequest < 3) {
checkRepo(o.repo);
unittest.expect(o.updateMask, unittest.equals('foo'));
}
buildCounterUpdateRepoRequest--;
}
void main() {
unittest.group('obj-schema-AuditConfig', () {
unittest.test('to-json--from-json', () {
var o = buildAuditConfig();
var od = api.AuditConfig.fromJson(o.toJson());
checkAuditConfig(od);
});
});
unittest.group('obj-schema-AuditLogConfig', () {
unittest.test('to-json--from-json', () {
var o = buildAuditLogConfig();
var od = api.AuditLogConfig.fromJson(o.toJson());
checkAuditLogConfig(od);
});
});
unittest.group('obj-schema-Binding', () {
unittest.test('to-json--from-json', () {
var o = buildBinding();
var od = api.Binding.fromJson(o.toJson());
checkBinding(od);
});
});
unittest.group('obj-schema-Empty', () {
unittest.test('to-json--from-json', () {
var o = buildEmpty();
var od = api.Empty.fromJson(o.toJson());
checkEmpty(od);
});
});
unittest.group('obj-schema-Expr', () {
unittest.test('to-json--from-json', () {
var o = buildExpr();
var od = api.Expr.fromJson(o.toJson());
checkExpr(od);
});
});
unittest.group('obj-schema-ListReposResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListReposResponse();
var od = api.ListReposResponse.fromJson(o.toJson());
checkListReposResponse(od);
});
});
unittest.group('obj-schema-MirrorConfig', () {
unittest.test('to-json--from-json', () {
var o = buildMirrorConfig();
var od = api.MirrorConfig.fromJson(o.toJson());
checkMirrorConfig(od);
});
});
unittest.group('obj-schema-Operation', () {
unittest.test('to-json--from-json', () {
var o = buildOperation();
var od = api.Operation.fromJson(o.toJson());
checkOperation(od);
});
});
unittest.group('obj-schema-Policy', () {
unittest.test('to-json--from-json', () {
var o = buildPolicy();
var od = api.Policy.fromJson(o.toJson());
checkPolicy(od);
});
});
unittest.group('obj-schema-ProjectConfig', () {
unittest.test('to-json--from-json', () {
var o = buildProjectConfig();
var od = api.ProjectConfig.fromJson(o.toJson());
checkProjectConfig(od);
});
});
unittest.group('obj-schema-PubsubConfig', () {
unittest.test('to-json--from-json', () {
var o = buildPubsubConfig();
var od = api.PubsubConfig.fromJson(o.toJson());
checkPubsubConfig(od);
});
});
unittest.group('obj-schema-Repo', () {
unittest.test('to-json--from-json', () {
var o = buildRepo();
var od = api.Repo.fromJson(o.toJson());
checkRepo(od);
});
});
unittest.group('obj-schema-SetIamPolicyRequest', () {
unittest.test('to-json--from-json', () {
var o = buildSetIamPolicyRequest();
var od = api.SetIamPolicyRequest.fromJson(o.toJson());
checkSetIamPolicyRequest(od);
});
});
unittest.group('obj-schema-Status', () {
unittest.test('to-json--from-json', () {
var o = buildStatus();
var od = api.Status.fromJson(o.toJson());
checkStatus(od);
});
});
unittest.group('obj-schema-SyncRepoMetadata', () {
unittest.test('to-json--from-json', () {
var o = buildSyncRepoMetadata();
var od = api.SyncRepoMetadata.fromJson(o.toJson());
checkSyncRepoMetadata(od);
});
});
unittest.group('obj-schema-SyncRepoRequest', () {
unittest.test('to-json--from-json', () {
var o = buildSyncRepoRequest();
var od = api.SyncRepoRequest.fromJson(o.toJson());
checkSyncRepoRequest(od);
});
});
unittest.group('obj-schema-TestIamPermissionsRequest', () {
unittest.test('to-json--from-json', () {
var o = buildTestIamPermissionsRequest();
var od = api.TestIamPermissionsRequest.fromJson(o.toJson());
checkTestIamPermissionsRequest(od);
});
});
unittest.group('obj-schema-TestIamPermissionsResponse', () {
unittest.test('to-json--from-json', () {
var o = buildTestIamPermissionsResponse();
var od = api.TestIamPermissionsResponse.fromJson(o.toJson());
checkTestIamPermissionsResponse(od);
});
});
unittest.group('obj-schema-UpdateProjectConfigRequest', () {
unittest.test('to-json--from-json', () {
var o = buildUpdateProjectConfigRequest();
var od = api.UpdateProjectConfigRequest.fromJson(o.toJson());
checkUpdateProjectConfigRequest(od);
});
});
unittest.group('obj-schema-UpdateRepoRequest', () {
unittest.test('to-json--from-json', () {
var o = buildUpdateRepoRequest();
var od = api.UpdateRepoRequest.fromJson(o.toJson());
checkUpdateRepoRequest(od);
});
});
unittest.group('resource-ProjectsResourceApi', () {
unittest.test('method--getConfig', () {
var mock = HttpServerMock();
api.ProjectsResourceApi res = api.SourcerepoApi(mock).projects;
var arg_name = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildProjectConfig());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getConfig(arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkProjectConfig(response);
})));
});
unittest.test('method--updateConfig', () {
var mock = HttpServerMock();
api.ProjectsResourceApi res = api.SourcerepoApi(mock).projects;
var arg_request = buildUpdateProjectConfigRequest();
var arg_name = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.UpdateProjectConfigRequest.fromJson(json);
checkUpdateProjectConfigRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildProjectConfig());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.updateConfig(arg_request, arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkProjectConfig(response);
})));
});
});
unittest.group('resource-ProjectsReposResourceApi', () {
unittest.test('method--create', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_request = buildRepo();
var arg_parent = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Repo.fromJson(json);
checkRepo(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildRepo());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_parent, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkRepo(response);
})));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_name = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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 async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkEmpty(response);
})));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_name = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildRepo());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkRepo(response);
})));
});
unittest.test('method--getIamPolicy', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_resource = 'foo';
var arg_options_requestedPolicyVersion = 42;
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(
core.int.parse(queryMap["options.requestedPolicyVersion"].first),
unittest.equals(arg_options_requestedPolicyVersion));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildPolicy());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getIamPolicy(arg_resource,
options_requestedPolicyVersion:
arg_options_requestedPolicyVersion,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkPolicy(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_name = 'foo';
var arg_pageSize = 42;
var arg_pageToken = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(core.int.parse(queryMap["pageSize"].first),
unittest.equals(arg_pageSize));
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListReposResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_name,
pageSize: arg_pageSize,
pageToken: arg_pageToken,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListReposResponse(response);
})));
});
unittest.test('method--patch', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_request = buildUpdateRepoRequest();
var arg_name = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.UpdateRepoRequest.fromJson(json);
checkUpdateRepoRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildRepo());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.patch(arg_request, arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkRepo(response);
})));
});
unittest.test('method--setIamPolicy', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_request = buildSetIamPolicyRequest();
var arg_resource = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.SetIamPolicyRequest.fromJson(json);
checkSetIamPolicyRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildPolicy());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.setIamPolicy(arg_request, arg_resource, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkPolicy(response);
})));
});
unittest.test('method--sync', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_request = buildSyncRepoRequest();
var arg_name = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.SyncRepoRequest.fromJson(json);
checkSyncRepoRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildOperation());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.sync(arg_request, arg_name, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkOperation(response);
})));
});
unittest.test('method--testIamPermissions', () {
var mock = HttpServerMock();
api.ProjectsReposResourceApi res = api.SourcerepoApi(mock).projects.repos;
var arg_request = buildTestIamPermissionsRequest();
var arg_resource = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.TestIamPermissionsRequest.fromJson(json);
checkTestIamPermissionsRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(
path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/"));
pathOffset += 3;
// NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
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(buildTestIamPermissionsResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.testIamPermissions(arg_request, arg_resource, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkTestIamPermissionsResponse(response);
})));
});
});
}