Example #1
0
def test_storage_delete_resource_not_existent_error(options):
    storage = BigqueryStorage(**options)
    with pytest.raises(FrictionlessException) as excinfo:
        storage.delete_resource("bad")
    error = excinfo.value.error
    assert error.code == "storage-error"
    assert error.note.count("does not exist")
Example #2
0
def test_bigquery_storage_delete_resource_not_existent_error(options):
    service = options.pop("service")
    dialect = BigqueryDialect(**options)
    storage = BigqueryStorage(service, dialect=dialect)
    with pytest.raises(FrictionlessException) as excinfo:
        storage.delete_resource("bad")
    error = excinfo.value.error
    assert error.code == "storage-error"
    assert error.note.count("does not exist")
Example #3
0
def test_storage_big_file(options):
    service = options.pop("service")
    dialect = BigqueryDialect(**options)
    storage = BigqueryStorage(service, dialect=dialect)
    resource = Resource(name="table", data=[[1]] * 1500)
    storage.write_resource(resource, force=True)
    target = storage.read_resource("table")
    assert len(target.read_rows()) == 1500
    storage.delete_package(list(storage))
Example #4
0
def test_bigquery_storage_write_resource_existent_error(options):
    service = options.pop("service")
    dialect = BigqueryDialect(**options)
    storage = BigqueryStorage(service, dialect=dialect)
    resource = Resource(path="data/table.csv")
    storage.write_resource(resource, force=True)
    with pytest.raises(FrictionlessException) as excinfo:
        storage.write_resource(resource)
    error = excinfo.value.error
    assert error.code == "storage-error"
    assert error.note.count("already exists")
    # Cleanup storage
    storage.delete_package(list(storage))