Skip to content

Commit c7f360e

Browse files
committed
Fix encrypted tests crashing on non-encrypted builds
1 parent a6aa8da commit c7f360e

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

.github/workflows/encrypted_settings.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,3 @@
1515
},
1616
"KMS_CREDENTIALS": {},
1717
}
18-
19-
20-
class EncryptedRouter:
21-
def allow_migrate(self, db, app_label, model_name=None, **hints):
22-
# The encryption_ app's models are only created in the encrypted database.
23-
if app_label == "encryption_":
24-
return db == "encrypted"
25-
# Don't create other app's models in the encrypted database.
26-
if db == "encrypted":
27-
return False
28-
return None
29-
30-
def kms_provider(self, model, **hints):
31-
return "local"
32-
33-
34-
DATABASE_ROUTERS = [EncryptedRouter()]

.github/workflows/mongodb_settings.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,26 @@
2525
"NAME": "djangotests-other",
2626
"OPTIONS": {"directConnection": True},
2727
},
28+
"encrypted": {},
2829
}
2930

3031

32+
class EncryptedRouter:
33+
def allow_migrate(self, db, app_label, model_name=None, **hints):
34+
# The encryption_ app's models are only created in the encrypted
35+
# database.
36+
if app_label == "encryption_":
37+
return db == "encrypted"
38+
# Don't create other app's models in the encrypted database.
39+
if db == "encrypted":
40+
return False
41+
return None
42+
43+
def kms_provider(self, model, **hints):
44+
return "local"
45+
46+
47+
DATABASE_ROUTERS = [EncryptedRouter()]
3148
DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
3249
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
3350
SECRET_KEY = "django_tests_secret_key"

0 commit comments

Comments
 (0)