Пример #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())