Example #1
0
def test_delete_file(storage):

    storage.delete_file("municipios.csv", "staging")

    with pytest.raises(NotFound):
        storage.delete_file("municipios.csv", "staging")

    storage.delete_file("municipios.csv", "staging", not_found_ok=True)
Example #2
0
def test_upload(storage):

    storage.delete_file("municipios.csv", "staging", not_found_ok=True)

    storage.upload("tests/sample_data/municipios.csv", mode="staging")

    with pytest.raises(Exception):
        storage.upload("tests/sample_data/municipios.csv", mode="staging")

    storage.upload("tests/sample_data/municipios.csv",
                   mode="staging",
                   if_exists="replace")

    storage.upload(
        "tests/sample_data/municipios.csv",
        mode="staging",
        if_exists="replace",
        partitions="key1=value1/key2=value2",
    )

    storage.upload(
        "tests/sample_data/municipios.csv",
        mode="staging",
        if_exists="replace",
        partitions={
            "key1": "value1",
            "key2": "value1"
        },
    )

    with pytest.raises(Exception):
        storage.upload(
            "tests/sample_data/municipios.csv",
            mode="staging",
            if_exists="replace",
            partitions=["key1", "value1", "key2", "value1"],
        )