Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions logging/google/cloud/logging/_gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def make_gax_logging_api(client):
:returns: A metrics API instance with the proper credentials.
"""
channel = make_secure_channel(
client._credentials, DEFAULT_USER_AGENT,
client._connection.credentials, DEFAULT_USER_AGENT,
LoggingServiceV2Client.SERVICE_ADDRESS)
generated = LoggingServiceV2Client(channel=channel)
return _LoggingAPI(generated, client)
Expand All @@ -548,7 +548,7 @@ def make_gax_metrics_api(client):
:returns: A metrics API instance with the proper credentials.
"""
channel = make_secure_channel(
client._credentials, DEFAULT_USER_AGENT,
client._connection.credentials, DEFAULT_USER_AGENT,
MetricsServiceV2Client.SERVICE_ADDRESS)
generated = MetricsServiceV2Client(channel=channel)
return _MetricsAPI(generated, client)
Expand All @@ -564,7 +564,7 @@ def make_gax_sinks_api(client):
:returns: A metrics API instance with the proper credentials.
"""
channel = make_secure_channel(
client._credentials, DEFAULT_USER_AGENT,
client._connection.credentials, DEFAULT_USER_AGENT,
ConfigServiceV2Client.SERVICE_ADDRESS)
generated = ConfigServiceV2Client(channel=channel)
return _SinksAPI(generated, client)
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class BackgroundThreadTransport(Transport):
def __init__(self, client, name):
http = copy.deepcopy(client._http)
self.client = client.__class__(
client.project, client._credentials, http)
client.project, client._connection.credentials, http)
logger = self.client.logger(name)
self.worker = _Worker(logger)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,13 @@ def batch(self):
class _Client(object):

def __init__(self, project, http=None, credentials=None):
import mock

self.project = project
self._http = http
self._credentials = credentials
self._connection = mock.Mock(
credentials=credentials, spec=['credentials'])

def logger(self, name): # pylint: disable=unused-argument
self._logger = _Logger(name)
Expand Down
9 changes: 6 additions & 3 deletions logging/unit_tests/test__gax.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,8 @@ def test_it(self):
from google.cloud.logging._gax import DEFAULT_USER_AGENT

creds = object()
client = mock.Mock(_credentials=creds)
conn = mock.Mock(credentials=creds, spec=['credentials'])
client = mock.Mock(_connection=conn, spec=['_connection'])
channels = []
channel_args = []
channel_obj = object()
Expand Down Expand Up @@ -1130,7 +1131,8 @@ def test_it(self):
from google.cloud.logging._gax import DEFAULT_USER_AGENT

creds = object()
client = mock.Mock(_credentials=creds)
conn = mock.Mock(credentials=creds, spec=['credentials'])
client = mock.Mock(_connection=conn, spec=['_connection'])
channels = []
channel_args = []
channel_obj = object()
Expand Down Expand Up @@ -1175,7 +1177,8 @@ def test_it(self):
from google.cloud.logging._gax import DEFAULT_USER_AGENT

creds = object()
client = mock.Mock(_credentials=creds)
conn = mock.Mock(credentials=creds, spec=['credentials'])
client = mock.Mock(_connection=conn, spec=['_connection'])
channels = []
channel_args = []
channel_obj = object()
Expand Down