Ejemplo n.º 1
0
def test_add_purchase_path_with_file(
    mock_insert_csv, mock_os_path_isfile, mock_os_path_is_dir,
    mock_os_path_abspath, mock_create_connection, mock_os_path_expanduser
):
    g = Groc()
    g.add_purchase_path('foo.csv', False)

    mock_insert_csv.assert_called_with(
        'some-connection', ['some-path-to-file'], False)
Ejemplo n.º 2
0
def test_add_purchase_path_exception(
    mock_insert_csv, mock_os_path_isfile, mock_os_path_is_dir,
    mock_os_path_abspath, mock_create_connection, mock_os_path_expanduser
):
    g = Groc()

    with pytest.raises(Exception) as e:
        g.add_purchase_path('foo', False)
    assert "some-path-to-file could not be found!" in str(e.value)
Ejemplo n.º 3
0
def test_add_purchase_path_with_dir(
    mock_insert_csv, mock_compile_csvs, mock_os_path_is_dir, 
    mock_os_path_abspath, mock_create_connection, mock_os_path_expanduser
):
    g = Groc()
    g.add_purchase_path('some-path', False)

    mock_insert_csv.assert_called_with(
        'some-connection', ['foo.csv', 'bar.csv'], False)