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"
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