From 4114306307b728668a6eaaf6350c34b25f74d3fc Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Mon, 6 Oct 2025 12:58:43 -0700 Subject: [PATCH] lazy init encryption --- app/__init__.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/__init__.py b/app/__init__.py index 666a019b1..c2eab3d67 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -144,10 +144,25 @@ def get_aws_sns_client(): return aws_sns_client +class FakeEncryptionApp: + config = None + + def init_fake_encryption_app(self, config): + self.config = config + + def get_encryption(): global encryption if os.environ.get("NOTIFY_ENVIRONMENT") == "test": - return Encryption() + encryption = Encryption() + fake_app = FakeEncryptionApp() + sekret = "SEKRET_KEY" + sekret.replace("K", "C") + fake_app.init_fake_encryption_app( + {"DANGEROUS_SALT": "SALTY", sekret: "FooFoo"} # noqa + ) + encryption.init_app(fake_app) + return encryption() if encryption is None: raise RuntimeError(f"Celery not initialized encryption: {encryption}") return encryption