| library googleapis_beta.clouduseraccounts.beta.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/clouduseraccounts/beta.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); |
| } |
| |
| buildUnnamed3778() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3778(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 buildCounterAuthorizedKeysView = 0; |
| buildAuthorizedKeysView() { |
| var o = new api.AuthorizedKeysView(); |
| buildCounterAuthorizedKeysView++; |
| if (buildCounterAuthorizedKeysView < 3) { |
| o.keys = buildUnnamed3778(); |
| o.sudoer = true; |
| } |
| buildCounterAuthorizedKeysView--; |
| return o; |
| } |
| |
| checkAuthorizedKeysView(api.AuthorizedKeysView o) { |
| buildCounterAuthorizedKeysView++; |
| if (buildCounterAuthorizedKeysView < 3) { |
| checkUnnamed3778(o.keys); |
| unittest.expect(o.sudoer, unittest.isTrue); |
| } |
| buildCounterAuthorizedKeysView--; |
| } |
| |
| buildUnnamed3779() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3779(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 buildCounterGroup = 0; |
| buildGroup() { |
| var o = new api.Group(); |
| buildCounterGroup++; |
| if (buildCounterGroup < 3) { |
| o.creationTimestamp = "foo"; |
| o.description = "foo"; |
| o.id = "foo"; |
| o.kind = "foo"; |
| o.members = buildUnnamed3779(); |
| o.name = "foo"; |
| o.selfLink = "foo"; |
| } |
| buildCounterGroup--; |
| return o; |
| } |
| |
| checkGroup(api.Group o) { |
| buildCounterGroup++; |
| if (buildCounterGroup < 3) { |
| unittest.expect(o.creationTimestamp, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| checkUnnamed3779(o.members); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| } |
| buildCounterGroup--; |
| } |
| |
| buildUnnamed3780() { |
| var o = new core.List<api.Group>(); |
| o.add(buildGroup()); |
| o.add(buildGroup()); |
| return o; |
| } |
| |
| checkUnnamed3780(core.List<api.Group> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkGroup(o[0]); |
| checkGroup(o[1]); |
| } |
| |
| core.int buildCounterGroupList = 0; |
| buildGroupList() { |
| var o = new api.GroupList(); |
| buildCounterGroupList++; |
| if (buildCounterGroupList < 3) { |
| o.id = "foo"; |
| o.items = buildUnnamed3780(); |
| o.kind = "foo"; |
| o.nextPageToken = "foo"; |
| o.selfLink = "foo"; |
| } |
| buildCounterGroupList--; |
| return o; |
| } |
| |
| checkGroupList(api.GroupList o) { |
| buildCounterGroupList++; |
| if (buildCounterGroupList < 3) { |
| unittest.expect(o.id, unittest.equals('foo')); |
| checkUnnamed3780(o.items); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| } |
| buildCounterGroupList--; |
| } |
| |
| buildUnnamed3781() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3781(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 buildCounterGroupsAddMemberRequest = 0; |
| buildGroupsAddMemberRequest() { |
| var o = new api.GroupsAddMemberRequest(); |
| buildCounterGroupsAddMemberRequest++; |
| if (buildCounterGroupsAddMemberRequest < 3) { |
| o.users = buildUnnamed3781(); |
| } |
| buildCounterGroupsAddMemberRequest--; |
| return o; |
| } |
| |
| checkGroupsAddMemberRequest(api.GroupsAddMemberRequest o) { |
| buildCounterGroupsAddMemberRequest++; |
| if (buildCounterGroupsAddMemberRequest < 3) { |
| checkUnnamed3781(o.users); |
| } |
| buildCounterGroupsAddMemberRequest--; |
| } |
| |
| buildUnnamed3782() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3782(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 buildCounterGroupsRemoveMemberRequest = 0; |
| buildGroupsRemoveMemberRequest() { |
| var o = new api.GroupsRemoveMemberRequest(); |
| buildCounterGroupsRemoveMemberRequest++; |
| if (buildCounterGroupsRemoveMemberRequest < 3) { |
| o.users = buildUnnamed3782(); |
| } |
| buildCounterGroupsRemoveMemberRequest--; |
| return o; |
| } |
| |
| checkGroupsRemoveMemberRequest(api.GroupsRemoveMemberRequest o) { |
| buildCounterGroupsRemoveMemberRequest++; |
| if (buildCounterGroupsRemoveMemberRequest < 3) { |
| checkUnnamed3782(o.users); |
| } |
| buildCounterGroupsRemoveMemberRequest--; |
| } |
| |
| buildUnnamed3783() { |
| var o = new core.List<api.LinuxGroupView>(); |
| o.add(buildLinuxGroupView()); |
| o.add(buildLinuxGroupView()); |
| return o; |
| } |
| |
| checkUnnamed3783(core.List<api.LinuxGroupView> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkLinuxGroupView(o[0]); |
| checkLinuxGroupView(o[1]); |
| } |
| |
| buildUnnamed3784() { |
| var o = new core.List<api.LinuxUserView>(); |
| o.add(buildLinuxUserView()); |
| o.add(buildLinuxUserView()); |
| return o; |
| } |
| |
| checkUnnamed3784(core.List<api.LinuxUserView> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkLinuxUserView(o[0]); |
| checkLinuxUserView(o[1]); |
| } |
| |
| core.int buildCounterLinuxAccountViews = 0; |
| buildLinuxAccountViews() { |
| var o = new api.LinuxAccountViews(); |
| buildCounterLinuxAccountViews++; |
| if (buildCounterLinuxAccountViews < 3) { |
| o.groupViews = buildUnnamed3783(); |
| o.kind = "foo"; |
| o.userViews = buildUnnamed3784(); |
| } |
| buildCounterLinuxAccountViews--; |
| return o; |
| } |
| |
| checkLinuxAccountViews(api.LinuxAccountViews o) { |
| buildCounterLinuxAccountViews++; |
| if (buildCounterLinuxAccountViews < 3) { |
| checkUnnamed3783(o.groupViews); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| checkUnnamed3784(o.userViews); |
| } |
| buildCounterLinuxAccountViews--; |
| } |
| |
| core.int buildCounterLinuxGetAuthorizedKeysViewResponse = 0; |
| buildLinuxGetAuthorizedKeysViewResponse() { |
| var o = new api.LinuxGetAuthorizedKeysViewResponse(); |
| buildCounterLinuxGetAuthorizedKeysViewResponse++; |
| if (buildCounterLinuxGetAuthorizedKeysViewResponse < 3) { |
| o.resource = buildAuthorizedKeysView(); |
| } |
| buildCounterLinuxGetAuthorizedKeysViewResponse--; |
| return o; |
| } |
| |
| checkLinuxGetAuthorizedKeysViewResponse( |
| api.LinuxGetAuthorizedKeysViewResponse o) { |
| buildCounterLinuxGetAuthorizedKeysViewResponse++; |
| if (buildCounterLinuxGetAuthorizedKeysViewResponse < 3) { |
| checkAuthorizedKeysView(o.resource); |
| } |
| buildCounterLinuxGetAuthorizedKeysViewResponse--; |
| } |
| |
| core.int buildCounterLinuxGetLinuxAccountViewsResponse = 0; |
| buildLinuxGetLinuxAccountViewsResponse() { |
| var o = new api.LinuxGetLinuxAccountViewsResponse(); |
| buildCounterLinuxGetLinuxAccountViewsResponse++; |
| if (buildCounterLinuxGetLinuxAccountViewsResponse < 3) { |
| o.resource = buildLinuxAccountViews(); |
| } |
| buildCounterLinuxGetLinuxAccountViewsResponse--; |
| return o; |
| } |
| |
| checkLinuxGetLinuxAccountViewsResponse( |
| api.LinuxGetLinuxAccountViewsResponse o) { |
| buildCounterLinuxGetLinuxAccountViewsResponse++; |
| if (buildCounterLinuxGetLinuxAccountViewsResponse < 3) { |
| checkLinuxAccountViews(o.resource); |
| } |
| buildCounterLinuxGetLinuxAccountViewsResponse--; |
| } |
| |
| buildUnnamed3785() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3785(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 buildCounterLinuxGroupView = 0; |
| buildLinuxGroupView() { |
| var o = new api.LinuxGroupView(); |
| buildCounterLinuxGroupView++; |
| if (buildCounterLinuxGroupView < 3) { |
| o.gid = 42; |
| o.groupName = "foo"; |
| o.members = buildUnnamed3785(); |
| } |
| buildCounterLinuxGroupView--; |
| return o; |
| } |
| |
| checkLinuxGroupView(api.LinuxGroupView o) { |
| buildCounterLinuxGroupView++; |
| if (buildCounterLinuxGroupView < 3) { |
| unittest.expect(o.gid, unittest.equals(42)); |
| unittest.expect(o.groupName, unittest.equals('foo')); |
| checkUnnamed3785(o.members); |
| } |
| buildCounterLinuxGroupView--; |
| } |
| |
| core.int buildCounterLinuxUserView = 0; |
| buildLinuxUserView() { |
| var o = new api.LinuxUserView(); |
| buildCounterLinuxUserView++; |
| if (buildCounterLinuxUserView < 3) { |
| o.gecos = "foo"; |
| o.gid = 42; |
| o.homeDirectory = "foo"; |
| o.shell = "foo"; |
| o.uid = 42; |
| o.username = "foo"; |
| } |
| buildCounterLinuxUserView--; |
| return o; |
| } |
| |
| checkLinuxUserView(api.LinuxUserView o) { |
| buildCounterLinuxUserView++; |
| if (buildCounterLinuxUserView < 3) { |
| unittest.expect(o.gecos, unittest.equals('foo')); |
| unittest.expect(o.gid, unittest.equals(42)); |
| unittest.expect(o.homeDirectory, unittest.equals('foo')); |
| unittest.expect(o.shell, unittest.equals('foo')); |
| unittest.expect(o.uid, unittest.equals(42)); |
| unittest.expect(o.username, unittest.equals('foo')); |
| } |
| buildCounterLinuxUserView--; |
| } |
| |
| core.int buildCounterOperationErrorErrors = 0; |
| buildOperationErrorErrors() { |
| var o = new api.OperationErrorErrors(); |
| buildCounterOperationErrorErrors++; |
| if (buildCounterOperationErrorErrors < 3) { |
| o.code = "foo"; |
| o.location = "foo"; |
| o.message = "foo"; |
| } |
| buildCounterOperationErrorErrors--; |
| return o; |
| } |
| |
| checkOperationErrorErrors(api.OperationErrorErrors o) { |
| buildCounterOperationErrorErrors++; |
| if (buildCounterOperationErrorErrors < 3) { |
| unittest.expect(o.code, unittest.equals('foo')); |
| unittest.expect(o.location, unittest.equals('foo')); |
| unittest.expect(o.message, unittest.equals('foo')); |
| } |
| buildCounterOperationErrorErrors--; |
| } |
| |
| buildUnnamed3786() { |
| var o = new core.List<api.OperationErrorErrors>(); |
| o.add(buildOperationErrorErrors()); |
| o.add(buildOperationErrorErrors()); |
| return o; |
| } |
| |
| checkUnnamed3786(core.List<api.OperationErrorErrors> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperationErrorErrors(o[0]); |
| checkOperationErrorErrors(o[1]); |
| } |
| |
| core.int buildCounterOperationError = 0; |
| buildOperationError() { |
| var o = new api.OperationError(); |
| buildCounterOperationError++; |
| if (buildCounterOperationError < 3) { |
| o.errors = buildUnnamed3786(); |
| } |
| buildCounterOperationError--; |
| return o; |
| } |
| |
| checkOperationError(api.OperationError o) { |
| buildCounterOperationError++; |
| if (buildCounterOperationError < 3) { |
| checkUnnamed3786(o.errors); |
| } |
| buildCounterOperationError--; |
| } |
| |
| core.int buildCounterOperationWarningsData = 0; |
| buildOperationWarningsData() { |
| var o = new api.OperationWarningsData(); |
| buildCounterOperationWarningsData++; |
| if (buildCounterOperationWarningsData < 3) { |
| o.key = "foo"; |
| o.value = "foo"; |
| } |
| buildCounterOperationWarningsData--; |
| return o; |
| } |
| |
| checkOperationWarningsData(api.OperationWarningsData o) { |
| buildCounterOperationWarningsData++; |
| if (buildCounterOperationWarningsData < 3) { |
| unittest.expect(o.key, unittest.equals('foo')); |
| unittest.expect(o.value, unittest.equals('foo')); |
| } |
| buildCounterOperationWarningsData--; |
| } |
| |
| buildUnnamed3787() { |
| var o = new core.List<api.OperationWarningsData>(); |
| o.add(buildOperationWarningsData()); |
| o.add(buildOperationWarningsData()); |
| return o; |
| } |
| |
| checkUnnamed3787(core.List<api.OperationWarningsData> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperationWarningsData(o[0]); |
| checkOperationWarningsData(o[1]); |
| } |
| |
| core.int buildCounterOperationWarnings = 0; |
| buildOperationWarnings() { |
| var o = new api.OperationWarnings(); |
| buildCounterOperationWarnings++; |
| if (buildCounterOperationWarnings < 3) { |
| o.code = "foo"; |
| o.data = buildUnnamed3787(); |
| o.message = "foo"; |
| } |
| buildCounterOperationWarnings--; |
| return o; |
| } |
| |
| checkOperationWarnings(api.OperationWarnings o) { |
| buildCounterOperationWarnings++; |
| if (buildCounterOperationWarnings < 3) { |
| unittest.expect(o.code, unittest.equals('foo')); |
| checkUnnamed3787(o.data); |
| unittest.expect(o.message, unittest.equals('foo')); |
| } |
| buildCounterOperationWarnings--; |
| } |
| |
| buildUnnamed3788() { |
| var o = new core.List<api.OperationWarnings>(); |
| o.add(buildOperationWarnings()); |
| o.add(buildOperationWarnings()); |
| return o; |
| } |
| |
| checkUnnamed3788(core.List<api.OperationWarnings> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperationWarnings(o[0]); |
| checkOperationWarnings(o[1]); |
| } |
| |
| core.int buildCounterOperation = 0; |
| buildOperation() { |
| var o = new api.Operation(); |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| o.clientOperationId = "foo"; |
| o.creationTimestamp = "foo"; |
| o.description = "foo"; |
| o.endTime = "foo"; |
| o.error = buildOperationError(); |
| o.httpErrorMessage = "foo"; |
| o.httpErrorStatusCode = 42; |
| o.id = "foo"; |
| o.insertTime = "foo"; |
| o.kind = "foo"; |
| o.name = "foo"; |
| o.operationType = "foo"; |
| o.progress = 42; |
| o.region = "foo"; |
| o.selfLink = "foo"; |
| o.startTime = "foo"; |
| o.status = "foo"; |
| o.statusMessage = "foo"; |
| o.targetId = "foo"; |
| o.targetLink = "foo"; |
| o.user = "foo"; |
| o.warnings = buildUnnamed3788(); |
| o.zone = "foo"; |
| } |
| buildCounterOperation--; |
| return o; |
| } |
| |
| checkOperation(api.Operation o) { |
| buildCounterOperation++; |
| if (buildCounterOperation < 3) { |
| unittest.expect(o.clientOperationId, unittest.equals('foo')); |
| unittest.expect(o.creationTimestamp, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.endTime, unittest.equals('foo')); |
| checkOperationError(o.error); |
| unittest.expect(o.httpErrorMessage, unittest.equals('foo')); |
| unittest.expect(o.httpErrorStatusCode, unittest.equals(42)); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.insertTime, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.operationType, unittest.equals('foo')); |
| unittest.expect(o.progress, unittest.equals(42)); |
| unittest.expect(o.region, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| unittest.expect(o.startTime, unittest.equals('foo')); |
| unittest.expect(o.status, unittest.equals('foo')); |
| unittest.expect(o.statusMessage, unittest.equals('foo')); |
| unittest.expect(o.targetId, unittest.equals('foo')); |
| unittest.expect(o.targetLink, unittest.equals('foo')); |
| unittest.expect(o.user, unittest.equals('foo')); |
| checkUnnamed3788(o.warnings); |
| unittest.expect(o.zone, unittest.equals('foo')); |
| } |
| buildCounterOperation--; |
| } |
| |
| buildUnnamed3789() { |
| var o = new core.List<api.Operation>(); |
| o.add(buildOperation()); |
| o.add(buildOperation()); |
| return o; |
| } |
| |
| checkUnnamed3789(core.List<api.Operation> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkOperation(o[0]); |
| checkOperation(o[1]); |
| } |
| |
| core.int buildCounterOperationList = 0; |
| buildOperationList() { |
| var o = new api.OperationList(); |
| buildCounterOperationList++; |
| if (buildCounterOperationList < 3) { |
| o.id = "foo"; |
| o.items = buildUnnamed3789(); |
| o.kind = "foo"; |
| o.nextPageToken = "foo"; |
| o.selfLink = "foo"; |
| } |
| buildCounterOperationList--; |
| return o; |
| } |
| |
| checkOperationList(api.OperationList o) { |
| buildCounterOperationList++; |
| if (buildCounterOperationList < 3) { |
| unittest.expect(o.id, unittest.equals('foo')); |
| checkUnnamed3789(o.items); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| } |
| buildCounterOperationList--; |
| } |
| |
| core.int buildCounterPublicKey = 0; |
| buildPublicKey() { |
| var o = new api.PublicKey(); |
| buildCounterPublicKey++; |
| if (buildCounterPublicKey < 3) { |
| o.creationTimestamp = "foo"; |
| o.description = "foo"; |
| o.expirationTimestamp = "foo"; |
| o.fingerprint = "foo"; |
| o.key = "foo"; |
| } |
| buildCounterPublicKey--; |
| return o; |
| } |
| |
| checkPublicKey(api.PublicKey o) { |
| buildCounterPublicKey++; |
| if (buildCounterPublicKey < 3) { |
| unittest.expect(o.creationTimestamp, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| unittest.expect(o.expirationTimestamp, unittest.equals('foo')); |
| unittest.expect(o.fingerprint, unittest.equals('foo')); |
| unittest.expect(o.key, unittest.equals('foo')); |
| } |
| buildCounterPublicKey--; |
| } |
| |
| buildUnnamed3790() { |
| var o = new core.List<core.String>(); |
| o.add("foo"); |
| o.add("foo"); |
| return o; |
| } |
| |
| checkUnnamed3790(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')); |
| } |
| |
| buildUnnamed3791() { |
| var o = new core.List<api.PublicKey>(); |
| o.add(buildPublicKey()); |
| o.add(buildPublicKey()); |
| return o; |
| } |
| |
| checkUnnamed3791(core.List<api.PublicKey> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkPublicKey(o[0]); |
| checkPublicKey(o[1]); |
| } |
| |
| core.int buildCounterUser = 0; |
| buildUser() { |
| var o = new api.User(); |
| buildCounterUser++; |
| if (buildCounterUser < 3) { |
| o.creationTimestamp = "foo"; |
| o.description = "foo"; |
| o.groups = buildUnnamed3790(); |
| o.id = "foo"; |
| o.kind = "foo"; |
| o.name = "foo"; |
| o.owner = "foo"; |
| o.publicKeys = buildUnnamed3791(); |
| o.selfLink = "foo"; |
| } |
| buildCounterUser--; |
| return o; |
| } |
| |
| checkUser(api.User o) { |
| buildCounterUser++; |
| if (buildCounterUser < 3) { |
| unittest.expect(o.creationTimestamp, unittest.equals('foo')); |
| unittest.expect(o.description, unittest.equals('foo')); |
| checkUnnamed3790(o.groups); |
| unittest.expect(o.id, unittest.equals('foo')); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.name, unittest.equals('foo')); |
| unittest.expect(o.owner, unittest.equals('foo')); |
| checkUnnamed3791(o.publicKeys); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| } |
| buildCounterUser--; |
| } |
| |
| buildUnnamed3792() { |
| var o = new core.List<api.User>(); |
| o.add(buildUser()); |
| o.add(buildUser()); |
| return o; |
| } |
| |
| checkUnnamed3792(core.List<api.User> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkUser(o[0]); |
| checkUser(o[1]); |
| } |
| |
| core.int buildCounterUserList = 0; |
| buildUserList() { |
| var o = new api.UserList(); |
| buildCounterUserList++; |
| if (buildCounterUserList < 3) { |
| o.id = "foo"; |
| o.items = buildUnnamed3792(); |
| o.kind = "foo"; |
| o.nextPageToken = "foo"; |
| o.selfLink = "foo"; |
| } |
| buildCounterUserList--; |
| return o; |
| } |
| |
| checkUserList(api.UserList o) { |
| buildCounterUserList++; |
| if (buildCounterUserList < 3) { |
| unittest.expect(o.id, unittest.equals('foo')); |
| checkUnnamed3792(o.items); |
| unittest.expect(o.kind, unittest.equals('foo')); |
| unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| unittest.expect(o.selfLink, unittest.equals('foo')); |
| } |
| buildCounterUserList--; |
| } |
| |
| main() { |
| unittest.group("obj-schema-AuthorizedKeysView", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildAuthorizedKeysView(); |
| var od = new api.AuthorizedKeysView.fromJson(o.toJson()); |
| checkAuthorizedKeysView(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Group", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildGroup(); |
| var od = new api.Group.fromJson(o.toJson()); |
| checkGroup(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-GroupList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildGroupList(); |
| var od = new api.GroupList.fromJson(o.toJson()); |
| checkGroupList(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-GroupsAddMemberRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildGroupsAddMemberRequest(); |
| var od = new api.GroupsAddMemberRequest.fromJson(o.toJson()); |
| checkGroupsAddMemberRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-GroupsRemoveMemberRequest", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildGroupsRemoveMemberRequest(); |
| var od = new api.GroupsRemoveMemberRequest.fromJson(o.toJson()); |
| checkGroupsRemoveMemberRequest(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-LinuxAccountViews", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLinuxAccountViews(); |
| var od = new api.LinuxAccountViews.fromJson(o.toJson()); |
| checkLinuxAccountViews(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-LinuxGetAuthorizedKeysViewResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLinuxGetAuthorizedKeysViewResponse(); |
| var od = new api.LinuxGetAuthorizedKeysViewResponse.fromJson(o.toJson()); |
| checkLinuxGetAuthorizedKeysViewResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-LinuxGetLinuxAccountViewsResponse", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLinuxGetLinuxAccountViewsResponse(); |
| var od = new api.LinuxGetLinuxAccountViewsResponse.fromJson(o.toJson()); |
| checkLinuxGetLinuxAccountViewsResponse(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-LinuxGroupView", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLinuxGroupView(); |
| var od = new api.LinuxGroupView.fromJson(o.toJson()); |
| checkLinuxGroupView(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-LinuxUserView", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildLinuxUserView(); |
| var od = new api.LinuxUserView.fromJson(o.toJson()); |
| checkLinuxUserView(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-OperationErrorErrors", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperationErrorErrors(); |
| var od = new api.OperationErrorErrors.fromJson(o.toJson()); |
| checkOperationErrorErrors(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-OperationError", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperationError(); |
| var od = new api.OperationError.fromJson(o.toJson()); |
| checkOperationError(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-OperationWarningsData", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperationWarningsData(); |
| var od = new api.OperationWarningsData.fromJson(o.toJson()); |
| checkOperationWarningsData(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-OperationWarnings", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperationWarnings(); |
| var od = new api.OperationWarnings.fromJson(o.toJson()); |
| checkOperationWarnings(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-Operation", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperation(); |
| var od = new api.Operation.fromJson(o.toJson()); |
| checkOperation(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-OperationList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildOperationList(); |
| var od = new api.OperationList.fromJson(o.toJson()); |
| checkOperationList(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-PublicKey", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildPublicKey(); |
| var od = new api.PublicKey.fromJson(o.toJson()); |
| checkPublicKey(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-User", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildUser(); |
| var od = new api.User.fromJson(o.toJson()); |
| checkUser(od); |
| }); |
| }); |
| |
| unittest.group("obj-schema-UserList", () { |
| unittest.test("to-json--from-json", () { |
| var o = buildUserList(); |
| var od = new api.UserList.fromJson(o.toJson()); |
| checkUserList(od); |
| }); |
| }); |
| |
| unittest.group("resource-GlobalAccountsOperationsResourceApi", () { |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.GlobalAccountsOperationsResourceApi res = |
| new api.ClouduseraccountsApi(mock).globalAccountsOperations; |
| var arg_project = "foo"; |
| var arg_operation = "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; |
| |
| 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 = ""; |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_project, arg_operation, $fields: arg_$fields) |
| .then(unittest.expectAsync1((_) {})); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.GlobalAccountsOperationsResourceApi res = |
| new api.ClouduseraccountsApi(mock).globalAccountsOperations; |
| var arg_project = "foo"; |
| var arg_operation = "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; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_project, arg_operation, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.GlobalAccountsOperationsResourceApi res = |
| new api.ClouduseraccountsApi(mock).globalAccountsOperations; |
| var arg_project = "foo"; |
| var arg_filter = "foo"; |
| var arg_maxResults = 42; |
| var arg_orderBy = "foo"; |
| var arg_pageToken = "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; |
| |
| 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["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| unittest.equals(arg_maxResults)); |
| unittest.expect( |
| queryMap["orderBy"].first, unittest.equals(arg_orderBy)); |
| 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(buildOperationList()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_project, |
| filter: arg_filter, |
| maxResults: arg_maxResults, |
| orderBy: arg_orderBy, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.OperationList response) { |
| checkOperationList(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-GroupsResourceApi", () { |
| unittest.test("method--addMember", () { |
| var mock = new HttpServerMock(); |
| api.GroupsResourceApi res = new api.ClouduseraccountsApi(mock).groups; |
| var arg_request = buildGroupsAddMemberRequest(); |
| var arg_project = "foo"; |
| var arg_groupName = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.GroupsAddMemberRequest.fromJson(json); |
| checkGroupsAddMemberRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .addMember(arg_request, arg_project, arg_groupName, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.GroupsResourceApi res = new api.ClouduseraccountsApi(mock).groups; |
| var arg_project = "foo"; |
| var arg_groupName = "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; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_project, arg_groupName, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.GroupsResourceApi res = new api.ClouduseraccountsApi(mock).groups; |
| var arg_project = "foo"; |
| var arg_groupName = "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; |
| |
| 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(buildGroup()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_project, arg_groupName, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Group response) { |
| checkGroup(response); |
| }))); |
| }); |
| |
| unittest.test("method--insert", () { |
| var mock = new HttpServerMock(); |
| api.GroupsResourceApi res = new api.ClouduseraccountsApi(mock).groups; |
| var arg_request = buildGroup(); |
| var arg_project = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.Group.fromJson(json); |
| checkGroup(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .insert(arg_request, arg_project, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.GroupsResourceApi res = new api.ClouduseraccountsApi(mock).groups; |
| var arg_project = "foo"; |
| var arg_filter = "foo"; |
| var arg_maxResults = 42; |
| var arg_orderBy = "foo"; |
| var arg_pageToken = "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; |
| |
| 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["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| unittest.equals(arg_maxResults)); |
| unittest.expect( |
| queryMap["orderBy"].first, unittest.equals(arg_orderBy)); |
| 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(buildGroupList()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_project, |
| filter: arg_filter, |
| maxResults: arg_maxResults, |
| orderBy: arg_orderBy, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.GroupList response) { |
| checkGroupList(response); |
| }))); |
| }); |
| |
| unittest.test("method--removeMember", () { |
| var mock = new HttpServerMock(); |
| api.GroupsResourceApi res = new api.ClouduseraccountsApi(mock).groups; |
| var arg_request = buildGroupsRemoveMemberRequest(); |
| var arg_project = "foo"; |
| var arg_groupName = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.GroupsRemoveMemberRequest.fromJson(json); |
| checkGroupsRemoveMemberRequest(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .removeMember(arg_request, arg_project, arg_groupName, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-LinuxResourceApi", () { |
| unittest.test("method--getAuthorizedKeysView", () { |
| var mock = new HttpServerMock(); |
| api.LinuxResourceApi res = new api.ClouduseraccountsApi(mock).linux; |
| var arg_project = "foo"; |
| var arg_zone = "foo"; |
| var arg_user = "foo"; |
| var arg_instance = "foo"; |
| var arg_login = true; |
| 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; |
| |
| 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["instance"].first, unittest.equals(arg_instance)); |
| unittest.expect(queryMap["login"].first, unittest.equals("$arg_login")); |
| unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields)); |
| |
| var h = { |
| "content-type": "application/json; charset=utf-8", |
| }; |
| var resp = |
| convert.JSON.encode(buildLinuxGetAuthorizedKeysViewResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .getAuthorizedKeysView(arg_project, arg_zone, arg_user, arg_instance, |
| login: arg_login, $fields: arg_$fields) |
| .then(unittest |
| .expectAsync1(((api.LinuxGetAuthorizedKeysViewResponse response) { |
| checkLinuxGetAuthorizedKeysViewResponse(response); |
| }))); |
| }); |
| |
| unittest.test("method--getLinuxAccountViews", () { |
| var mock = new HttpServerMock(); |
| api.LinuxResourceApi res = new api.ClouduseraccountsApi(mock).linux; |
| var arg_project = "foo"; |
| var arg_zone = "foo"; |
| var arg_instance = "foo"; |
| var arg_filter = "foo"; |
| var arg_maxResults = 42; |
| var arg_orderBy = "foo"; |
| var arg_pageToken = "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; |
| |
| 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["instance"].first, unittest.equals(arg_instance)); |
| unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| unittest.equals(arg_maxResults)); |
| unittest.expect( |
| queryMap["orderBy"].first, unittest.equals(arg_orderBy)); |
| 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(buildLinuxGetLinuxAccountViewsResponse()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .getLinuxAccountViews(arg_project, arg_zone, arg_instance, |
| filter: arg_filter, |
| maxResults: arg_maxResults, |
| orderBy: arg_orderBy, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest |
| .expectAsync1(((api.LinuxGetLinuxAccountViewsResponse response) { |
| checkLinuxGetLinuxAccountViewsResponse(response); |
| }))); |
| }); |
| }); |
| |
| unittest.group("resource-UsersResourceApi", () { |
| unittest.test("method--addPublicKey", () { |
| var mock = new HttpServerMock(); |
| api.UsersResourceApi res = new api.ClouduseraccountsApi(mock).users; |
| var arg_request = buildPublicKey(); |
| var arg_project = "foo"; |
| var arg_user = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.PublicKey.fromJson(json); |
| checkPublicKey(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .addPublicKey(arg_request, arg_project, arg_user, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--delete", () { |
| var mock = new HttpServerMock(); |
| api.UsersResourceApi res = new api.ClouduseraccountsApi(mock).users; |
| var arg_project = "foo"; |
| var arg_user = "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; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .delete(arg_project, arg_user, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--get", () { |
| var mock = new HttpServerMock(); |
| api.UsersResourceApi res = new api.ClouduseraccountsApi(mock).users; |
| var arg_project = "foo"; |
| var arg_user = "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; |
| |
| 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(buildUser()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .get(arg_project, arg_user, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.User response) { |
| checkUser(response); |
| }))); |
| }); |
| |
| unittest.test("method--insert", () { |
| var mock = new HttpServerMock(); |
| api.UsersResourceApi res = new api.ClouduseraccountsApi(mock).users; |
| var arg_request = buildUser(); |
| var arg_project = "foo"; |
| var arg_$fields = "foo"; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| var obj = new api.User.fromJson(json); |
| checkUser(obj); |
| |
| var path = (req.url).path; |
| var pathOffset = 0; |
| var index; |
| var subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| pathOffset += 1; |
| |
| 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(buildOperation()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .insert(arg_request, arg_project, $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| |
| unittest.test("method--list", () { |
| var mock = new HttpServerMock(); |
| api.UsersResourceApi res = new api.ClouduseraccountsApi(mock).users; |
| var arg_project = "foo"; |
| var arg_filter = "foo"; |
| var arg_maxResults = 42; |
| var arg_orderBy = "foo"; |
| var arg_pageToken = "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; |
| |
| 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["filter"].first, unittest.equals(arg_filter)); |
| unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| unittest.equals(arg_maxResults)); |
| unittest.expect( |
| queryMap["orderBy"].first, unittest.equals(arg_orderBy)); |
| 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(buildUserList()); |
| return new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .list(arg_project, |
| filter: arg_filter, |
| maxResults: arg_maxResults, |
| orderBy: arg_orderBy, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.UserList response) { |
| checkUserList(response); |
| }))); |
| }); |
| |
| unittest.test("method--removePublicKey", () { |
| var mock = new HttpServerMock(); |
| api.UsersResourceApi res = new api.ClouduseraccountsApi(mock).users; |
| var arg_project = "foo"; |
| var arg_user = "foo"; |
| var arg_fingerprint = "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; |
| |
| 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["fingerprint"].first, unittest.equals(arg_fingerprint)); |
| 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 new async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| res |
| .removePublicKey(arg_project, arg_user, arg_fingerprint, |
| $fields: arg_$fields) |
| .then(unittest.expectAsync1(((api.Operation response) { |
| checkOperation(response); |
| }))); |
| }); |
| }); |
| } |