File tree Expand file tree Collapse file tree 11 files changed +44
-48
lines changed Expand file tree Collapse file tree 11 files changed +44
-48
lines changed Original file line number Diff line number Diff line change @@ -32,3 +32,4 @@ uv.lock
32
32
docs /_build /
33
33
config /wagtail /wagtail_settings.py
34
34
customer-master-key.txt
35
+ mongocryptd.pid
Original file line number Diff line number Diff line change 3
3
4
4
from django .contrib .auth .hashers import PBKDF2PasswordHasher
5
5
6
- from django_mongodb_cli .utils import get_databases
6
+ import os
7
+ import django_mongodb_backend
7
8
8
-
9
- DATABASES = get_databases ( "allauth" )
9
+ DATABASE_URL = os . environ . get ( "MONGODB_URI" , "mongodb://localhost:27017/djangotests" )
10
+ DATABASES = { "default" : django_mongodb_backend . parse_uri ( DATABASE_URL )}
10
11
11
12
SECRET_KEY = "psst"
12
13
SITE_ID = ObjectId ()
Original file line number Diff line number Diff line change 1
1
"""Django settings for tests."""
2
2
3
3
import os
4
- from django_mongodb_cli . utils import get_databases
4
+ import django_mongodb_backend
5
5
6
-
7
- DATABASES = get_databases ( "debug_toolbar" )
6
+ DATABASE_URL = os . environ . get ( "MONGODB_URI" , "mongodb://localhost:27017/djangotests" )
7
+ DATABASES = { "default" : django_mongodb_backend . parse_uri ( DATABASE_URL )}
8
8
9
9
BASE_DIR = os .path .dirname (os .path .dirname (__file__ ))
10
10
Original file line number Diff line number Diff line change 1
- from django_mongodb_cli .utils import get_databases
1
+ import os
2
+ import django_mongodb_backend
2
3
4
+ kms_providers = django_mongodb_backend .get_kms_providers ()
3
5
4
- DATABASES = get_databases ("django" )
6
+ HOME = os .environ .get ("HOME" )
7
+
8
+ auto_encryption_opts = django_mongodb_backend .get_auto_encryption_opts (
9
+ kms_providers = kms_providers ,
10
+ crypt_shared_lib_path = f"{ HOME } /Downloads/mongo_crypt_shared_v1-macos-arm64-enterprise-8.0.10/lib/mongo_crypt_v1.dylib" ,
11
+ )
12
+
13
+ DATABASE_URL = os .environ .get ("MONGODB_URI" , "mongodb://localhost:27017/djangotests" )
14
+ DATABASES = {
15
+ "default" : django_mongodb_backend .parse_uri (DATABASE_URL ),
16
+ "encryption" : django_mongodb_backend .parse_uri (
17
+ DATABASE_URL , options = {"auto_encryption_opts" : auto_encryption_opts }
18
+ ),
19
+ }
5
20
6
21
DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
7
22
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher" ,)
Original file line number Diff line number Diff line change 1
1
"""Django settings for tests."""
2
2
3
3
import os
4
- from django_mongodb_cli . utils import get_databases
4
+ import django_mongodb_backend
5
5
6
-
7
- DATABASES = get_databases ( "debug_toolbar" )
6
+ DATABASE_URL = os . environ . get ( "MONGODB_URI" , "mongodb://localhost:27017/djangotests" )
7
+ DATABASES = { "default" : django_mongodb_backend . parse_uri ( DATABASE_URL )}
8
8
9
9
BASE_DIR = os .path .dirname (os .path .dirname (__file__ ))
10
10
Original file line number Diff line number Diff line change 1
1
# ensure package/conf is importable
2
2
from django_filters .conf import DEFAULTS
3
3
4
+ import os
5
+ import django_mongodb_backend
4
6
5
- from django_mongodb_cli .utils import get_databases
6
-
7
-
8
- DATABASES = get_databases ("django_filter" )
9
-
7
+ DATABASE_URL = os .environ .get ("MONGODB_URI" , "mongodb://localhost:27017/djangotests" )
8
+ DATABASES = {"default" : django_mongodb_backend .parse_uri (DATABASE_URL )}
10
9
11
10
INSTALLED_APPS = (
12
11
"tests.mongo_apps.MongoContentTypesConfig" ,
Original file line number Diff line number Diff line change 4
4
from bson import ObjectId
5
5
from django .core import management
6
6
7
- from django_mongodb_cli .utils import get_databases
7
+ import django_mongodb_backend
8
+
9
+ DATABASE_URL = os .environ .get ("MONGODB_URI" , "mongodb://localhost:27017/djangotests" )
10
+ DATABASES = {"default" : django_mongodb_backend .parse_uri (DATABASE_URL )}
8
11
9
12
10
13
def pytest_addoption (parser ):
@@ -22,7 +25,7 @@ def pytest_configure(config):
22
25
23
26
settings .configure (
24
27
DEBUG_PROPAGATE_EXCEPTIONS = True ,
25
- DATABASES = get_databases ( "rest_framework" ) ,
28
+ DATABASES = DATABASES ,
26
29
SITE_ID = ObjectId ("000000000000000000000001" ),
27
30
SECRET_KEY = "not very secret in tests" ,
28
31
USE_I18N = True ,
Original file line number Diff line number Diff line change 6
6
from django .utils .translation import gettext_lazy as _
7
7
8
8
from wagtail .test .numberformat import patch_number_formats
9
- from django_mongodb_cli .utils import get_databases
9
+
10
+ DATABASE_URL = os .environ .get ("MONGODB_URI" , "mongodb://localhost:27017/djangotests" )
11
+ DATABASES = {"default" : django_mongodb_backend .parse_uri (DATABASE_URL )}
10
12
11
13
WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT = (
12
14
os .environ .get ("WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT" , "0" ) == "1"
25
27
26
28
TIME_ZONE = "Asia/Tokyo"
27
29
28
- DATABASES = get_databases ("wagtail" )
29
-
30
30
SECRET_KEY = "not needed"
31
31
32
32
ROOT_URLCONF = "wagtail.test.urls"
Original file line number Diff line number Diff line change @@ -79,17 +79,6 @@ def get_management_command(command=None):
79
79
return base_command
80
80
81
81
82
- def get_databases (app ):
83
- """Get the databases configuration for the specified app."""
84
- import django_mongodb_backend
85
-
86
- DATABASE_URL = os .environ .get (
87
- "MONGODB_URI" , f"mongodb://localhost:27017/{ app } _tests"
88
- )
89
- DATABASES = {"default" : django_mongodb_backend .parse_uri (DATABASE_URL )}
90
- return DATABASES
91
-
92
-
93
82
def get_repos (pyproject_path ):
94
83
with open (pyproject_path , "r" ) as f :
95
84
pyproject_data = toml .load (f )
Original file line number Diff line number Diff line change 1
1
default :
2
2
echo ' Hello, world!'
3
3
4
- install : pip-install git-clone dev -install
4
+ install : pip-install git-clone repo -install
5
5
alias i := install
6
6
7
- dev -install:
7
+ repo -install:
8
8
dm repo install django
9
9
dm repo install django-mongodb-backend
10
- dm repo install django-mongodb-extensions
11
10
dm repo install mongo-python-driver
12
- dm repo install python-xmlsec
13
- dm repo install libmongocrypt
14
-
15
-
16
- demo :
17
- dm repo test django queries_
18
- dm repo test django-filter tests.test_filters
19
- dm repo test django-debug-toolbar
20
- dm repo test django-allauth allauth/ account/ tests
21
- alias d := demo
22
11
23
12
# ---------------------------------------- git ----------------------------------------
24
13
@@ -31,10 +20,7 @@ git-clone:
31
20
dm repo clone django-mongodb-extensions
32
21
dm repo clone django-mongodb-project
33
22
dm repo clone django-mongodb-templates
34
- dm repo clone django-rest-framework
35
- dm repo clone libmongocrypt
36
23
dm repo clone mongo-python-driver
37
- dm repo clone python-xmlsec
38
24
39
25
# ---------------------------------------- django ----------------------------------------
40
26
@@ -111,6 +97,7 @@ sphinx-clean:
111
97
alias sc := sphinx-clean
112
98
113
99
# ---------------------------------------- qe ----------------------------------------
100
+
114
101
qe :
115
102
python qe.py
116
103
alias q := qe
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ dependencies = [
16
16
" python3-openid" , # For django-allauth
17
17
" python3-saml" , # For django-allauth
18
18
" pyjwt[crypto]" , # For django-allauth
19
+ " pymongocrypt" , # For django-mongodb-backend QE
19
20
" pytest" ,
20
21
" pytest-html" ,
21
22
" pytest-django" , # For django-rest-framework and django-debug-toolbar
You can’t perform that action at this time.
0 commit comments