Skip to content

Commit

Permalink
update test settings
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Nov 27, 2024
1 parent ad5e137 commit 42439ef
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 142 deletions.
3 changes: 3 additions & 0 deletions data_manager_app/consents.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from edc_constants.constants import FEMALE, MALE
from edc_protocol.research_protocol_config import ResearchProtocolConfig

site_consents.registry = {}
site_consents.loaded = False

consent_v1 = ConsentDefinition(
"data_manager_app.subjectconsentv1",
version="1",
Expand Down
57 changes: 0 additions & 57 deletions data_manager_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

from django.db import models
from django.db.models.deletion import PROTECT
from edc_adverse_event.model_mixins import (
AeFollowupModelMixin,
AeInitialModelMixin,
AesiModelMixin,
AeSusarModelMixin,
AeTmgModelMixin,
DeathReportModelMixin,
DeathReportTmgModelMixin,
)
from edc_appointment.models import Appointment
from edc_consent.field_mixins import PersonalFieldsMixin
from edc_consent.field_mixins.identity_fields_mixin import IdentityFieldsMixin
Expand Down Expand Up @@ -194,51 +185,3 @@ class RedirectModel(BaseUuidModel):

class RedirectNextModel(BaseUuidModel):
subject_identifier = models.CharField(max_length=25)


class AeInitial(AeInitialModelMixin, BaseUuidModel):
class Meta(AeInitialModelMixin.Meta):
pass


class AeFollowup(AeFollowupModelMixin, BaseUuidModel):
ae_initial = models.ForeignKey(AeInitial, on_delete=PROTECT)

class Meta(AeFollowupModelMixin.Meta):
pass


class Aesi(AesiModelMixin, BaseUuidModel):
ae_initial = models.ForeignKey(AeInitial, on_delete=PROTECT)

class Meta(AesiModelMixin.Meta):
pass


class AeSusar(AeSusarModelMixin, BaseUuidModel):
ae_initial = models.ForeignKey(AeInitial, on_delete=PROTECT)

class Meta(AeSusarModelMixin.Meta):
pass


class AeTmg(AeTmgModelMixin, BaseUuidModel):
ae_initial = models.ForeignKey(AeInitial, on_delete=PROTECT)

class Meta(AeTmgModelMixin.Meta):
pass


class DeathReport(DeathReportModelMixin, BaseUuidModel):
class Meta(DeathReportModelMixin.Meta):
pass


class DeathReportTmg(DeathReportTmgModelMixin, BaseUuidModel):
class Meta(DeathReportTmgModelMixin.Meta):
pass


class DeathReportTmgSecond(DeathReportTmgModelMixin, BaseUuidModel):
class Meta(DeathReportTmgModelMixin.Meta):
pass
90 changes: 5 additions & 85 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,89 +1,9 @@
#!/usr/bin/env python
import logging
from pathlib import Path

from edc_test_utils import DefaultTestSettings, func_main

app_name = "edc_data_manager"
base_dir = Path(__file__).absolute().parent

project_settings = DefaultTestSettings(
calling_file=__file__,
APP_NAME=app_name,
BASE_DIR=base_dir,
ETC_DIR=str(base_dir / app_name / "tests" / "etc"),
SILENCED_SYSTEM_CHECKS=["sites.E101", "edc_navbar.E002", "edc_navbar.E003"],
DATA_DICTIONARY_APP_LABELS=["data_manager_app", "edc_offstudy", "edc_registration"],
SUBJECT_CONSENT_MODEL="data_manager_app.subjectconsent",
SUBJECT_VISIT_MODEL="data_manager_app.subjectvisit",
SUBJECT_VISIT_MISSED_MODEL="data_manager_app.subjectvisitmissed",
SUBJECT_REQUISITION_MODEL="data_manager_app.subjectrequisition",
ADVERSE_EVENT_ADMIN_SITE="data_manager_app_admin",
ADVERSE_EVENT_APP_LABEL="data_manager_app",
CELERY_ENABLED=False,
DATA_MANAGER_ENABLED=True,
EDC_NAVBAR_DEFAULT="edc_data_manager",
EDC_AUTH_CODENAMES_WARN_ONLY=True,
EDC_AUTH_SKIP_SITE_AUTHS=True,
EDC_AUTH_SKIP_AUTH_UPDATER=True,
INSTALLED_APPS=[
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django_crypto_fields.apps.AppConfig",
"django_revision.apps.AppConfig",
"multisite.apps.AppConfig",
"edc_sites.apps.AppConfig",
"edc_appointment.apps.AppConfig",
"edc_action_item.apps.AppConfig",
"edc_adverse_event.apps.AppConfig",
"edc_consent.apps.AppConfig",
"edc_crf.apps.AppConfig",
"edc_dashboard.apps.AppConfig",
"edc_export.apps.AppConfig",
"edc_lab_dashboard.apps.AppConfig",
"edc_device.apps.AppConfig",
"edc_identifier.apps.AppConfig",
"edc_facility.apps.AppConfig",
"edc_form_runners.apps.AppConfig",
"edc_lab.apps.AppConfig",
"edc_list_data.apps.AppConfig",
"edc_listboard.apps.AppConfig",
"edc_locator.apps.AppConfig",
"edc_navbar.apps.AppConfig",
"edc_model_admin.apps.AppConfig",
"edc_notification.apps.AppConfig",
"edc_metadata.apps.AppConfig",
"edc_offstudy.apps.AppConfig",
"edc_protocol.apps.AppConfig",
"edc_randomization.apps.AppConfig",
"edc_pharmacy.apps.AppConfig",
"edc_registration.apps.AppConfig",
"edc_review_dashboard.apps.AppConfig",
"edc_subject_dashboard.apps.AppConfig",
"edc_timepoint.apps.AppConfig",
"edc_visit_schedule.apps.AppConfig",
"edc_visit_tracking.apps.AppConfig",
"edc_data_manager.apps.AppConfig",
"data_manager_app.apps.AppConfig",
"edc_auth.apps.AppConfig",
"edc_appconfig.apps.AppConfig",
],
add_dashboard_middleware=True,
use_test_urls=True,
add_lab_dashboard_middleware=True,
excluded_apps=["adverse_event_app.apps.AppConfig"],
).settings


def main():
func_main(project_settings, f"{app_name}.tests")

from edc_test_settings.func_main import func_main2

if __name__ == "__main__":
logging.basicConfig()
main()
func_main2(
"tests.test_settings",
"edc_data_manager.tests",
)
Empty file added tests/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python
import sys
from pathlib import Path

from edc_test_settings.default_test_settings import DefaultTestSettings

app_name = "edc_data_manager"
base_dir = Path(__file__).absolute().parent.parent

project_settings = DefaultTestSettings(
calling_file=__file__,
DJANGO_CRYPTO_FIELDS_KEY_PATH=base_dir / "tests" / "etc",
SILENCED_SYSTEM_CHECKS=[
"edc_sites.E001",
"edc_sites.E002",
"sites.E101",
"edc_navbar.E002",
"edc_navbar.E003",
],
EDC_AUTH_CODENAMES_WARN_ONLY=True,
EDC_AUTH_SKIP_SITE_AUTHS=True,
EDC_AUTH_SKIP_AUTH_UPDATER=True,
BASE_DIR=base_dir,
APP_NAME=app_name,
SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit",
add_dashboard_middleware=True,
add_lab_dashboard_middleware=True,
use_test_urls=True,
EXTRA_INSTALLED_APPS=["data_manager_app.apps.AppConfig"],
).settings

for k, v in project_settings.items():
setattr(sys.modules[__name__], k, v)

0 comments on commit 42439ef

Please sign in to comment.