Esempio n. 1
0
def test_raises_network_error_when_counting_messages_raises_a_connection_error():
    mesh_inbox = mock_mesh_inbox(count_messages_error=mesh_client_connection_error())

    with pytest.raises(MeshClientNetworkError) as e:
        mesh_inbox.count_messages()

    assert e.value.error_message == (
        f"ConnectionError received when attempting to connect to: {TEST_INBOX_URL}"
    )
def test_mesh_network_error_raised_when_ack_raises_connection_error():
    client_message = mock_client_message(
        acknowledge_error=mesh_client_connection_error("an error"))

    message = MeshMessage(client_message)

    with pytest.raises(MeshClientNetworkError) as e:
        message.acknowledge()

    assert str(e.value) == (
        f"ConnectionError received when attempting to connect to: {TEST_INBOX_URL}"
        " caused by: an error")
Esempio n. 3
0
 def mock_iterate_all_messages():
     raise mesh_client_connection_error("an error")
     yield mock_client_message()
Esempio n. 4
0
 def mock_retrieve_message(message_id):
     raise mesh_client_connection_error("an error")
Esempio n. 5
0
 def mock_list_messages():
     raise mesh_client_connection_error("an error")