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
3232docs /_build /
3333config /wagtail /wagtail_settings.py
3434customer-master-key.txt
35+ mongocryptd.pid
Original file line number Diff line number Diff line change 33
44from django .contrib .auth .hashers import PBKDF2PasswordHasher
55
6- from django_mongodb_cli .utils import get_databases
6+ import os
7+ import django_mongodb_backend
78
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 )}
1011
1112SECRET_KEY = "psst"
1213SITE_ID = ObjectId ()
Original file line number Diff line number Diff line change 11"""Django settings for tests."""
22
33import os
4- from django_mongodb_cli . utils import get_databases
4+ import django_mongodb_backend
55
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 )}
88
99BASE_DIR = os .path .dirname (os .path .dirname (__file__ ))
1010
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
23
4+ kms_providers = django_mongodb_backend .get_kms_providers ()
35
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+ }
520
621DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
722PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher" ,)
Original file line number Diff line number Diff line change 11"""Django settings for tests."""
22
33import os
4- from django_mongodb_cli . utils import get_databases
4+ import django_mongodb_backend
55
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 )}
88
99BASE_DIR = os .path .dirname (os .path .dirname (__file__ ))
1010
Original file line number Diff line number Diff line change 11# ensure package/conf is importable
22from django_filters .conf import DEFAULTS
33
4+ import os
5+ import django_mongodb_backend
46
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 )}
109
1110INSTALLED_APPS = (
1211 "tests.mongo_apps.MongoContentTypesConfig" ,
Original file line number Diff line number Diff line change 44from bson import ObjectId
55from django .core import management
66
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 )}
811
912
1013def pytest_addoption (parser ):
@@ -22,7 +25,7 @@ def pytest_configure(config):
2225
2326 settings .configure (
2427 DEBUG_PROPAGATE_EXCEPTIONS = True ,
25- DATABASES = get_databases ( "rest_framework" ) ,
28+ DATABASES = DATABASES ,
2629 SITE_ID = ObjectId ("000000000000000000000001" ),
2730 SECRET_KEY = "not very secret in tests" ,
2831 USE_I18N = True ,
Original file line number Diff line number Diff line change 66from django .utils .translation import gettext_lazy as _
77
88from 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 )}
1012
1113WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT = (
1214 os .environ .get ("WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT" , "0" ) == "1"
2527
2628TIME_ZONE = "Asia/Tokyo"
2729
28- DATABASES = get_databases ("wagtail" )
29-
3030SECRET_KEY = "not needed"
3131
3232ROOT_URLCONF = "wagtail.test.urls"
Original file line number Diff line number Diff line change @@ -79,17 +79,6 @@ def get_management_command(command=None):
7979 return base_command
8080
8181
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-
9382def get_repos (pyproject_path ):
9483 with open (pyproject_path , "r" ) as f :
9584 pyproject_data = toml .load (f )
Original file line number Diff line number Diff line change 11default :
22 echo ' Hello, world!'
33
4- install : pip-install git-clone dev -install
4+ install : pip-install git-clone repo -install
55alias i := install
66
7- dev -install:
7+ repo -install:
88 dm repo install django
99 dm repo install django-mongodb-backend
10- dm repo install django-mongodb-extensions
1110 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
2211
2312# ---------------------------------------- git ----------------------------------------
2413
@@ -31,10 +20,7 @@ git-clone:
3120 dm repo clone django-mongodb-extensions
3221 dm repo clone django-mongodb-project
3322 dm repo clone django-mongodb-templates
34- dm repo clone django-rest-framework
35- dm repo clone libmongocrypt
3623 dm repo clone mongo-python-driver
37- dm repo clone python-xmlsec
3824
3925# ---------------------------------------- django ----------------------------------------
4026
@@ -111,6 +97,7 @@ sphinx-clean:
11197alias sc := sphinx-clean
11298
11399# ---------------------------------------- qe ----------------------------------------
100+
114101qe :
115102 python qe.py
116103alias q := qe
You can’t perform that action at this time.
0 commit comments