예제 #1
0
    def test_secret_handler_can_use_any_secret_type(self):
        class MySecret(prefect.tasks.secrets.Secret):
            def run(self):
                return "boo"

        handler = SecretResultHandler(MySecret(name="foo"))
        assert handler.write(123089123) == "foo"
        assert handler.read(lambda x: None) == "boo"
예제 #2
0
 def test_secret_handler_writes_and_reads(self, res, secret_task):
     handler = SecretResultHandler(secret_task)
     with set_temporary_config({"cloud.use_local_secrets": True}):
         with prefect.context(secrets=dict(test=res)):
             final = handler.read(handler.write(res))
     assert final == res
예제 #3
0
 def test_secret_handler_writes_by_only_returning_name(
         self, res, secret_task):
     handler = SecretResultHandler(secret_task)
     out = handler.write(res)
     assert out == "test"