Example #1
0
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)
Example #2
0
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)
Example #3
0
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)
Example #4
0
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)
Example #5
0
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)
Example #6
0
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)
Example #7
0
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())
Example #8
0
def test_check_for_thread_safety_use_gax():
    global _USE_GAX
    _USE_GAX = True
    utils._check_for_thread_safety(MockClient())
Example #9
0
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())
Example #10
0
def test_check_for_thread_safety_use_gax():
    global _USE_GAX
    _USE_GAX = True
    utils._check_for_thread_safety(MockClient())