Skip to content

Commit 4b532c3

Browse files
committed
feat: rename app identifiers to medical_records_django and medical_records_wagtail
Ensures manage.py help groups commands under [medical_records_django] and [medical_records_wagtail] rather than [django] or [wagtail].
1 parent c2af761 commit 4b532c3

3 files changed

Lines changed: 21 additions & 15 deletions

File tree

src/dbx_python_cli/commands/project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,8 +974,8 @@ def _enable_qe(project_path: Path, project_name: str, wagtail: bool = False) ->
974974
if qe_settings_file.exists():
975975
qe_content = qe_settings_file.read_text()
976976
qe_content = qe_content.replace(
977-
'"medical_records.django_only"',
978-
'"medical_records.wagtail"',
977+
'"medical_records.medical_records_django"',
978+
'"medical_records.medical_records_wagtail"',
979979
)
980980
qe_settings_file.write_text(qe_content)
981981

src/dbx_python_cli/templates/project_template/project_name/settings/qe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pymongo.encryption_options import AutoEncryptionOpts
44

55
QE_INSTALLED_APPS = [
6-
"medical_records.django_only",
6+
"medical_records.medical_records_django",
77
]
88

99
DATABASES = {

tests/test_project_command.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def test_enable_qe_activates_settings(tmp_path):
503503
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
504504
)
505505
(settings_dir / "qe.py").write_text(
506-
'QE_INSTALLED_APPS = ["medical_records.django_only"]\n'
506+
'QE_INSTALLED_APPS = ["medical_records.medical_records_django"]\n'
507507
)
508508

509509
_enable_qe(tmp_path, "myproject")
@@ -515,7 +515,7 @@ def test_enable_qe_activates_settings(tmp_path):
515515

516516

517517
def test_enable_qe_uses_django_app_by_default(tmp_path):
518-
"""Test that _enable_qe leaves medical_records.django_only when wagtail=False."""
518+
"""Test that _enable_qe leaves medical_records.medical_records_django when wagtail=False."""
519519
from dbx_python_cli.commands.project import _enable_qe
520520

521521
settings_dir = tmp_path / "myproject" / "settings"
@@ -525,15 +525,17 @@ def test_enable_qe_uses_django_app_by_default(tmp_path):
525525
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
526526
)
527527
qe_file = settings_dir / "qe.py"
528-
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django_only"]\n')
528+
qe_file.write_text(
529+
'QE_INSTALLED_APPS = ["medical_records.medical_records_django"]\n'
530+
)
529531

530532
_enable_qe(tmp_path, "myproject", wagtail=False)
531533

532-
assert '"medical_records.django_only"' in qe_file.read_text()
534+
assert '"medical_records.medical_records_django"' in qe_file.read_text()
533535

534536

535537
def test_enable_qe_uses_wagtail_app_when_stacked(tmp_path):
536-
"""Test that _enable_qe replaces app with medical_records.wagtail when wagtail=True."""
538+
"""Test that _enable_qe replaces app with medical_records.medical_records_wagtail when wagtail=True."""
537539
from dbx_python_cli.commands.project import _enable_qe
538540

539541
settings_dir = tmp_path / "myproject" / "settings"
@@ -543,13 +545,15 @@ def test_enable_qe_uses_wagtail_app_when_stacked(tmp_path):
543545
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
544546
)
545547
qe_file = settings_dir / "qe.py"
546-
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django_only"]\n')
548+
qe_file.write_text(
549+
'QE_INSTALLED_APPS = ["medical_records.medical_records_django"]\n'
550+
)
547551

548552
_enable_qe(tmp_path, "myproject", wagtail=True)
549553

550554
qe_content = qe_file.read_text()
551-
assert '"medical_records.wagtail"' in qe_content
552-
assert '"medical_records.django_only"' not in qe_content
555+
assert '"medical_records.medical_records_wagtail"' in qe_content
556+
assert '"medical_records.medical_records_django"' not in qe_content
553557

554558

555559
def test_create_pyproject_toml_includes_pymongocrypt_when_qe(tmp_path):
@@ -579,10 +583,10 @@ def test_create_pyproject_toml_excludes_pymongocrypt_by_default(tmp_path):
579583

580584

581585
def test_qe_with_medical_records_adds_django_app_to_installed_apps(tmp_path):
582-
"""When --qe and --with medical-records are both used, medical_records.django_only must be in INSTALLED_APPS.
586+
"""When --qe and --with medical-records are both used, medical_records.medical_records_django must be in INSTALLED_APPS.
583587
584588
_enable_qe uncomments the QE import block in the project settings, which adds
585-
QE_INSTALLED_APPS (containing medical_records.django_only) to INSTALLED_APPS.
589+
QE_INSTALLED_APPS (containing medical_records.medical_records_django) to INSTALLED_APPS.
586590
"""
587591
from dbx_python_cli.commands.project import _enable_qe
588592

@@ -594,11 +598,13 @@ def test_qe_with_medical_records_adds_django_app_to_installed_apps(tmp_path):
594598
"# INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405\n"
595599
)
596600
qe_file = settings_dir / "qe.py"
597-
qe_file.write_text('QE_INSTALLED_APPS = ["medical_records.django_only"]\n')
601+
qe_file.write_text(
602+
'QE_INSTALLED_APPS = ["medical_records.medical_records_django"]\n'
603+
)
598604

599605
_enable_qe(tmp_path, "myproject")
600606

601607
settings_content = settings_file.read_text()
602608
assert "from .qe import * # noqa" in settings_content
603609
assert "INSTALLED_APPS += QE_INSTALLED_APPS # noqa: F405" in settings_content
604-
assert '"medical_records.django_only"' in qe_file.read_text()
610+
assert '"medical_records.medical_records_django"' in qe_file.read_text()

0 commit comments

Comments
 (0)