Skip to content

Commit 7717d76

Browse files
fix: pass updated keyword args to Publisher/Subscriber client in google/pubsub
1 parent df0c28a commit 7717d76

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

testcontainers/google/pubsub.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ def _get_channel(self, channel=None):
5555

5656
def get_publisher_client(self, **kwargs):
5757
from google.cloud import pubsub
58-
kwargs['channel'] = self._get_channel(kwargs.get('channel'))
58+
from google.auth import credentials
59+
kwargs['client_options'] = dict(api_endpoint=self.get_pubsub_emulator_host())
60+
kwargs['credentials'] = credentials.AnonymousCredentials()
5961
return pubsub.PublisherClient(**kwargs)
6062

6163
def get_subscriber_client(self, **kwargs):
6264
from google.cloud import pubsub
63-
kwargs['channel'] = self._get_channel(kwargs.get('channel'))
65+
from google.auth import credentials
66+
kwargs['client_options'] = dict(api_endpoint=self.get_pubsub_emulator_host())
67+
kwargs['credentials'] = credentials.AnonymousCredentials()
6468
return pubsub.SubscriberClient(**kwargs)

0 commit comments

Comments
 (0)