_implementations_test.py
Go to the documentation of this file.
1 # Copyright 2016 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """Tests the implementations module of the gRPC Python Beta API."""
15 
16 import datetime
17 import unittest
18 
19 from grpc.beta import implementations
20 from oauth2client import client as oauth2client_client
21 
22 from tests.unit import resources
23 
24 
25 class ChannelCredentialsTest(unittest.TestCase):
26 
28  channel_credentials = implementations.ssl_channel_credentials()
29  self.assertIsInstance(channel_credentials,
30  implementations.ChannelCredentials)
31 
33  channel_credentials = implementations.ssl_channel_credentials(
34  resources.test_root_certificates())
35  self.assertIsInstance(channel_credentials,
36  implementations.ChannelCredentials)
37 
38 
39 class CallCredentialsTest(unittest.TestCase):
40 
42  creds = oauth2client_client.GoogleCredentials(
43  'token', 'client_id', 'secret', 'refresh_token',
44  datetime.datetime(2008, 6, 24), 'https://refresh.uri.com/',
45  'user_agent')
46  call_creds = implementations.google_call_credentials(creds)
47  self.assertIsInstance(call_creds, implementations.CallCredentials)
48 
50  call_creds = implementations.access_token_call_credentials('token')
51  self.assertIsInstance(call_creds, implementations.CallCredentials)
52 
53 
54 if __name__ == '__main__':
55  unittest.main(verbosity=2)
tests.unit.beta._implementations_test.ChannelCredentialsTest.test_application_provided_root_certificates
def test_application_provided_root_certificates(self)
Definition: _implementations_test.py:32
grpc.beta
Definition: src/python/grpcio/grpc/beta/__init__.py:1
tests.unit.beta._implementations_test.ChannelCredentialsTest
Definition: _implementations_test.py:25
tests.unit.beta._implementations_test.CallCredentialsTest
Definition: _implementations_test.py:39
tests.unit.beta._implementations_test.ChannelCredentialsTest.test_runtime_provided_root_certificates
def test_runtime_provided_root_certificates(self)
Definition: _implementations_test.py:27
tests.unit.beta._implementations_test.CallCredentialsTest.test_google_call_credentials
def test_google_call_credentials(self)
Definition: _implementations_test.py:41
tests.unit
Definition: src/python/grpcio_tests/tests/unit/__init__.py:1
tests.unit.beta._implementations_test.CallCredentialsTest.test_access_token_call_credentials
def test_access_token_call_credentials(self)
Definition: _implementations_test.py:49


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:27