def test_check_for_thread_safety_httplib2shim(): global _USE_GAX _USE_GAX = False global _USE_GRPC _USE_GRPC = False client = MockClient() client.connection.http.__class__.__module__ = 'httplib2shim' utils._check_for_thread_safety(client)
def test_check_for_thread_safety_fail(): global _USE_GAX _USE_GAX = False global _USE_GRPC _USE_GRPC = False client = MockClient() with pytest.raises(ValueError): utils._check_for_thread_safety(client)
def test_check_for_thread_safety_key_and_attr_error(): global _USE_GAX _USE_GAX = False global _USE_GRPC _USE_GRPC = False client = MockClientNoConnection(KeyError) utils._check_for_thread_safety(client) client = MockClientNoConnection(AttributeError) utils._check_for_thread_safety(client)
def test_check_for_thread_safety_use_grpc(): global _USE_GAX _USE_GAX = False global _USE_GRPC _USE_GRPC = True utils._check_for_thread_safety(MockClient())
def test_check_for_thread_safety_use_gax(): global _USE_GAX _USE_GAX = True utils._check_for_thread_safety(MockClient())