Index: generated/googleapis/test/cloudresourcemanager/v2beta1_test.dart |
diff --git a/generated/googleapis/test/cloudresourcemanager/v2beta1_test.dart b/generated/googleapis/test/cloudresourcemanager/v2beta1_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4cc0088e8a4edfa627070c1977c9342dfcd4354e |
--- /dev/null |
+++ b/generated/googleapis/test/cloudresourcemanager/v2beta1_test.dart |
@@ -0,0 +1,1343 @@ |
+library googleapis.cloudresourcemanager.v2beta1.test; |
+ |
+import "dart:core" as core; |
+import "dart:collection" as collection; |
+import "dart:async" as async; |
+import "dart:convert" as convert; |
+ |
+import 'package:http/http.dart' as http; |
+import 'package:http/testing.dart' as http_testing; |
+import 'package:test/test.dart' as unittest; |
+ |
+import 'package:googleapis/cloudresourcemanager/v2beta1.dart' as api; |
+ |
+class HttpServerMock extends http.BaseClient { |
+ core.Function _callback; |
+ core.bool _expectJson; |
+ |
+ void register(core.Function callback, core.bool expectJson) { |
+ _callback = callback; |
+ _expectJson = expectJson; |
+ } |
+ |
+ async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
+ if (_expectJson) { |
+ return request.finalize() |
+ .transform(convert.UTF8.decoder) |
+ .join('') |
+ .then((core.String jsonString) { |
+ if (jsonString.isEmpty) { |
+ return _callback(request, null); |
+ } else { |
+ return _callback(request, convert.JSON.decode(jsonString)); |
+ } |
+ }); |
+ } else { |
+ var stream = request.finalize(); |
+ if (stream == null) { |
+ return _callback(request, []); |
+ } else { |
+ return stream.toBytes().then((data) { |
+ return _callback(request, data); |
+ }); |
+ } |
+ } |
+ } |
+} |
+ |
+http.StreamedResponse stringResponse( |
+ core.int status, core.Map<core.String, core.String> headers, core.String body) { |
+ var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
+ return new http.StreamedResponse(stream, status, headers: headers); |
+} |
+ |
+buildUnnamed120() { |
+ var o = new core.List<api.AuditLogConfig>(); |
+ o.add(buildAuditLogConfig()); |
+ o.add(buildAuditLogConfig()); |
+ return o; |
+} |
+ |
+checkUnnamed120(core.List<api.AuditLogConfig> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkAuditLogConfig(o[0]); |
+ checkAuditLogConfig(o[1]); |
+} |
+ |
+core.int buildCounterAuditConfig = 0; |
+buildAuditConfig() { |
+ var o = new api.AuditConfig(); |
+ buildCounterAuditConfig++; |
+ if (buildCounterAuditConfig < 3) { |
+ o.auditLogConfigs = buildUnnamed120(); |
+ o.service = "foo"; |
+ } |
+ buildCounterAuditConfig--; |
+ return o; |
+} |
+ |
+checkAuditConfig(api.AuditConfig o) { |
+ buildCounterAuditConfig++; |
+ if (buildCounterAuditConfig < 3) { |
+ checkUnnamed120(o.auditLogConfigs); |
+ unittest.expect(o.service, unittest.equals('foo')); |
+ } |
+ buildCounterAuditConfig--; |
+} |
+ |
+buildUnnamed121() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed121(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; |
+buildAuditLogConfig() { |
+ var o = new api.AuditLogConfig(); |
+ buildCounterAuditLogConfig++; |
+ if (buildCounterAuditLogConfig < 3) { |
+ o.exemptedMembers = buildUnnamed121(); |
+ o.logType = "foo"; |
+ } |
+ buildCounterAuditLogConfig--; |
+ return o; |
+} |
+ |
+checkAuditLogConfig(api.AuditLogConfig o) { |
+ buildCounterAuditLogConfig++; |
+ if (buildCounterAuditLogConfig < 3) { |
+ checkUnnamed121(o.exemptedMembers); |
+ unittest.expect(o.logType, unittest.equals('foo')); |
+ } |
+ buildCounterAuditLogConfig--; |
+} |
+ |
+buildUnnamed122() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed122(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; |
+buildBinding() { |
+ var o = new api.Binding(); |
+ buildCounterBinding++; |
+ if (buildCounterBinding < 3) { |
+ o.members = buildUnnamed122(); |
+ o.role = "foo"; |
+ } |
+ buildCounterBinding--; |
+ return o; |
+} |
+ |
+checkBinding(api.Binding o) { |
+ buildCounterBinding++; |
+ if (buildCounterBinding < 3) { |
+ checkUnnamed122(o.members); |
+ unittest.expect(o.role, unittest.equals('foo')); |
+ } |
+ buildCounterBinding--; |
+} |
+ |
+core.int buildCounterFolder = 0; |
+buildFolder() { |
+ var o = new api.Folder(); |
+ buildCounterFolder++; |
+ if (buildCounterFolder < 3) { |
+ o.createTime = "foo"; |
+ o.displayName = "foo"; |
+ o.lifecycleState = "foo"; |
+ o.name = "foo"; |
+ o.parent = "foo"; |
+ } |
+ buildCounterFolder--; |
+ return o; |
+} |
+ |
+checkFolder(api.Folder o) { |
+ buildCounterFolder++; |
+ if (buildCounterFolder < 3) { |
+ unittest.expect(o.createTime, unittest.equals('foo')); |
+ unittest.expect(o.displayName, unittest.equals('foo')); |
+ unittest.expect(o.lifecycleState, unittest.equals('foo')); |
+ unittest.expect(o.name, unittest.equals('foo')); |
+ unittest.expect(o.parent, unittest.equals('foo')); |
+ } |
+ buildCounterFolder--; |
+} |
+ |
+core.int buildCounterFolderOperation = 0; |
+buildFolderOperation() { |
+ var o = new api.FolderOperation(); |
+ buildCounterFolderOperation++; |
+ if (buildCounterFolderOperation < 3) { |
+ o.destinationParent = "foo"; |
+ o.displayName = "foo"; |
+ o.operationType = "foo"; |
+ o.sourceParent = "foo"; |
+ } |
+ buildCounterFolderOperation--; |
+ return o; |
+} |
+ |
+checkFolderOperation(api.FolderOperation o) { |
+ buildCounterFolderOperation++; |
+ if (buildCounterFolderOperation < 3) { |
+ unittest.expect(o.destinationParent, unittest.equals('foo')); |
+ unittest.expect(o.displayName, unittest.equals('foo')); |
+ unittest.expect(o.operationType, unittest.equals('foo')); |
+ unittest.expect(o.sourceParent, unittest.equals('foo')); |
+ } |
+ buildCounterFolderOperation--; |
+} |
+ |
+core.int buildCounterFolderOperationError = 0; |
+buildFolderOperationError() { |
+ var o = new api.FolderOperationError(); |
+ buildCounterFolderOperationError++; |
+ if (buildCounterFolderOperationError < 3) { |
+ o.errorMessageId = "foo"; |
+ } |
+ buildCounterFolderOperationError--; |
+ return o; |
+} |
+ |
+checkFolderOperationError(api.FolderOperationError o) { |
+ buildCounterFolderOperationError++; |
+ if (buildCounterFolderOperationError < 3) { |
+ unittest.expect(o.errorMessageId, unittest.equals('foo')); |
+ } |
+ buildCounterFolderOperationError--; |
+} |
+ |
+core.int buildCounterGetIamPolicyRequest = 0; |
+buildGetIamPolicyRequest() { |
+ var o = new api.GetIamPolicyRequest(); |
+ buildCounterGetIamPolicyRequest++; |
+ if (buildCounterGetIamPolicyRequest < 3) { |
+ } |
+ buildCounterGetIamPolicyRequest--; |
+ return o; |
+} |
+ |
+checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
+ buildCounterGetIamPolicyRequest++; |
+ if (buildCounterGetIamPolicyRequest < 3) { |
+ } |
+ buildCounterGetIamPolicyRequest--; |
+} |
+ |
+buildUnnamed123() { |
+ var o = new core.List<api.Folder>(); |
+ o.add(buildFolder()); |
+ o.add(buildFolder()); |
+ return o; |
+} |
+ |
+checkUnnamed123(core.List<api.Folder> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkFolder(o[0]); |
+ checkFolder(o[1]); |
+} |
+ |
+core.int buildCounterListFoldersResponse = 0; |
+buildListFoldersResponse() { |
+ var o = new api.ListFoldersResponse(); |
+ buildCounterListFoldersResponse++; |
+ if (buildCounterListFoldersResponse < 3) { |
+ o.folders = buildUnnamed123(); |
+ o.nextPageToken = "foo"; |
+ } |
+ buildCounterListFoldersResponse--; |
+ return o; |
+} |
+ |
+checkListFoldersResponse(api.ListFoldersResponse o) { |
+ buildCounterListFoldersResponse++; |
+ if (buildCounterListFoldersResponse < 3) { |
+ checkUnnamed123(o.folders); |
+ unittest.expect(o.nextPageToken, unittest.equals('foo')); |
+ } |
+ buildCounterListFoldersResponse--; |
+} |
+ |
+core.int buildCounterMoveFolderRequest = 0; |
+buildMoveFolderRequest() { |
+ var o = new api.MoveFolderRequest(); |
+ buildCounterMoveFolderRequest++; |
+ if (buildCounterMoveFolderRequest < 3) { |
+ o.destinationParent = "foo"; |
+ } |
+ buildCounterMoveFolderRequest--; |
+ return o; |
+} |
+ |
+checkMoveFolderRequest(api.MoveFolderRequest o) { |
+ buildCounterMoveFolderRequest++; |
+ if (buildCounterMoveFolderRequest < 3) { |
+ unittest.expect(o.destinationParent, unittest.equals('foo')); |
+ } |
+ buildCounterMoveFolderRequest--; |
+} |
+ |
+buildUnnamed124() { |
+ var o = new core.Map<core.String, core.Object>(); |
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ return o; |
+} |
+ |
+checkUnnamed124(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')); |
+} |
+ |
+buildUnnamed125() { |
+ var o = new core.Map<core.String, core.Object>(); |
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ return o; |
+} |
+ |
+checkUnnamed125(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; |
+buildOperation() { |
+ var o = new api.Operation(); |
+ buildCounterOperation++; |
+ if (buildCounterOperation < 3) { |
+ o.done = true; |
+ o.error = buildStatus(); |
+ o.metadata = buildUnnamed124(); |
+ o.name = "foo"; |
+ o.response = buildUnnamed125(); |
+ } |
+ buildCounterOperation--; |
+ return o; |
+} |
+ |
+checkOperation(api.Operation o) { |
+ buildCounterOperation++; |
+ if (buildCounterOperation < 3) { |
+ unittest.expect(o.done, unittest.isTrue); |
+ checkStatus(o.error); |
+ checkUnnamed124(o.metadata); |
+ unittest.expect(o.name, unittest.equals('foo')); |
+ checkUnnamed125(o.response); |
+ } |
+ buildCounterOperation--; |
+} |
+ |
+buildUnnamed126() { |
+ var o = new core.List<api.AuditConfig>(); |
+ o.add(buildAuditConfig()); |
+ o.add(buildAuditConfig()); |
+ return o; |
+} |
+ |
+checkUnnamed126(core.List<api.AuditConfig> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkAuditConfig(o[0]); |
+ checkAuditConfig(o[1]); |
+} |
+ |
+buildUnnamed127() { |
+ var o = new core.List<api.Binding>(); |
+ o.add(buildBinding()); |
+ o.add(buildBinding()); |
+ return o; |
+} |
+ |
+checkUnnamed127(core.List<api.Binding> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkBinding(o[0]); |
+ checkBinding(o[1]); |
+} |
+ |
+core.int buildCounterPolicy = 0; |
+buildPolicy() { |
+ var o = new api.Policy(); |
+ buildCounterPolicy++; |
+ if (buildCounterPolicy < 3) { |
+ o.auditConfigs = buildUnnamed126(); |
+ o.bindings = buildUnnamed127(); |
+ o.etag = "foo"; |
+ o.version = 42; |
+ } |
+ buildCounterPolicy--; |
+ return o; |
+} |
+ |
+checkPolicy(api.Policy o) { |
+ buildCounterPolicy++; |
+ if (buildCounterPolicy < 3) { |
+ checkUnnamed126(o.auditConfigs); |
+ checkUnnamed127(o.bindings); |
+ unittest.expect(o.etag, unittest.equals('foo')); |
+ unittest.expect(o.version, unittest.equals(42)); |
+ } |
+ buildCounterPolicy--; |
+} |
+ |
+core.int buildCounterProjectCreationStatus = 0; |
+buildProjectCreationStatus() { |
+ var o = new api.ProjectCreationStatus(); |
+ buildCounterProjectCreationStatus++; |
+ if (buildCounterProjectCreationStatus < 3) { |
+ o.createTime = "foo"; |
+ o.gettable = true; |
+ o.ready = true; |
+ } |
+ buildCounterProjectCreationStatus--; |
+ return o; |
+} |
+ |
+checkProjectCreationStatus(api.ProjectCreationStatus o) { |
+ buildCounterProjectCreationStatus++; |
+ if (buildCounterProjectCreationStatus < 3) { |
+ unittest.expect(o.createTime, unittest.equals('foo')); |
+ unittest.expect(o.gettable, unittest.isTrue); |
+ unittest.expect(o.ready, unittest.isTrue); |
+ } |
+ buildCounterProjectCreationStatus--; |
+} |
+ |
+core.int buildCounterSearchFoldersRequest = 0; |
+buildSearchFoldersRequest() { |
+ var o = new api.SearchFoldersRequest(); |
+ buildCounterSearchFoldersRequest++; |
+ if (buildCounterSearchFoldersRequest < 3) { |
+ o.pageSize = 42; |
+ o.pageToken = "foo"; |
+ o.query = "foo"; |
+ } |
+ buildCounterSearchFoldersRequest--; |
+ return o; |
+} |
+ |
+checkSearchFoldersRequest(api.SearchFoldersRequest o) { |
+ buildCounterSearchFoldersRequest++; |
+ if (buildCounterSearchFoldersRequest < 3) { |
+ unittest.expect(o.pageSize, unittest.equals(42)); |
+ unittest.expect(o.pageToken, unittest.equals('foo')); |
+ unittest.expect(o.query, unittest.equals('foo')); |
+ } |
+ buildCounterSearchFoldersRequest--; |
+} |
+ |
+buildUnnamed128() { |
+ var o = new core.List<api.Folder>(); |
+ o.add(buildFolder()); |
+ o.add(buildFolder()); |
+ return o; |
+} |
+ |
+checkUnnamed128(core.List<api.Folder> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkFolder(o[0]); |
+ checkFolder(o[1]); |
+} |
+ |
+core.int buildCounterSearchFoldersResponse = 0; |
+buildSearchFoldersResponse() { |
+ var o = new api.SearchFoldersResponse(); |
+ buildCounterSearchFoldersResponse++; |
+ if (buildCounterSearchFoldersResponse < 3) { |
+ o.folders = buildUnnamed128(); |
+ o.nextPageToken = "foo"; |
+ } |
+ buildCounterSearchFoldersResponse--; |
+ return o; |
+} |
+ |
+checkSearchFoldersResponse(api.SearchFoldersResponse o) { |
+ buildCounterSearchFoldersResponse++; |
+ if (buildCounterSearchFoldersResponse < 3) { |
+ checkUnnamed128(o.folders); |
+ unittest.expect(o.nextPageToken, unittest.equals('foo')); |
+ } |
+ buildCounterSearchFoldersResponse--; |
+} |
+ |
+core.int buildCounterSetIamPolicyRequest = 0; |
+buildSetIamPolicyRequest() { |
+ var o = new api.SetIamPolicyRequest(); |
+ buildCounterSetIamPolicyRequest++; |
+ if (buildCounterSetIamPolicyRequest < 3) { |
+ o.policy = buildPolicy(); |
+ o.updateMask = "foo"; |
+ } |
+ buildCounterSetIamPolicyRequest--; |
+ return o; |
+} |
+ |
+checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
+ buildCounterSetIamPolicyRequest++; |
+ if (buildCounterSetIamPolicyRequest < 3) { |
+ checkPolicy(o.policy); |
+ unittest.expect(o.updateMask, unittest.equals('foo')); |
+ } |
+ buildCounterSetIamPolicyRequest--; |
+} |
+ |
+buildUnnamed129() { |
+ var o = new core.Map<core.String, core.Object>(); |
+ o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
+ return o; |
+} |
+ |
+checkUnnamed129(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')); |
+} |
+ |
+buildUnnamed130() { |
+ var o = new core.List<core.Map<core.String, core.Object>>(); |
+ o.add(buildUnnamed129()); |
+ o.add(buildUnnamed129()); |
+ return o; |
+} |
+ |
+checkUnnamed130(core.List<core.Map<core.String, core.Object>> o) { |
+ unittest.expect(o, unittest.hasLength(2)); |
+ checkUnnamed129(o[0]); |
+ checkUnnamed129(o[1]); |
+} |
+ |
+core.int buildCounterStatus = 0; |
+buildStatus() { |
+ var o = new api.Status(); |
+ buildCounterStatus++; |
+ if (buildCounterStatus < 3) { |
+ o.code = 42; |
+ o.details = buildUnnamed130(); |
+ o.message = "foo"; |
+ } |
+ buildCounterStatus--; |
+ return o; |
+} |
+ |
+checkStatus(api.Status o) { |
+ buildCounterStatus++; |
+ if (buildCounterStatus < 3) { |
+ unittest.expect(o.code, unittest.equals(42)); |
+ checkUnnamed130(o.details); |
+ unittest.expect(o.message, unittest.equals('foo')); |
+ } |
+ buildCounterStatus--; |
+} |
+ |
+buildUnnamed131() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed131(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; |
+buildTestIamPermissionsRequest() { |
+ var o = new api.TestIamPermissionsRequest(); |
+ buildCounterTestIamPermissionsRequest++; |
+ if (buildCounterTestIamPermissionsRequest < 3) { |
+ o.permissions = buildUnnamed131(); |
+ } |
+ buildCounterTestIamPermissionsRequest--; |
+ return o; |
+} |
+ |
+checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
+ buildCounterTestIamPermissionsRequest++; |
+ if (buildCounterTestIamPermissionsRequest < 3) { |
+ checkUnnamed131(o.permissions); |
+ } |
+ buildCounterTestIamPermissionsRequest--; |
+} |
+ |
+buildUnnamed132() { |
+ var o = new core.List<core.String>(); |
+ o.add("foo"); |
+ o.add("foo"); |
+ return o; |
+} |
+ |
+checkUnnamed132(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; |
+buildTestIamPermissionsResponse() { |
+ var o = new api.TestIamPermissionsResponse(); |
+ buildCounterTestIamPermissionsResponse++; |
+ if (buildCounterTestIamPermissionsResponse < 3) { |
+ o.permissions = buildUnnamed132(); |
+ } |
+ buildCounterTestIamPermissionsResponse--; |
+ return o; |
+} |
+ |
+checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
+ buildCounterTestIamPermissionsResponse++; |
+ if (buildCounterTestIamPermissionsResponse < 3) { |
+ checkUnnamed132(o.permissions); |
+ } |
+ buildCounterTestIamPermissionsResponse--; |
+} |
+ |
+core.int buildCounterUndeleteFolderRequest = 0; |
+buildUndeleteFolderRequest() { |
+ var o = new api.UndeleteFolderRequest(); |
+ buildCounterUndeleteFolderRequest++; |
+ if (buildCounterUndeleteFolderRequest < 3) { |
+ } |
+ buildCounterUndeleteFolderRequest--; |
+ return o; |
+} |
+ |
+checkUndeleteFolderRequest(api.UndeleteFolderRequest o) { |
+ buildCounterUndeleteFolderRequest++; |
+ if (buildCounterUndeleteFolderRequest < 3) { |
+ } |
+ buildCounterUndeleteFolderRequest--; |
+} |
+ |
+ |
+main() { |
+ unittest.group("obj-schema-AuditConfig", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildAuditConfig(); |
+ var od = new api.AuditConfig.fromJson(o.toJson()); |
+ checkAuditConfig(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-AuditLogConfig", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildAuditLogConfig(); |
+ var od = new api.AuditLogConfig.fromJson(o.toJson()); |
+ checkAuditLogConfig(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Binding", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildBinding(); |
+ var od = new api.Binding.fromJson(o.toJson()); |
+ checkBinding(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Folder", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildFolder(); |
+ var od = new api.Folder.fromJson(o.toJson()); |
+ checkFolder(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-FolderOperation", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildFolderOperation(); |
+ var od = new api.FolderOperation.fromJson(o.toJson()); |
+ checkFolderOperation(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-FolderOperationError", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildFolderOperationError(); |
+ var od = new api.FolderOperationError.fromJson(o.toJson()); |
+ checkFolderOperationError(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-GetIamPolicyRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildGetIamPolicyRequest(); |
+ var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); |
+ checkGetIamPolicyRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ListFoldersResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildListFoldersResponse(); |
+ var od = new api.ListFoldersResponse.fromJson(o.toJson()); |
+ checkListFoldersResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-MoveFolderRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildMoveFolderRequest(); |
+ var od = new api.MoveFolderRequest.fromJson(o.toJson()); |
+ checkMoveFolderRequest(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-Policy", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildPolicy(); |
+ var od = new api.Policy.fromJson(o.toJson()); |
+ checkPolicy(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-ProjectCreationStatus", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildProjectCreationStatus(); |
+ var od = new api.ProjectCreationStatus.fromJson(o.toJson()); |
+ checkProjectCreationStatus(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-SearchFoldersRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildSearchFoldersRequest(); |
+ var od = new api.SearchFoldersRequest.fromJson(o.toJson()); |
+ checkSearchFoldersRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-SearchFoldersResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildSearchFoldersResponse(); |
+ var od = new api.SearchFoldersResponse.fromJson(o.toJson()); |
+ checkSearchFoldersResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-SetIamPolicyRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildSetIamPolicyRequest(); |
+ var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
+ checkSetIamPolicyRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-Status", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildStatus(); |
+ var od = new api.Status.fromJson(o.toJson()); |
+ checkStatus(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-TestIamPermissionsRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildTestIamPermissionsRequest(); |
+ var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
+ checkTestIamPermissionsRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-TestIamPermissionsResponse", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildTestIamPermissionsResponse(); |
+ var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
+ checkTestIamPermissionsResponse(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("obj-schema-UndeleteFolderRequest", () { |
+ unittest.test("to-json--from-json", () { |
+ var o = buildUndeleteFolderRequest(); |
+ var od = new api.UndeleteFolderRequest.fromJson(o.toJson()); |
+ checkUndeleteFolderRequest(od); |
+ }); |
+ }); |
+ |
+ |
+ unittest.group("resource-FoldersResourceApi", () { |
+ unittest.test("method--create", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildFolder(); |
+ var arg_parent = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.Folder.fromJson(json); |
+ checkFolder(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.equals("v2beta1/folders")); |
+ pathOffset += 15; |
+ |
+ 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["parent"].first, unittest.equals(arg_parent)); |
+ |
+ |
+ 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.create(arg_request, parent: arg_parent).then(unittest.expectAsync1(((api.Operation response) { |
+ checkOperation(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--delete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_name = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildFolder()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.delete(arg_name).then(unittest.expectAsync1(((api.Folder response) { |
+ checkFolder(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--get", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_name = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildFolder()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.get(arg_name).then(unittest.expectAsync1(((api.Folder response) { |
+ checkFolder(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--getIamPolicy", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildGetIamPolicyRequest(); |
+ var arg_resource = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.GetIamPolicyRequest.fromJson(json); |
+ checkGetIamPolicyRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildPolicy()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((api.Policy response) { |
+ checkPolicy(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--list", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_showDeleted = true; |
+ var arg_pageToken = "foo"; |
+ var arg_pageSize = 42; |
+ var arg_parent = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.equals("v2beta1/folders")); |
+ pathOffset += 15; |
+ |
+ 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["showDeleted"].first, unittest.equals("$arg_showDeleted")); |
+ unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
+ unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equals(arg_pageSize)); |
+ unittest.expect(queryMap["parent"].first, unittest.equals(arg_parent)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildListFoldersResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.list(showDeleted: arg_showDeleted, pageToken: arg_pageToken, pageSize: arg_pageSize, parent: arg_parent).then(unittest.expectAsync1(((api.ListFoldersResponse response) { |
+ checkListFoldersResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--move", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildMoveFolderRequest(); |
+ var arg_name = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.MoveFolderRequest.fromJson(json); |
+ checkMoveFolderRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ 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.move(arg_request, arg_name).then(unittest.expectAsync1(((api.Operation response) { |
+ checkOperation(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--patch", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildFolder(); |
+ var arg_name = "foo"; |
+ var arg_updateMask = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.Folder.fromJson(json); |
+ checkFolder(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ unittest.expect(queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildFolder()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.patch(arg_request, arg_name, updateMask: arg_updateMask).then(unittest.expectAsync1(((api.Folder response) { |
+ checkFolder(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--search", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildSearchFoldersRequest(); |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.SearchFoldersRequest.fromJson(json); |
+ checkSearchFoldersRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 22), unittest.equals("v2beta1/folders:search")); |
+ pathOffset += 22; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildSearchFoldersResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.search(arg_request).then(unittest.expectAsync1(((api.SearchFoldersResponse response) { |
+ checkSearchFoldersResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--setIamPolicy", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildSetIamPolicyRequest(); |
+ var arg_resource = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.SetIamPolicyRequest.fromJson(json); |
+ checkSetIamPolicyRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildPolicy()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((api.Policy response) { |
+ checkPolicy(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--testIamPermissions", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildTestIamPermissionsRequest(); |
+ var arg_resource = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.TestIamPermissionsRequest.fromJson(json); |
+ checkTestIamPermissionsRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
+ checkTestIamPermissionsResponse(response); |
+ }))); |
+ }); |
+ |
+ unittest.test("method--undelete", () { |
+ |
+ var mock = new HttpServerMock(); |
+ api.FoldersResourceApi res = new api.CloudresourcemanagerApi(mock).folders; |
+ var arg_request = buildUndeleteFolderRequest(); |
+ var arg_name = "foo"; |
+ mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
+ var obj = new api.UndeleteFolderRequest.fromJson(json); |
+ checkUndeleteFolderRequest(obj); |
+ |
+ var path = (req.url).path; |
+ var pathOffset = 0; |
+ var index; |
+ var subPart; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
+ pathOffset += 1; |
+ unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equals("v2beta1/")); |
+ pathOffset += 8; |
+ // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
+ |
+ var query = (req.url).query; |
+ var queryOffset = 0; |
+ var queryMap = {}; |
+ addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
+ parseBool(n) { |
+ if (n == "true") return true; |
+ if (n == "false") return false; |
+ if (n == null) return null; |
+ throw new core.ArgumentError("Invalid boolean: $n"); |
+ } |
+ if (query.length > 0) { |
+ for (var part in query.split("&")) { |
+ var keyvalue = part.split("="); |
+ addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.decodeQueryComponent(keyvalue[1])); |
+ } |
+ } |
+ |
+ |
+ var h = { |
+ "content-type" : "application/json; charset=utf-8", |
+ }; |
+ var resp = convert.JSON.encode(buildFolder()); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
+ }), true); |
+ res.undelete(arg_request, arg_name).then(unittest.expectAsync1(((api.Folder response) { |
+ checkFolder(response); |
+ }))); |
+ }); |
+ |
+ }); |
+ |
+ |
+} |
+ |