예제 #1
0
    def test_azure_exists(self, monkeypatch):
        client = MagicMock(get_blob_properties=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")
        assert result.exists("44.txt") is True
예제 #2
0
    def test_azure_does_not_exists(self, monkeypatch):
        from azure.core.exceptions import ResourceNotFoundError

        client = MagicMock(get_blob_properties=MagicMock(
            side_effect=ResourceNotFoundError))
        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")
        assert result.exists("44.txt") is False