def test_azure_writes_binary_string(self, monkeypatch): client = MagicMock(upload_blob=MagicMock()) service = MagicMock(get_blob_client=MagicMock(return_value=client)) monkeypatch.setattr( "prefect.engine.results.azure_result.AzureResult.service", service) result = AzureResult(container="foo", location="nothing/here.txt") new_result = result.write(None) assert client.upload_blob.called assert isinstance(client.upload_blob.call_args[0][0], str)
def test_azure_writes_to_blob_using_rendered_template_name(self, monkeypatch): client = MagicMock(upload_blob=MagicMock()) service = MagicMock(get_blob_client=MagicMock(return_value=client)) monkeypatch.setattr( "prefect.engine.results.azure_result.AzureResult.service", service ) result = AzureResult(container="foo", location="{thing}/here.txt") new_result = result.write("so-much-data", thing=42) assert new_result.location == "42/here.txt" assert client.upload_blob.called assert service.get_blob_client.call_args[1]["blob"] == "42/here.txt" assert service.get_blob_client.call_args[1]["container"] == "foo"