Exemplo n.º 1
0
def test_create_table_from_query_wrong_query(mocker):
    # When
    with pytest.raises(ValueError) as e:
        create_table_from_query('WRONG SQL QUERY', '__new_table_name__')

    # Then
    assert str(e.value) == 'Wrong query. You should provide a valid SQL query.'
Exemplo n.º 2
0
def test_create_table_from_query_wrong_credentials(mocker):
    # When
    with pytest.raises(ValueError) as e:
        create_table_from_query('SELECT * FROM table', '__new_table_name__',
                                1234)

    # Then
    assert str(e.value) == 'Credentials attribute is required. Please pass a `Credentials` ' + \
                           'instance or use the `set_default_credentials` function.'
Exemplo n.º 3
0
def test_create_table_from_query_wrong_new_table_name(mocker):
    # When
    with pytest.raises(ValueError) as e:
        create_table_from_query('SELECT * FROM table', 1234)

    # Then
    assert str(
        e.value
    ) == 'Wrong new table name. You should provide a valid table name.'
Exemplo n.º 4
0
def test_create_table_from_query_wrong_if_exists(mocker):
    # When
    with pytest.raises(ValueError) as e:
        create_table_from_query('SELECT * FROM table',
                                '__new_table_name__',
                                if_exists='keep_calm')

    # Then
    assert str(
        e.value
    ) == 'Wrong option for the `if_exists` param. You should provide: fail, replace, append.'