Ejemplo n.º 1
0
def test_execute_query(mock_athena_client):
    athena = FakeAthenaResource(client=mock_athena_client)
    assert athena.execute_query("SELECT 1", fetch_results=True) == [("1", )]
    assert athena.execute_query("SELECT * FROM foo",
                                fetch_results=True,
                                expected_results=[(1, None),
                                                  (2, 3)]) == [("1", ),
                                                               ("2", "3")]
Ejemplo n.º 2
0
def test_execute_query_succeeds_on_last_poll(mock_athena_client):
    athena = FakeAthenaResource(client=mock_athena_client, max_polls=1)
    athena.execute_query("SELECT 1", expected_states=["SUCCEEDED"])
Ejemplo n.º 3
0
def test_execute_query_timeout(mock_athena_client):
    athena = FakeAthenaResource(client=mock_athena_client, max_polls=1)
    with pytest.raises(AthenaTimeout):
        athena.execute_query("SELECT 1")
Ejemplo n.º 4
0
def test_execute_query_raises(mock_athena_client, expected_states):
    athena = FakeAthenaResource(client=mock_athena_client)
    with pytest.raises(AthenaError, match="state change reason"):
        athena.execute_query("SELECT 1", expected_states=expected_states)
Ejemplo n.º 5
0
def test_execute_query_state_transitions(mock_athena_client, expected_states):
    athena = FakeAthenaResource(client=mock_athena_client)
    athena.execute_query("SELECT 1", expected_states=expected_states)