summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--takahe/settings/base.py2
-rw-r--r--takahe/settings/testing.py2
-rw-r--r--users/apps.py8
3 files changed, 9 insertions, 3 deletions
diff --git a/takahe/settings/base.py b/takahe/settings/base.py
index 0ab3035..660ec9f 100644
--- a/takahe/settings/base.py
+++ b/takahe/settings/base.py
@@ -118,3 +118,5 @@ AUTO_ADMIN_EMAIL: Optional[str] = None
STATOR_TOKEN: Optional[str] = None
SENTRY_ENABLED = False
+
+IN_TESTS = False
diff --git a/takahe/settings/testing.py b/takahe/settings/testing.py
index 6527333..7dffa2a 100644
--- a/takahe/settings/testing.py
+++ b/takahe/settings/testing.py
@@ -2,3 +2,5 @@ from .base import * # noqa
# Fixed secret key
SECRET_KEY = "testing_secret"
+
+IN_TESTS = True
diff --git a/users/apps.py b/users/apps.py
index 05b5c3f..86a8eb3 100644
--- a/users/apps.py
+++ b/users/apps.py
@@ -1,4 +1,5 @@
from django.apps import AppConfig
+from django.conf import settings
class UsersConfig(AppConfig):
@@ -6,7 +7,8 @@ class UsersConfig(AppConfig):
name = "users"
def ready(self) -> None:
- # Generate the server actor keypair if needed
- from users.models import SystemActor
+ if not settings.IN_TESTS:
+ # Generate the server actor keypair if needed
+ from users.models import SystemActor
- SystemActor.generate_keys_if_needed()
+ SystemActor.generate_keys_if_needed()