Exemplo n.º 1
0
    def test_azure_service_init_uses_custom_secrets(self, azure_service):
        handler = AzureResultHandler(container="bob",
                                     azure_credentials_secret="MY_FOO")

        with prefect.context(secrets=dict(
                MY_FOO=dict(ACCOUNT_NAME=1, ACCOUNT_KEY=999))):
            with set_temporary_config({"cloud.use_local_secrets": True}):
                handler.initialize_service()

        assert handler.container == "bob"
        assert azure_service.call_args[1] == {
            "account_name": 1,
            "account_key": 999
        }
Exemplo n.º 2
0
    def test_azure_service_init_uses_secrets(self, azure_service):
        handler = AzureResultHandler(container="bob")
        assert handler.container == "bob"
        assert azure_service.called is False

        with prefect.context(secrets=dict(
                AZ_CREDENTIALS=dict(ACCOUNT_NAME="1", ACCOUNT_KEY="42"))):
            with set_temporary_config({"cloud.use_local_secrets": True}):
                handler.initialize_service()

        assert azure_service.call_args[1] == {
            "account_name": "1",
            "account_key": "42"
        }
Exemplo n.º 3
0
    def test_azure_service_init_uses_connection_string_over_secret(
            self, azure_service):
        handler = AzureResultHandler(container="bob",
                                     azure_credentials_secret="MY_FOO",
                                     connection_string="TEST")

        with prefect.context(secrets=dict(
                MY_FOO=dict(ACCOUNT_NAME=1, ACCOUNT_KEY=999))):
            with set_temporary_config({"cloud.use_local_secrets": True}):
                handler.initialize_service()

        assert handler.container == "bob"
        assert azure_service.call_args[1] == {
            "connection_string": "TEST",
        }