Beispiel #1
0
    def test_blob_name_can_be_overwritten_at_runtime_by_download(self, monkeypatch):
        task = GCSDownload(bucket="test", blob="blobber")

        blob = MagicMock()
        client = MagicMock()
        client.return_value = MagicMock(
            get_bucket=MagicMock(return_value=MagicMock(blob=blob))
        )
        monkeypatch.setattr("prefect.tasks.gcp.storage.get_storage_client", client)

        task.run(blob="run-time", credentials={})

        assert blob.call_args[0] == ("run-time",)
 def test_download_initializes_attr_from_kwargs(self, attr):
     task = GCSDownload(bucket="bucket", **{attr: "my-value"})
     assert task.bucket == "bucket"
     assert getattr(task, attr) == "my-value"