def test_delete_with_root(temp_bucket, tmpdir): repository = GCSRepository(bucket=temp_bucket.name, root="my-root") repository.put("some/file", "nice") assert repository.get("some/file") == b"nice" repository.delete("some/file") with pytest.raises(DoesNotExistError): repository.get("some/file")
def test_list(temp_bucket): repository = GCSRepository(bucket=temp_bucket.name, root="") repository.put("foo", "nice") repository.put("some/bar", "nice") assert repository.list("") == ["foo"] assert repository.list("some") == ["some/bar"]
def test_put_get_with_root(temp_bucket): repository = GCSRepository(bucket=temp_bucket.name, root="someroot") repository.put("foo/bar.txt", "nice") assert temp_bucket.blob( "someroot/foo/bar.txt").download_as_bytes() == b"nice" assert repository.get("foo/bar.txt") == b"nice"