Add jwt.OnDemandCredentials (#142)
diff --git a/system_tests/test_grpc.py b/system_tests/test_grpc.py
index 4bf1c5b..365bc91 100644
--- a/system_tests/test_grpc.py
+++ b/system_tests/test_grpc.py
@@ -39,7 +39,7 @@
list(list_topics_iter)
-def test_grpc_request_with_jwt_credentials(http_request):
+def test_grpc_request_with_jwt_credentials():
credentials, project_id = google.auth.default()
audience = 'https://{}/google.pubsub.v1.Publisher'.format(
publisher_client.PublisherClient.SERVICE_ADDRESS)
@@ -49,7 +49,27 @@
channel = google.auth.transport.grpc.secure_authorized_channel(
credentials,
- http_request,
+ None,
+ publisher_client.PublisherClient.SERVICE_ADDRESS)
+
+ # Create a pub/sub client.
+ client = publisher_client.PublisherClient(channel=channel)
+
+ # list the topics and drain the iterator to test that an authorized API
+ # call works.
+ list_topics_iter = client.list_topics(
+ project='projects/{}'.format(project_id))
+ list(list_topics_iter)
+
+
+def test_grpc_request_with_on_demand_jwt_credentials():
+ credentials, project_id = google.auth.default()
+ credentials = google.auth.jwt.OnDemandCredentials.from_signing_credentials(
+ credentials)
+
+ channel = google.auth.transport.grpc.secure_authorized_channel(
+ credentials,
+ None,
publisher_client.PublisherClient.SERVICE_ADDRESS)
# Create a pub/sub client.