Example #1
0
    def test_gcs_reads_and_updates_location(self, google_client):
        bucket = MagicMock()
        bucket.blob.return_value.download_as_bytes.return_value = b""
        google_client.return_value.bucket = MagicMock(return_value=bucket)
        result = GCSResult(bucket="foo", location="{thing}/here.txt")
        new_result = result.read("path/to/my/stuff.txt")

        assert new_result.location == "path/to/my/stuff.txt"
        assert new_result.value is None
Example #2
0
 def test_gcs_read_fails_if_format_not_called_first(self, google_client):
     result = GCSResult(bucket="foo", filepath_template="nothing/here.txt")
     with pytest.raises(ValueError):
         result.read()