Skip to content

Commit 38e46d5

Browse files
committed
Fix coverage.
1 parent 454edcd commit 38e46d5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

core/unit_tests/test__helpers.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,33 @@ def test_it(self):
644644
secure_authorized_channel.assert_called_once_with(
645645
credentials, mock.ANY, expected_target, options=expected_options)
646646

647+
def test_extra_options(self):
648+
from six.moves import http_client
649+
650+
credentials = object()
651+
host = 'HOST'
652+
user_agent = 'USER_AGENT'
653+
extra_options = (('some', 'option'),)
654+
655+
secure_authorized_channel_patch = mock.patch(
656+
'google.auth.transport.grpc.secure_authorized_channel',
657+
autospec=True)
658+
659+
with secure_authorized_channel_patch as secure_authorized_channel:
660+
result = self._call_fut(credentials, user_agent, host,
661+
extra_options)
662+
663+
self.assertIs(result, secure_authorized_channel.return_value)
664+
665+
expected_target = '%s:%d' % (host, http_client.HTTPS_PORT)
666+
expected_options = (
667+
('grpc.primary_user_agent', user_agent),
668+
extra_options[0],
669+
)
670+
671+
secure_authorized_channel.assert_called_once_with(
672+
credentials, mock.ANY, expected_target, options=expected_options)
673+
647674

648675
class Test_make_secure_stub(unittest.TestCase):
649676

0 commit comments

Comments
 (0)