| // ignore_for_file: camel_case_types |
| // ignore_for_file: cascade_invocations |
| // ignore_for_file: comment_references |
| // ignore_for_file: file_names |
| // ignore_for_file: library_names |
| // ignore_for_file: lines_longer_than_80_chars |
| // ignore_for_file: non_constant_identifier_names |
| // ignore_for_file: prefer_const_declarations |
| // ignore_for_file: prefer_expression_function_bodies |
| // ignore_for_file: prefer_final_locals |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unnecessary_cast |
| // ignore_for_file: unnecessary_lambdas |
| // ignore_for_file: unnecessary_parenthesis |
| // ignore_for_file: unnecessary_string_interpolations |
| // ignore_for_file: unused_local_variable |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:googleapis/pubsub/v1.dart' as api; |
| import 'package:http/http.dart' as http; |
| import 'package:test/test.dart' as unittest; |
| |
| import '../test_shared.dart'; |
| |
| core.List<core.String> buildUnnamed556() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed556(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 buildCounterAcknowledgeRequest = 0; |
| api.AcknowledgeRequest buildAcknowledgeRequest() { |
| final o = api.AcknowledgeRequest(); |
| buildCounterAcknowledgeRequest++; |
| if (buildCounterAcknowledgeRequest < 3) { |
| o.ackIds = buildUnnamed556(); |
| } |
| buildCounterAcknowledgeRequest--; |
| return o; |
| } |
| |
| void checkAcknowledgeRequest(api.AcknowledgeRequest o) { |
| buildCounterAcknowledgeRequest++; |
| if (buildCounterAcknowledgeRequest < 3) { |
| checkUnnamed556(o.ackIds!); |
| } |
| buildCounterAcknowledgeRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed557() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed557(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o[0], |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o[1], |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterBinding = 0; |
| api.Binding buildBinding() { |
| final o = api.Binding(); |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| o.condition = buildExpr(); |
| o.members = buildUnnamed557(); |
| o.role = 'foo'; |
| } |
| buildCounterBinding--; |
| return o; |
| } |
| |
| void checkBinding(api.Binding o) { |
| buildCounterBinding++; |
| if (buildCounterBinding < 3) { |
| checkExpr(o.condition!); |
| checkUnnamed557(o.members!); |
| unittest.expect( |
| o.role!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterBinding--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed558() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed558(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o['x']!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o['y']!, |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterCreateSnapshotRequest = 0; |
| api.CreateSnapshotRequest buildCreateSnapshotRequest() { |
| final o = api.CreateSnapshotRequest(); |
| buildCounterCreateSnapshotRequest++; |
| if (buildCounterCreateSnapshotRequest < 3) { |
| o.labels = buildUnnamed558(); |
| o.subscription = 'foo'; |
| } |
| buildCounterCreateSnapshotRequest--; |
| return o; |
| } |
| |
| void checkCreateSnapshotRequest(api.CreateSnapshotRequest o) { |
| buildCounterCreateSnapshotRequest++; |
| if (buildCounterCreateSnapshotRequest < 3) { |
| checkUnnamed558(o.labels!); |
| unittest.expect( |
| o.subscription!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterCreateSnapshotRequest--; |
| } |
| |
| core.int buildCounterDeadLetterPolicy = 0; |
| api.DeadLetterPolicy buildDeadLetterPolicy() { |
| final o = api.DeadLetterPolicy(); |
| buildCounterDeadLetterPolicy++; |
| if (buildCounterDeadLetterPolicy < 3) { |
| o.deadLetterTopic = 'foo'; |
| o.maxDeliveryAttempts = 42; |
| } |
| buildCounterDeadLetterPolicy--; |
| return o; |
| } |
| |
| void checkDeadLetterPolicy(api.DeadLetterPolicy o) { |
| buildCounterDeadLetterPolicy++; |
| if (buildCounterDeadLetterPolicy < 3) { |
| unittest.expect( |
| o.deadLetterTopic!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.maxDeliveryAttempts!, |
| unittest.equals(42), |
| ); |
| } |
| buildCounterDeadLetterPolicy--; |
| } |
| |
| core.int buildCounterDetachSubscriptionResponse = 0; |
| api.DetachSubscriptionResponse buildDetachSubscriptionResponse() { |
| final o = api.DetachSubscriptionResponse(); |
| buildCounterDetachSubscriptionResponse++; |
| if (buildCounterDetachSubscriptionResponse < 3) {} |
| buildCounterDetachSubscriptionResponse--; |
| return o; |
| } |
| |
| void checkDetachSubscriptionResponse(api.DetachSubscriptionResponse o) { |
| buildCounterDetachSubscriptionResponse++; |
| if (buildCounterDetachSubscriptionResponse < 3) {} |
| buildCounterDetachSubscriptionResponse--; |
| } |
| |
| core.int buildCounterEmpty = 0; |
| api.Empty buildEmpty() { |
| final o = api.Empty(); |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| return o; |
| } |
| |
| void checkEmpty(api.Empty o) { |
| buildCounterEmpty++; |
| if (buildCounterEmpty < 3) {} |
| buildCounterEmpty--; |
| } |
| |
| core.int buildCounterExpirationPolicy = 0; |
| api.ExpirationPolicy buildExpirationPolicy() { |
| final o = api.ExpirationPolicy(); |
| buildCounterExpirationPolicy++; |
| if (buildCounterExpirationPolicy < 3) { |
| o.ttl = 'foo'; |
| } |
| buildCounterExpirationPolicy--; |
| return o; |
| } |
| |
| void checkExpirationPolicy(api.ExpirationPolicy o) { |
| buildCounterExpirationPolicy++; |
| if (buildCounterExpirationPolicy < 3) { |
| unittest.expect( |
| o.ttl!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterExpirationPolicy--; |
| } |
| |
| core.int buildCounterExpr = 0; |
| api.Expr buildExpr() { |
| final o = api.Expr(); |
| buildCounterExpr++; |
| if (buildCounterExpr < 3) { |
| o.description = 'foo'; |
| o.expression = 'foo'; |
| o.location = 'foo'; |
| o.title = 'foo'; |
| } |
| buildCounterExpr--; |
| return o; |
| } |
| |
| void checkExpr(api.Expr o) { |
| buildCounterExpr++; |
| if (buildCounterExpr < 3) { |
| unittest.expect( |
| o.description!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.expression!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.location!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.title!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterExpr--; |
| } |
| |
| core.List<api.Schema> buildUnnamed559() => [ |
| buildSchema(), |
| buildSchema(), |
| ]; |
| |
| void checkUnnamed559(core.List<api.Schema> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkSchema(o[0]); |
| checkSchema(o[1]); |
| } |
| |
| core.int buildCounterListSchemasResponse = 0; |
| api.ListSchemasResponse buildListSchemasResponse() { |
| final o = api.ListSchemasResponse(); |
| buildCounterListSchemasResponse++; |
| if (buildCounterListSchemasResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.schemas = buildUnnamed559(); |
| } |
| buildCounterListSchemasResponse--; |
| return o; |
| } |
| |
| void checkListSchemasResponse(api.ListSchemasResponse o) { |
| buildCounterListSchemasResponse++; |
| if (buildCounterListSchemasResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed559(o.schemas!); |
| } |
| buildCounterListSchemasResponse--; |
| } |
| |
| core.List<api.Snapshot> buildUnnamed560() => [ |
| buildSnapshot(), |
| buildSnapshot(), |
| ]; |
| |
| void checkUnnamed560(core.List<api.Snapshot> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkSnapshot(o[0]); |
| checkSnapshot(o[1]); |
| } |
| |
| core.int buildCounterListSnapshotsResponse = 0; |
| api.ListSnapshotsResponse buildListSnapshotsResponse() { |
| final o = api.ListSnapshotsResponse(); |
| buildCounterListSnapshotsResponse++; |
| if (buildCounterListSnapshotsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.snapshots = buildUnnamed560(); |
| } |
| buildCounterListSnapshotsResponse--; |
| return o; |
| } |
| |
| void checkListSnapshotsResponse(api.ListSnapshotsResponse o) { |
| buildCounterListSnapshotsResponse++; |
| if (buildCounterListSnapshotsResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed560(o.snapshots!); |
| } |
| buildCounterListSnapshotsResponse--; |
| } |
| |
| core.List<api.Subscription> buildUnnamed561() => [ |
| buildSubscription(), |
| buildSubscription(), |
| ]; |
| |
| void checkUnnamed561(core.List<api.Subscription> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkSubscription(o[0]); |
| checkSubscription(o[1]); |
| } |
| |
| core.int buildCounterListSubscriptionsResponse = 0; |
| api.ListSubscriptionsResponse buildListSubscriptionsResponse() { |
| final o = api.ListSubscriptionsResponse(); |
| buildCounterListSubscriptionsResponse++; |
| if (buildCounterListSubscriptionsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.subscriptions = buildUnnamed561(); |
| } |
| buildCounterListSubscriptionsResponse--; |
| return o; |
| } |
| |
| void checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { |
| buildCounterListSubscriptionsResponse++; |
| if (buildCounterListSubscriptionsResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed561(o.subscriptions!); |
| } |
| buildCounterListSubscriptionsResponse--; |
| } |
| |
| core.List<core.String> buildUnnamed562() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed562(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 buildCounterListTopicSnapshotsResponse = 0; |
| api.ListTopicSnapshotsResponse buildListTopicSnapshotsResponse() { |
| final o = api.ListTopicSnapshotsResponse(); |
| buildCounterListTopicSnapshotsResponse++; |
| if (buildCounterListTopicSnapshotsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.snapshots = buildUnnamed562(); |
| } |
| buildCounterListTopicSnapshotsResponse--; |
| return o; |
| } |
| |
| void checkListTopicSnapshotsResponse(api.ListTopicSnapshotsResponse o) { |
| buildCounterListTopicSnapshotsResponse++; |
| if (buildCounterListTopicSnapshotsResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed562(o.snapshots!); |
| } |
| buildCounterListTopicSnapshotsResponse--; |
| } |
| |
| core.List<core.String> buildUnnamed563() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed563(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 buildCounterListTopicSubscriptionsResponse = 0; |
| api.ListTopicSubscriptionsResponse buildListTopicSubscriptionsResponse() { |
| final o = api.ListTopicSubscriptionsResponse(); |
| buildCounterListTopicSubscriptionsResponse++; |
| if (buildCounterListTopicSubscriptionsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.subscriptions = buildUnnamed563(); |
| } |
| buildCounterListTopicSubscriptionsResponse--; |
| return o; |
| } |
| |
| void checkListTopicSubscriptionsResponse(api.ListTopicSubscriptionsResponse o) { |
| buildCounterListTopicSubscriptionsResponse++; |
| if (buildCounterListTopicSubscriptionsResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed563(o.subscriptions!); |
| } |
| buildCounterListTopicSubscriptionsResponse--; |
| } |
| |
| core.List<api.Topic> buildUnnamed564() => [ |
| buildTopic(), |
| buildTopic(), |
| ]; |
| |
| void checkUnnamed564(core.List<api.Topic> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkTopic(o[0]); |
| checkTopic(o[1]); |
| } |
| |
| core.int buildCounterListTopicsResponse = 0; |
| api.ListTopicsResponse buildListTopicsResponse() { |
| final o = api.ListTopicsResponse(); |
| buildCounterListTopicsResponse++; |
| if (buildCounterListTopicsResponse < 3) { |
| o.nextPageToken = 'foo'; |
| o.topics = buildUnnamed564(); |
| } |
| buildCounterListTopicsResponse--; |
| return o; |
| } |
| |
| void checkListTopicsResponse(api.ListTopicsResponse o) { |
| buildCounterListTopicsResponse++; |
| if (buildCounterListTopicsResponse < 3) { |
| unittest.expect( |
| o.nextPageToken!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed564(o.topics!); |
| } |
| buildCounterListTopicsResponse--; |
| } |
| |
| core.List<core.String> buildUnnamed565() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed565(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 buildCounterMessageStoragePolicy = 0; |
| api.MessageStoragePolicy buildMessageStoragePolicy() { |
| final o = api.MessageStoragePolicy(); |
| buildCounterMessageStoragePolicy++; |
| if (buildCounterMessageStoragePolicy < 3) { |
| o.allowedPersistenceRegions = buildUnnamed565(); |
| } |
| buildCounterMessageStoragePolicy--; |
| return o; |
| } |
| |
| void checkMessageStoragePolicy(api.MessageStoragePolicy o) { |
| buildCounterMessageStoragePolicy++; |
| if (buildCounterMessageStoragePolicy < 3) { |
| checkUnnamed565(o.allowedPersistenceRegions!); |
| } |
| buildCounterMessageStoragePolicy--; |
| } |
| |
| core.List<core.String> buildUnnamed566() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed566(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 buildCounterModifyAckDeadlineRequest = 0; |
| api.ModifyAckDeadlineRequest buildModifyAckDeadlineRequest() { |
| final o = api.ModifyAckDeadlineRequest(); |
| buildCounterModifyAckDeadlineRequest++; |
| if (buildCounterModifyAckDeadlineRequest < 3) { |
| o.ackDeadlineSeconds = 42; |
| o.ackIds = buildUnnamed566(); |
| } |
| buildCounterModifyAckDeadlineRequest--; |
| return o; |
| } |
| |
| void checkModifyAckDeadlineRequest(api.ModifyAckDeadlineRequest o) { |
| buildCounterModifyAckDeadlineRequest++; |
| if (buildCounterModifyAckDeadlineRequest < 3) { |
| unittest.expect( |
| o.ackDeadlineSeconds!, |
| unittest.equals(42), |
| ); |
| checkUnnamed566(o.ackIds!); |
| } |
| buildCounterModifyAckDeadlineRequest--; |
| } |
| |
| core.int buildCounterModifyPushConfigRequest = 0; |
| api.ModifyPushConfigRequest buildModifyPushConfigRequest() { |
| final o = api.ModifyPushConfigRequest(); |
| buildCounterModifyPushConfigRequest++; |
| if (buildCounterModifyPushConfigRequest < 3) { |
| o.pushConfig = buildPushConfig(); |
| } |
| buildCounterModifyPushConfigRequest--; |
| return o; |
| } |
| |
| void checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { |
| buildCounterModifyPushConfigRequest++; |
| if (buildCounterModifyPushConfigRequest < 3) { |
| checkPushConfig(o.pushConfig!); |
| } |
| buildCounterModifyPushConfigRequest--; |
| } |
| |
| core.int buildCounterOidcToken = 0; |
| api.OidcToken buildOidcToken() { |
| final o = api.OidcToken(); |
| buildCounterOidcToken++; |
| if (buildCounterOidcToken < 3) { |
| o.audience = 'foo'; |
| o.serviceAccountEmail = 'foo'; |
| } |
| buildCounterOidcToken--; |
| return o; |
| } |
| |
| void checkOidcToken(api.OidcToken o) { |
| buildCounterOidcToken++; |
| if (buildCounterOidcToken < 3) { |
| unittest.expect( |
| o.audience!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.serviceAccountEmail!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterOidcToken--; |
| } |
| |
| core.List<api.Binding> buildUnnamed567() => [ |
| buildBinding(), |
| buildBinding(), |
| ]; |
| |
| void checkUnnamed567(core.List<api.Binding> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkBinding(o[0]); |
| checkBinding(o[1]); |
| } |
| |
| core.int buildCounterPolicy = 0; |
| api.Policy buildPolicy() { |
| final o = api.Policy(); |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| o.bindings = buildUnnamed567(); |
| o.etag = 'foo'; |
| o.version = 42; |
| } |
| buildCounterPolicy--; |
| return o; |
| } |
| |
| void checkPolicy(api.Policy o) { |
| buildCounterPolicy++; |
| if (buildCounterPolicy < 3) { |
| checkUnnamed567(o.bindings!); |
| unittest.expect( |
| o.etag!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.version!, |
| unittest.equals(42), |
| ); |
| } |
| buildCounterPolicy--; |
| } |
| |
| core.List<api.PubsubMessage> buildUnnamed568() => [ |
| buildPubsubMessage(), |
| buildPubsubMessage(), |
| ]; |
| |
| void checkUnnamed568(core.List<api.PubsubMessage> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkPubsubMessage(o[0]); |
| checkPubsubMessage(o[1]); |
| } |
| |
| core.int buildCounterPublishRequest = 0; |
| api.PublishRequest buildPublishRequest() { |
| final o = api.PublishRequest(); |
| buildCounterPublishRequest++; |
| if (buildCounterPublishRequest < 3) { |
| o.messages = buildUnnamed568(); |
| } |
| buildCounterPublishRequest--; |
| return o; |
| } |
| |
| void checkPublishRequest(api.PublishRequest o) { |
| buildCounterPublishRequest++; |
| if (buildCounterPublishRequest < 3) { |
| checkUnnamed568(o.messages!); |
| } |
| buildCounterPublishRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed569() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed569(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 buildCounterPublishResponse = 0; |
| api.PublishResponse buildPublishResponse() { |
| final o = api.PublishResponse(); |
| buildCounterPublishResponse++; |
| if (buildCounterPublishResponse < 3) { |
| o.messageIds = buildUnnamed569(); |
| } |
| buildCounterPublishResponse--; |
| return o; |
| } |
| |
| void checkPublishResponse(api.PublishResponse o) { |
| buildCounterPublishResponse++; |
| if (buildCounterPublishResponse < 3) { |
| checkUnnamed569(o.messageIds!); |
| } |
| buildCounterPublishResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed570() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed570(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o['x']!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o['y']!, |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterPubsubMessage = 0; |
| api.PubsubMessage buildPubsubMessage() { |
| final o = api.PubsubMessage(); |
| buildCounterPubsubMessage++; |
| if (buildCounterPubsubMessage < 3) { |
| o.attributes = buildUnnamed570(); |
| o.data = 'foo'; |
| o.messageId = 'foo'; |
| o.orderingKey = 'foo'; |
| o.publishTime = 'foo'; |
| } |
| buildCounterPubsubMessage--; |
| return o; |
| } |
| |
| void checkPubsubMessage(api.PubsubMessage o) { |
| buildCounterPubsubMessage++; |
| if (buildCounterPubsubMessage < 3) { |
| checkUnnamed570(o.attributes!); |
| unittest.expect( |
| o.data!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.messageId!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.orderingKey!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.publishTime!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterPubsubMessage--; |
| } |
| |
| core.int buildCounterPullRequest = 0; |
| api.PullRequest buildPullRequest() { |
| final o = api.PullRequest(); |
| buildCounterPullRequest++; |
| if (buildCounterPullRequest < 3) { |
| o.maxMessages = 42; |
| o.returnImmediately = true; |
| } |
| buildCounterPullRequest--; |
| return o; |
| } |
| |
| void checkPullRequest(api.PullRequest o) { |
| buildCounterPullRequest++; |
| if (buildCounterPullRequest < 3) { |
| unittest.expect( |
| o.maxMessages!, |
| unittest.equals(42), |
| ); |
| unittest.expect(o.returnImmediately!, unittest.isTrue); |
| } |
| buildCounterPullRequest--; |
| } |
| |
| core.List<api.ReceivedMessage> buildUnnamed571() => [ |
| buildReceivedMessage(), |
| buildReceivedMessage(), |
| ]; |
| |
| void checkUnnamed571(core.List<api.ReceivedMessage> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| checkReceivedMessage(o[0]); |
| checkReceivedMessage(o[1]); |
| } |
| |
| core.int buildCounterPullResponse = 0; |
| api.PullResponse buildPullResponse() { |
| final o = api.PullResponse(); |
| buildCounterPullResponse++; |
| if (buildCounterPullResponse < 3) { |
| o.receivedMessages = buildUnnamed571(); |
| } |
| buildCounterPullResponse--; |
| return o; |
| } |
| |
| void checkPullResponse(api.PullResponse o) { |
| buildCounterPullResponse++; |
| if (buildCounterPullResponse < 3) { |
| checkUnnamed571(o.receivedMessages!); |
| } |
| buildCounterPullResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed572() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed572(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o['x']!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o['y']!, |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterPushConfig = 0; |
| api.PushConfig buildPushConfig() { |
| final o = api.PushConfig(); |
| buildCounterPushConfig++; |
| if (buildCounterPushConfig < 3) { |
| o.attributes = buildUnnamed572(); |
| o.oidcToken = buildOidcToken(); |
| o.pushEndpoint = 'foo'; |
| } |
| buildCounterPushConfig--; |
| return o; |
| } |
| |
| void checkPushConfig(api.PushConfig o) { |
| buildCounterPushConfig++; |
| if (buildCounterPushConfig < 3) { |
| checkUnnamed572(o.attributes!); |
| checkOidcToken(o.oidcToken!); |
| unittest.expect( |
| o.pushEndpoint!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterPushConfig--; |
| } |
| |
| core.int buildCounterReceivedMessage = 0; |
| api.ReceivedMessage buildReceivedMessage() { |
| final o = api.ReceivedMessage(); |
| buildCounterReceivedMessage++; |
| if (buildCounterReceivedMessage < 3) { |
| o.ackId = 'foo'; |
| o.deliveryAttempt = 42; |
| o.message = buildPubsubMessage(); |
| } |
| buildCounterReceivedMessage--; |
| return o; |
| } |
| |
| void checkReceivedMessage(api.ReceivedMessage o) { |
| buildCounterReceivedMessage++; |
| if (buildCounterReceivedMessage < 3) { |
| unittest.expect( |
| o.ackId!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.deliveryAttempt!, |
| unittest.equals(42), |
| ); |
| checkPubsubMessage(o.message!); |
| } |
| buildCounterReceivedMessage--; |
| } |
| |
| core.int buildCounterRetryPolicy = 0; |
| api.RetryPolicy buildRetryPolicy() { |
| final o = api.RetryPolicy(); |
| buildCounterRetryPolicy++; |
| if (buildCounterRetryPolicy < 3) { |
| o.maximumBackoff = 'foo'; |
| o.minimumBackoff = 'foo'; |
| } |
| buildCounterRetryPolicy--; |
| return o; |
| } |
| |
| void checkRetryPolicy(api.RetryPolicy o) { |
| buildCounterRetryPolicy++; |
| if (buildCounterRetryPolicy < 3) { |
| unittest.expect( |
| o.maximumBackoff!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.minimumBackoff!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterRetryPolicy--; |
| } |
| |
| core.int buildCounterSchema = 0; |
| api.Schema buildSchema() { |
| final o = api.Schema(); |
| buildCounterSchema++; |
| if (buildCounterSchema < 3) { |
| o.definition = 'foo'; |
| o.name = 'foo'; |
| o.type = 'foo'; |
| } |
| buildCounterSchema--; |
| return o; |
| } |
| |
| void checkSchema(api.Schema o) { |
| buildCounterSchema++; |
| if (buildCounterSchema < 3) { |
| unittest.expect( |
| o.definition!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.type!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterSchema--; |
| } |
| |
| core.int buildCounterSchemaSettings = 0; |
| api.SchemaSettings buildSchemaSettings() { |
| final o = api.SchemaSettings(); |
| buildCounterSchemaSettings++; |
| if (buildCounterSchemaSettings < 3) { |
| o.encoding = 'foo'; |
| o.schema = 'foo'; |
| } |
| buildCounterSchemaSettings--; |
| return o; |
| } |
| |
| void checkSchemaSettings(api.SchemaSettings o) { |
| buildCounterSchemaSettings++; |
| if (buildCounterSchemaSettings < 3) { |
| unittest.expect( |
| o.encoding!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.schema!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterSchemaSettings--; |
| } |
| |
| core.int buildCounterSeekRequest = 0; |
| api.SeekRequest buildSeekRequest() { |
| final o = api.SeekRequest(); |
| buildCounterSeekRequest++; |
| if (buildCounterSeekRequest < 3) { |
| o.snapshot = 'foo'; |
| o.time = 'foo'; |
| } |
| buildCounterSeekRequest--; |
| return o; |
| } |
| |
| void checkSeekRequest(api.SeekRequest o) { |
| buildCounterSeekRequest++; |
| if (buildCounterSeekRequest < 3) { |
| unittest.expect( |
| o.snapshot!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.time!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterSeekRequest--; |
| } |
| |
| core.int buildCounterSeekResponse = 0; |
| api.SeekResponse buildSeekResponse() { |
| final o = api.SeekResponse(); |
| buildCounterSeekResponse++; |
| if (buildCounterSeekResponse < 3) {} |
| buildCounterSeekResponse--; |
| return o; |
| } |
| |
| void checkSeekResponse(api.SeekResponse o) { |
| buildCounterSeekResponse++; |
| if (buildCounterSeekResponse < 3) {} |
| buildCounterSeekResponse--; |
| } |
| |
| core.int buildCounterSetIamPolicyRequest = 0; |
| api.SetIamPolicyRequest buildSetIamPolicyRequest() { |
| final o = api.SetIamPolicyRequest(); |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| o.policy = buildPolicy(); |
| } |
| buildCounterSetIamPolicyRequest--; |
| return o; |
| } |
| |
| void checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
| buildCounterSetIamPolicyRequest++; |
| if (buildCounterSetIamPolicyRequest < 3) { |
| checkPolicy(o.policy!); |
| } |
| buildCounterSetIamPolicyRequest--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed573() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed573(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o['x']!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o['y']!, |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterSnapshot = 0; |
| api.Snapshot buildSnapshot() { |
| final o = api.Snapshot(); |
| buildCounterSnapshot++; |
| if (buildCounterSnapshot < 3) { |
| o.expireTime = 'foo'; |
| o.labels = buildUnnamed573(); |
| o.name = 'foo'; |
| o.topic = 'foo'; |
| } |
| buildCounterSnapshot--; |
| return o; |
| } |
| |
| void checkSnapshot(api.Snapshot o) { |
| buildCounterSnapshot++; |
| if (buildCounterSnapshot < 3) { |
| unittest.expect( |
| o.expireTime!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed573(o.labels!); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.topic!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterSnapshot--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed574() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed574(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o['x']!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o['y']!, |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterSubscription = 0; |
| api.Subscription buildSubscription() { |
| final o = api.Subscription(); |
| buildCounterSubscription++; |
| if (buildCounterSubscription < 3) { |
| o.ackDeadlineSeconds = 42; |
| o.deadLetterPolicy = buildDeadLetterPolicy(); |
| o.detached = true; |
| o.enableMessageOrdering = true; |
| o.expirationPolicy = buildExpirationPolicy(); |
| o.filter = 'foo'; |
| o.labels = buildUnnamed574(); |
| o.messageRetentionDuration = 'foo'; |
| o.name = 'foo'; |
| o.pushConfig = buildPushConfig(); |
| o.retainAckedMessages = true; |
| o.retryPolicy = buildRetryPolicy(); |
| o.topic = 'foo'; |
| o.topicMessageRetentionDuration = 'foo'; |
| } |
| buildCounterSubscription--; |
| return o; |
| } |
| |
| void checkSubscription(api.Subscription o) { |
| buildCounterSubscription++; |
| if (buildCounterSubscription < 3) { |
| unittest.expect( |
| o.ackDeadlineSeconds!, |
| unittest.equals(42), |
| ); |
| checkDeadLetterPolicy(o.deadLetterPolicy!); |
| unittest.expect(o.detached!, unittest.isTrue); |
| unittest.expect(o.enableMessageOrdering!, unittest.isTrue); |
| checkExpirationPolicy(o.expirationPolicy!); |
| unittest.expect( |
| o.filter!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed574(o.labels!); |
| unittest.expect( |
| o.messageRetentionDuration!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| checkPushConfig(o.pushConfig!); |
| unittest.expect(o.retainAckedMessages!, unittest.isTrue); |
| checkRetryPolicy(o.retryPolicy!); |
| unittest.expect( |
| o.topic!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.topicMessageRetentionDuration!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterSubscription--; |
| } |
| |
| core.List<core.String> buildUnnamed575() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed575(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o[0], |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o[1], |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterTestIamPermissionsRequest = 0; |
| api.TestIamPermissionsRequest buildTestIamPermissionsRequest() { |
| final o = api.TestIamPermissionsRequest(); |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| o.permissions = buildUnnamed575(); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
| buildCounterTestIamPermissionsRequest++; |
| if (buildCounterTestIamPermissionsRequest < 3) { |
| checkUnnamed575(o.permissions!); |
| } |
| buildCounterTestIamPermissionsRequest--; |
| } |
| |
| core.List<core.String> buildUnnamed576() => [ |
| 'foo', |
| 'foo', |
| ]; |
| |
| void checkUnnamed576(core.List<core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o[0], |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o[1], |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterTestIamPermissionsResponse = 0; |
| api.TestIamPermissionsResponse buildTestIamPermissionsResponse() { |
| final o = api.TestIamPermissionsResponse(); |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| o.permissions = buildUnnamed576(); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| return o; |
| } |
| |
| void checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
| buildCounterTestIamPermissionsResponse++; |
| if (buildCounterTestIamPermissionsResponse < 3) { |
| checkUnnamed576(o.permissions!); |
| } |
| buildCounterTestIamPermissionsResponse--; |
| } |
| |
| core.Map<core.String, core.String> buildUnnamed577() => { |
| 'x': 'foo', |
| 'y': 'foo', |
| }; |
| |
| void checkUnnamed577(core.Map<core.String, core.String> o) { |
| unittest.expect(o, unittest.hasLength(2)); |
| unittest.expect( |
| o['x']!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o['y']!, |
| unittest.equals('foo'), |
| ); |
| } |
| |
| core.int buildCounterTopic = 0; |
| api.Topic buildTopic() { |
| final o = api.Topic(); |
| buildCounterTopic++; |
| if (buildCounterTopic < 3) { |
| o.kmsKeyName = 'foo'; |
| o.labels = buildUnnamed577(); |
| o.messageRetentionDuration = 'foo'; |
| o.messageStoragePolicy = buildMessageStoragePolicy(); |
| o.name = 'foo'; |
| o.satisfiesPzs = true; |
| o.schemaSettings = buildSchemaSettings(); |
| } |
| buildCounterTopic--; |
| return o; |
| } |
| |
| void checkTopic(api.Topic o) { |
| buildCounterTopic++; |
| if (buildCounterTopic < 3) { |
| unittest.expect( |
| o.kmsKeyName!, |
| unittest.equals('foo'), |
| ); |
| checkUnnamed577(o.labels!); |
| unittest.expect( |
| o.messageRetentionDuration!, |
| unittest.equals('foo'), |
| ); |
| checkMessageStoragePolicy(o.messageStoragePolicy!); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect(o.satisfiesPzs!, unittest.isTrue); |
| checkSchemaSettings(o.schemaSettings!); |
| } |
| buildCounterTopic--; |
| } |
| |
| core.int buildCounterUpdateSnapshotRequest = 0; |
| api.UpdateSnapshotRequest buildUpdateSnapshotRequest() { |
| final o = api.UpdateSnapshotRequest(); |
| buildCounterUpdateSnapshotRequest++; |
| if (buildCounterUpdateSnapshotRequest < 3) { |
| o.snapshot = buildSnapshot(); |
| o.updateMask = 'foo'; |
| } |
| buildCounterUpdateSnapshotRequest--; |
| return o; |
| } |
| |
| void checkUpdateSnapshotRequest(api.UpdateSnapshotRequest o) { |
| buildCounterUpdateSnapshotRequest++; |
| if (buildCounterUpdateSnapshotRequest < 3) { |
| checkSnapshot(o.snapshot!); |
| unittest.expect( |
| o.updateMask!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterUpdateSnapshotRequest--; |
| } |
| |
| core.int buildCounterUpdateSubscriptionRequest = 0; |
| api.UpdateSubscriptionRequest buildUpdateSubscriptionRequest() { |
| final o = api.UpdateSubscriptionRequest(); |
| buildCounterUpdateSubscriptionRequest++; |
| if (buildCounterUpdateSubscriptionRequest < 3) { |
| o.subscription = buildSubscription(); |
| o.updateMask = 'foo'; |
| } |
| buildCounterUpdateSubscriptionRequest--; |
| return o; |
| } |
| |
| void checkUpdateSubscriptionRequest(api.UpdateSubscriptionRequest o) { |
| buildCounterUpdateSubscriptionRequest++; |
| if (buildCounterUpdateSubscriptionRequest < 3) { |
| checkSubscription(o.subscription!); |
| unittest.expect( |
| o.updateMask!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterUpdateSubscriptionRequest--; |
| } |
| |
| core.int buildCounterUpdateTopicRequest = 0; |
| api.UpdateTopicRequest buildUpdateTopicRequest() { |
| final o = api.UpdateTopicRequest(); |
| buildCounterUpdateTopicRequest++; |
| if (buildCounterUpdateTopicRequest < 3) { |
| o.topic = buildTopic(); |
| o.updateMask = 'foo'; |
| } |
| buildCounterUpdateTopicRequest--; |
| return o; |
| } |
| |
| void checkUpdateTopicRequest(api.UpdateTopicRequest o) { |
| buildCounterUpdateTopicRequest++; |
| if (buildCounterUpdateTopicRequest < 3) { |
| checkTopic(o.topic!); |
| unittest.expect( |
| o.updateMask!, |
| unittest.equals('foo'), |
| ); |
| } |
| buildCounterUpdateTopicRequest--; |
| } |
| |
| core.int buildCounterValidateMessageRequest = 0; |
| api.ValidateMessageRequest buildValidateMessageRequest() { |
| final o = api.ValidateMessageRequest(); |
| buildCounterValidateMessageRequest++; |
| if (buildCounterValidateMessageRequest < 3) { |
| o.encoding = 'foo'; |
| o.message = 'foo'; |
| o.name = 'foo'; |
| o.schema = buildSchema(); |
| } |
| buildCounterValidateMessageRequest--; |
| return o; |
| } |
| |
| void checkValidateMessageRequest(api.ValidateMessageRequest o) { |
| buildCounterValidateMessageRequest++; |
| if (buildCounterValidateMessageRequest < 3) { |
| unittest.expect( |
| o.encoding!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.message!, |
| unittest.equals('foo'), |
| ); |
| unittest.expect( |
| o.name!, |
| unittest.equals('foo'), |
| ); |
| checkSchema(o.schema!); |
| } |
| buildCounterValidateMessageRequest--; |
| } |
| |
| core.int buildCounterValidateMessageResponse = 0; |
| api.ValidateMessageResponse buildValidateMessageResponse() { |
| final o = api.ValidateMessageResponse(); |
| buildCounterValidateMessageResponse++; |
| if (buildCounterValidateMessageResponse < 3) {} |
| buildCounterValidateMessageResponse--; |
| return o; |
| } |
| |
| void checkValidateMessageResponse(api.ValidateMessageResponse o) { |
| buildCounterValidateMessageResponse++; |
| if (buildCounterValidateMessageResponse < 3) {} |
| buildCounterValidateMessageResponse--; |
| } |
| |
| core.int buildCounterValidateSchemaRequest = 0; |
| api.ValidateSchemaRequest buildValidateSchemaRequest() { |
| final o = api.ValidateSchemaRequest(); |
| buildCounterValidateSchemaRequest++; |
| if (buildCounterValidateSchemaRequest < 3) { |
| o.schema = buildSchema(); |
| } |
| buildCounterValidateSchemaRequest--; |
| return o; |
| } |
| |
| void checkValidateSchemaRequest(api.ValidateSchemaRequest o) { |
| buildCounterValidateSchemaRequest++; |
| if (buildCounterValidateSchemaRequest < 3) { |
| checkSchema(o.schema!); |
| } |
| buildCounterValidateSchemaRequest--; |
| } |
| |
| core.int buildCounterValidateSchemaResponse = 0; |
| api.ValidateSchemaResponse buildValidateSchemaResponse() { |
| final o = api.ValidateSchemaResponse(); |
| buildCounterValidateSchemaResponse++; |
| if (buildCounterValidateSchemaResponse < 3) {} |
| buildCounterValidateSchemaResponse--; |
| return o; |
| } |
| |
| void checkValidateSchemaResponse(api.ValidateSchemaResponse o) { |
| buildCounterValidateSchemaResponse++; |
| if (buildCounterValidateSchemaResponse < 3) {} |
| buildCounterValidateSchemaResponse--; |
| } |
| |
| void main() { |
| unittest.group('obj-schema-AcknowledgeRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildAcknowledgeRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.AcknowledgeRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkAcknowledgeRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Binding', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildBinding(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Binding.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkBinding(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-CreateSnapshotRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildCreateSnapshotRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.CreateSnapshotRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkCreateSnapshotRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-DeadLetterPolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildDeadLetterPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.DeadLetterPolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkDeadLetterPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-DetachSubscriptionResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildDetachSubscriptionResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.DetachSubscriptionResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkDetachSubscriptionResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Empty', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildEmpty(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Empty.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkEmpty(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ExpirationPolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildExpirationPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ExpirationPolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkExpirationPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Expr', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildExpr(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Expr.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkExpr(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListSchemasResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListSchemasResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListSchemasResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListSchemasResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListSnapshotsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListSnapshotsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListSnapshotsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListSnapshotsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListSubscriptionsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListSubscriptionsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListSubscriptionsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListSubscriptionsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListTopicSnapshotsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListTopicSnapshotsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListTopicSnapshotsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListTopicSnapshotsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListTopicSubscriptionsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListTopicSubscriptionsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListTopicSubscriptionsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListTopicSubscriptionsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ListTopicsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildListTopicsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ListTopicsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkListTopicsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-MessageStoragePolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildMessageStoragePolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.MessageStoragePolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkMessageStoragePolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ModifyAckDeadlineRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildModifyAckDeadlineRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ModifyAckDeadlineRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkModifyAckDeadlineRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ModifyPushConfigRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildModifyPushConfigRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ModifyPushConfigRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkModifyPushConfigRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-OidcToken', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildOidcToken(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.OidcToken.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkOidcToken(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Policy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Policy.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PublishRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPublishRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.PublishRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPublishRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PublishResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPublishResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.PublishResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPublishResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PubsubMessage', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPubsubMessage(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.PubsubMessage.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPubsubMessage(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PullRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPullRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.PullRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPullRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PullResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPullResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.PullResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkPullResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-PushConfig', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildPushConfig(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.PushConfig.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkPushConfig(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ReceivedMessage', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildReceivedMessage(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ReceivedMessage.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkReceivedMessage(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-RetryPolicy', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildRetryPolicy(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.RetryPolicy.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkRetryPolicy(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Schema', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSchema(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Schema.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkSchema(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SchemaSettings', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSchemaSettings(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SchemaSettings.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkSchemaSettings(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SeekRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSeekRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SeekRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkSeekRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SeekResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSeekResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SeekResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkSeekResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-SetIamPolicyRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSetIamPolicyRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.SetIamPolicyRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkSetIamPolicyRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Snapshot', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSnapshot(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Snapshot.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkSnapshot(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Subscription', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildSubscription(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.Subscription.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkSubscription(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildTestIamPermissionsRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.TestIamPermissionsRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-TestIamPermissionsResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildTestIamPermissionsResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.TestIamPermissionsResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-Topic', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildTopic(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = |
| api.Topic.fromJson(oJson as core.Map<core.String, core.dynamic>); |
| checkTopic(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-UpdateSnapshotRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildUpdateSnapshotRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.UpdateSnapshotRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkUpdateSnapshotRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-UpdateSubscriptionRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildUpdateSubscriptionRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.UpdateSubscriptionRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkUpdateSubscriptionRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-UpdateTopicRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildUpdateTopicRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.UpdateTopicRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkUpdateTopicRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ValidateMessageRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildValidateMessageRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ValidateMessageRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkValidateMessageRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ValidateMessageResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildValidateMessageResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ValidateMessageResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkValidateMessageResponse(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ValidateSchemaRequest', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildValidateSchemaRequest(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ValidateSchemaRequest.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkValidateSchemaRequest(od); |
| }); |
| }); |
| |
| unittest.group('obj-schema-ValidateSchemaResponse', () { |
| unittest.test('to-json--from-json', () async { |
| final o = buildValidateSchemaResponse(); |
| final oJson = convert.jsonDecode(convert.jsonEncode(o)); |
| final od = api.ValidateSchemaResponse.fromJson( |
| oJson as core.Map<core.String, core.dynamic>); |
| checkValidateSchemaResponse(od); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsSchemasResource', () { |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_request = buildSchema(); |
| final arg_parent = 'foo'; |
| final arg_schemaId = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = |
| api.Schema.fromJson(json as core.Map<core.String, core.dynamic>); |
| checkSchema(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['schemaId']!.first, |
| unittest.equals(arg_schemaId), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSchema()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.create(arg_request, arg_parent, |
| schemaId: arg_schemaId, $fields: arg_$fields); |
| checkSchema(response as api.Schema); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.delete(arg_name, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_name = 'foo'; |
| final arg_view = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['view']!.first, |
| unittest.equals(arg_view), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSchema()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.get(arg_name, view: arg_view, $fields: arg_$fields); |
| checkSchema(response as api.Schema); |
| }); |
| |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_resource = 'foo'; |
| final arg_options_requestedPolicyVersion = 42; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['options.requestedPolicyVersion']!.first), |
| unittest.equals(arg_options_requestedPolicyVersion), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.getIamPolicy(arg_resource, |
| options_requestedPolicyVersion: arg_options_requestedPolicyVersion, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_parent = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_view = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['view']!.first, |
| unittest.equals(arg_view), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildListSchemasResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_parent, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| view: arg_view, |
| $fields: arg_$fields); |
| checkListSchemasResponse(response as api.ListSchemasResponse); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_request = buildSetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkSetIamPolicyRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.setIamPolicy(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_request = buildTestIamPermissionsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.TestIamPermissionsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildTestIamPermissionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.testIamPermissions(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkTestIamPermissionsResponse( |
| response as api.TestIamPermissionsResponse); |
| }); |
| |
| unittest.test('method--validate', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_request = buildValidateSchemaRequest(); |
| final arg_parent = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ValidateSchemaRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkValidateSchemaRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildValidateSchemaResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.validate(arg_request, arg_parent, $fields: arg_$fields); |
| checkValidateSchemaResponse(response as api.ValidateSchemaResponse); |
| }); |
| |
| unittest.test('method--validateMessage', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.schemas; |
| final arg_request = buildValidateMessageRequest(); |
| final arg_parent = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ValidateMessageRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkValidateMessageRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildValidateMessageResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.validateMessage(arg_request, arg_parent, |
| $fields: arg_$fields); |
| checkValidateMessageResponse(response as api.ValidateMessageResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsSnapshotsResource', () { |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_request = buildCreateSnapshotRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.CreateSnapshotRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkCreateSnapshotRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSnapshot()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.create(arg_request, arg_name, $fields: arg_$fields); |
| checkSnapshot(response as api.Snapshot); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_snapshot = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.delete(arg_snapshot, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_snapshot = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSnapshot()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.get(arg_snapshot, $fields: arg_$fields); |
| checkSnapshot(response as api.Snapshot); |
| }); |
| |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_resource = 'foo'; |
| final arg_options_requestedPolicyVersion = 42; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['options.requestedPolicyVersion']!.first), |
| unittest.equals(arg_options_requestedPolicyVersion), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.getIamPolicy(arg_resource, |
| options_requestedPolicyVersion: arg_options_requestedPolicyVersion, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_project = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildListSnapshotsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_project, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListSnapshotsResponse(response as api.ListSnapshotsResponse); |
| }); |
| |
| unittest.test('method--patch', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_request = buildUpdateSnapshotRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.UpdateSnapshotRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkUpdateSnapshotRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSnapshot()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.patch(arg_request, arg_name, $fields: arg_$fields); |
| checkSnapshot(response as api.Snapshot); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_request = buildSetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkSetIamPolicyRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.setIamPolicy(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.snapshots; |
| final arg_request = buildTestIamPermissionsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.TestIamPermissionsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildTestIamPermissionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.testIamPermissions(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkTestIamPermissionsResponse( |
| response as api.TestIamPermissionsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsSubscriptionsResource', () { |
| unittest.test('method--acknowledge', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildAcknowledgeRequest(); |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.AcknowledgeRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkAcknowledgeRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.acknowledge(arg_request, arg_subscription, |
| $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildSubscription(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.Subscription.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkSubscription(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSubscription()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.create(arg_request, arg_name, $fields: arg_$fields); |
| checkSubscription(response as api.Subscription); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.delete(arg_subscription, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--detach', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildDetachSubscriptionResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.detach(arg_subscription, $fields: arg_$fields); |
| checkDetachSubscriptionResponse( |
| response as api.DetachSubscriptionResponse); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSubscription()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.get(arg_subscription, $fields: arg_$fields); |
| checkSubscription(response as api.Subscription); |
| }); |
| |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_resource = 'foo'; |
| final arg_options_requestedPolicyVersion = 42; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['options.requestedPolicyVersion']!.first), |
| unittest.equals(arg_options_requestedPolicyVersion), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.getIamPolicy(arg_resource, |
| options_requestedPolicyVersion: arg_options_requestedPolicyVersion, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_project = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildListSubscriptionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_project, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListSubscriptionsResponse(response as api.ListSubscriptionsResponse); |
| }); |
| |
| unittest.test('method--modifyAckDeadline', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildModifyAckDeadlineRequest(); |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ModifyAckDeadlineRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkModifyAckDeadlineRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.modifyAckDeadline( |
| arg_request, arg_subscription, |
| $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--modifyPushConfig', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildModifyPushConfigRequest(); |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.ModifyPushConfigRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkModifyPushConfigRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.modifyPushConfig(arg_request, arg_subscription, |
| $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--patch', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildUpdateSubscriptionRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.UpdateSubscriptionRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkUpdateSubscriptionRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSubscription()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.patch(arg_request, arg_name, $fields: arg_$fields); |
| checkSubscription(response as api.Subscription); |
| }); |
| |
| unittest.test('method--pull', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildPullRequest(); |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.PullRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkPullRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPullResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.pull(arg_request, arg_subscription, $fields: arg_$fields); |
| checkPullResponse(response as api.PullResponse); |
| }); |
| |
| unittest.test('method--seek', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildSeekRequest(); |
| final arg_subscription = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SeekRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkSeekRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildSeekResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.seek(arg_request, arg_subscription, $fields: arg_$fields); |
| checkSeekResponse(response as api.SeekResponse); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildSetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkSetIamPolicyRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.setIamPolicy(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.subscriptions; |
| final arg_request = buildTestIamPermissionsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.TestIamPermissionsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildTestIamPermissionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.testIamPermissions(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkTestIamPermissionsResponse( |
| response as api.TestIamPermissionsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsTopicsResource', () { |
| unittest.test('method--create', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_request = buildTopic(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = |
| api.Topic.fromJson(json as core.Map<core.String, core.dynamic>); |
| checkTopic(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildTopic()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.create(arg_request, arg_name, $fields: arg_$fields); |
| checkTopic(response as api.Topic); |
| }); |
| |
| unittest.test('method--delete', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_topic = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildEmpty()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.delete(arg_topic, $fields: arg_$fields); |
| checkEmpty(response as api.Empty); |
| }); |
| |
| unittest.test('method--get', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_topic = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildTopic()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.get(arg_topic, $fields: arg_$fields); |
| checkTopic(response as api.Topic); |
| }); |
| |
| unittest.test('method--getIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_resource = 'foo'; |
| final arg_options_requestedPolicyVersion = 42; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['options.requestedPolicyVersion']!.first), |
| unittest.equals(arg_options_requestedPolicyVersion), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.getIamPolicy(arg_resource, |
| options_requestedPolicyVersion: arg_options_requestedPolicyVersion, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_project = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildListTopicsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_project, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListTopicsResponse(response as api.ListTopicsResponse); |
| }); |
| |
| unittest.test('method--patch', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_request = buildUpdateTopicRequest(); |
| final arg_name = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.UpdateTopicRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkUpdateTopicRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildTopic()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.patch(arg_request, arg_name, $fields: arg_$fields); |
| checkTopic(response as api.Topic); |
| }); |
| |
| unittest.test('method--publish', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_request = buildPublishRequest(); |
| final arg_topic = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.PublishRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkPublishRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPublishResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = |
| await res.publish(arg_request, arg_topic, $fields: arg_$fields); |
| checkPublishResponse(response as api.PublishResponse); |
| }); |
| |
| unittest.test('method--setIamPolicy', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_request = buildSetIamPolicyRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.SetIamPolicyRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkSetIamPolicyRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildPolicy()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.setIamPolicy(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkPolicy(response as api.Policy); |
| }); |
| |
| unittest.test('method--testIamPermissions', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics; |
| final arg_request = buildTestIamPermissionsRequest(); |
| final arg_resource = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final obj = api.TestIamPermissionsRequest.fromJson( |
| json as core.Map<core.String, core.dynamic>); |
| checkTestIamPermissionsRequest(obj); |
| |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildTestIamPermissionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.testIamPermissions(arg_request, arg_resource, |
| $fields: arg_$fields); |
| checkTestIamPermissionsResponse( |
| response as api.TestIamPermissionsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsTopicsSnapshotsResource', () { |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics.snapshots; |
| final arg_topic = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildListTopicSnapshotsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_topic, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListTopicSnapshotsResponse( |
| response as api.ListTopicSnapshotsResponse); |
| }); |
| }); |
| |
| unittest.group('resource-ProjectsTopicsSubscriptionsResource', () { |
| unittest.test('method--list', () async { |
| final mock = HttpServerMock(); |
| final res = api.PubsubApi(mock).projects.topics.subscriptions; |
| final arg_topic = 'foo'; |
| final arg_pageSize = 42; |
| final arg_pageToken = 'foo'; |
| final arg_$fields = 'foo'; |
| mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| final path = (req.url).path; |
| var pathOffset = 0; |
| core.int index; |
| core.String subPart; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 1), |
| unittest.equals('/'), |
| ); |
| pathOffset += 1; |
| unittest.expect( |
| path.substring(pathOffset, pathOffset + 3), |
| unittest.equals('v1/'), |
| ); |
| pathOffset += 3; |
| // NOTE: We cannot test reserved expansions due to the inability to reverse the operation; |
| |
| final query = (req.url).query; |
| var queryOffset = 0; |
| final queryMap = <core.String, core.List<core.String>>{}; |
| void addQueryParam(core.String n, core.String v) => |
| queryMap.putIfAbsent(n, () => []).add(v); |
| |
| if (query.isNotEmpty) { |
| for (var part in query.split('&')) { |
| final keyValue = part.split('='); |
| addQueryParam( |
| core.Uri.decodeQueryComponent(keyValue[0]), |
| core.Uri.decodeQueryComponent(keyValue[1]), |
| ); |
| } |
| } |
| unittest.expect( |
| core.int.parse(queryMap['pageSize']!.first), |
| unittest.equals(arg_pageSize), |
| ); |
| unittest.expect( |
| queryMap['pageToken']!.first, |
| unittest.equals(arg_pageToken), |
| ); |
| unittest.expect( |
| queryMap['fields']!.first, |
| unittest.equals(arg_$fields), |
| ); |
| |
| final h = { |
| 'content-type': 'application/json; charset=utf-8', |
| }; |
| final resp = convert.json.encode(buildListTopicSubscriptionsResponse()); |
| return async.Future.value(stringResponse(200, h, resp)); |
| }), true); |
| final response = await res.list(arg_topic, |
| pageSize: arg_pageSize, |
| pageToken: arg_pageToken, |
| $fields: arg_$fields); |
| checkListTopicSubscriptionsResponse( |
| response as api.ListTopicSubscriptionsResponse); |
| }); |
| }); |
| } |