diff --git a/samples/snippets/publisher.py b/samples/snippets/publisher.py index 9df1af788..8b632ee85 100644 --- a/samples/snippets/publisher.py +++ b/samples/snippets/publisher.py @@ -60,8 +60,14 @@ def create_topic(project_id: str, topic_id: str) -> None: # [END pubsub_create_topic] -def create_topic_kinesis_ingestion(project_id: str, topic_id: str, stream_arn: str, - consumer_arn: str, aws_role_arn: str, gcp_service_account: str) -> None: +def create_topic_kinesis_ingestion( + project_id: str, + topic_id: str, + stream_arn: str, + consumer_arn: str, + aws_role_arn: str, + gcp_service_account: str, +) -> None: """Create a new Pub/Sub topic with AWS Kinesis Ingestion Settings.""" # [START pubsub_quickstart_create_topic] # [START pubsub_create_topic] @@ -89,7 +95,7 @@ def create_topic_kinesis_ingestion(project_id: str, topic_id: str, stream_arn: s aws_role_arn=aws_role_arn, gcp_service_account=gcp_service_account, ) - ) + ), ) topic = publisher.create_topic(request=request) @@ -469,7 +475,9 @@ def detach_subscription(project_id: str, subscription_id: str) -> None: create_parser = subparsers.add_parser("create", help=create_topic.__doc__) create_parser.add_argument("topic_id") - create_topic_kinesis_ingestion_parser = subparsers.add_parser("create_kinesis_ingestion", help=create_topic_kinesis_ingestion.__doc__) + create_topic_kinesis_ingestion_parser = subparsers.add_parser( + "create_kinesis_ingestion", help=create_topic_kinesis_ingestion.__doc__ + ) create_topic_kinesis_ingestion_parser.add_argument("topic_id") create_topic_kinesis_ingestion_parser.add_argument("stream_arn") create_topic_kinesis_ingestion_parser.add_argument("consumer_arn") @@ -543,7 +551,7 @@ def detach_subscription(project_id: str, subscription_id: str) -> None: args.stream_arn, args.consumer_arn, args.aws_role_arn, - args.gcp_service_account + args.gcp_service_account, ) elif args.command == "delete": delete_topic(args.project_id, args.topic_id) diff --git a/samples/snippets/publisher_test.py b/samples/snippets/publisher_test.py index a18033fc1..fa31a74cf 100644 --- a/samples/snippets/publisher_test.py +++ b/samples/snippets/publisher_test.py @@ -134,7 +134,9 @@ def test_create_kinesis_ingestion( stream_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name" consumer_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111" aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name" - gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" + gcp_service_account = ( + "fake-service-account@fake-gcp-project.iam.gserviceaccount.com" + ) try: publisher_client.delete_topic(request={"topic": topic_path}) @@ -147,12 +149,13 @@ def test_create_kinesis_ingestion( stream_arn, consumer_arn, aws_role_arn, - gcp_service_account - ) + gcp_service_account, + ) out, _ = capsys.readouterr() assert f"Created topic: {topic_path} with AWS Kinesis Ingestion Settings" in out + def test_list(topic_path: str, capsys: CaptureFixture[str]) -> None: publisher.list_topics(PROJECT_ID) out, _ = capsys.readouterr()