Skip to content

Commit f9cbb3d

Browse files
committed
run all tests
1 parent ec02675 commit f9cbb3d

File tree

3 files changed

+176
-204
lines changed

3 files changed

+176
-204
lines changed

.github/workflows/encrypted_settings.py

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

.github/workflows/mongodb_settings.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
DATABASES = {
1515
"default": {**db_settings, "NAME": "djangotests"},
1616
"other": {**db_settings, "NAME": "djangotests-other"},
17-
"encrypted": {},
1817
}
1918
else:
2019
DATABASES = {
@@ -29,30 +28,8 @@
2928
"NAME": "djangotests-other",
3029
"OPTIONS": {"directConnection": True},
3130
},
32-
"encrypted": {},
3331
}
3432

35-
36-
class EncryptedRouter:
37-
def db_for_read(self, model, **hints):
38-
if model._meta.app_label == "encryption_":
39-
return "encrypted"
40-
return None
41-
42-
db_for_write = db_for_read
43-
44-
def allow_migrate(self, db, app_label, model_name=None, **hints):
45-
# The encryption_ app's models are only created in the encrypted
46-
# database.
47-
if app_label == "encryption_":
48-
return db == "encrypted"
49-
# Don't create other app's models in the encrypted database.
50-
if db == "encrypted":
51-
return False
52-
return None
53-
54-
55-
DATABASE_ROUTERS = ["django_mongodb_backend.routers.MongoRouter", EncryptedRouter()]
5633
DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
5734
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
5835
SECRET_KEY = "django_tests_secret_key"

0 commit comments

Comments
 (0)