예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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())
예제 #8
0
def test_check_for_thread_safety_use_gax():
    global _USE_GAX
    _USE_GAX = True
    utils._check_for_thread_safety(MockClient())
예제 #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())
예제 #10
0
def test_check_for_thread_safety_use_gax():
    global _USE_GAX
    _USE_GAX = True
    utils._check_for_thread_safety(MockClient())