Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Jan 26, 2024
1 parent 16bccbd commit 7fea412
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
10 changes: 0 additions & 10 deletions edc_identifier/apps.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys

from django.apps import AppConfig as DjangoAppConfig
from django.conf import settings


class AppConfig(DjangoAppConfig):
Expand All @@ -17,12 +16,3 @@ def ready(self):
sys.stdout.write(f" * check-digit modulus: {self.identifier_modulus}\n")
sys.stdout.write(f" Done loading {self.verbose_name}\n")
self.messages_written = True


if settings.APP_NAME == "edc_identifier":
from edc_device.apps import AppConfig as BaseEdcDeviceAppConfig
from edc_device.constants import CLIENT

class EdcDeviceAppConfig(BaseEdcDeviceAppConfig):
device_role = CLIENT
device_id = "14"
4 changes: 2 additions & 2 deletions edc_identifier/subject_identifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.apps import apps as django_apps
from edc_registration import get_registered_subject_model_cls
from edc_utils import get_utcnow

from .research_identifier import ResearchIdentifier
Expand All @@ -20,7 +20,7 @@ def post_identifier(self) -> None:
"""Creates a registered subject instance for this
subject identifier.
"""
model = django_apps.get_app_config("edc_registration").model
model = get_registered_subject_model_cls()
model.objects.create(
subject_identifier=self.identifier,
site=self.site,
Expand Down
9 changes: 4 additions & 5 deletions edc_identifier/tests/test_subject_identifier.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest.case import skip

from django.test import TestCase
from django.test import TestCase, override_settings
from faker import Faker

from edc_identifier.exceptions import IdentifierError, SubjectIdentifierError
Expand Down Expand Up @@ -70,16 +70,15 @@ def test_create1(self):
)
self.assertEqual("000-1990001-8", subject_identifier.identifier)

@override_settings(SITE_ID=1)
def test_create2(self):
"""Asserts exact first identifier required parameters
and those fetched from edc-example.AppConfig.
"""
"""Asserts exact first identifier required parameters"""
subject_identifier = SubjectIdentifier(
identifier_type="subject",
requesting_model="edc_identifier.enrollment",
protocol_number="000",
)
self.assertEqual("000-1140001-7", subject_identifier.identifier)
self.assertEqual("000-1990001-8", subject_identifier.identifier)

@skip("enrollment cap not implemented")
def test_create_hits_cap(self):
Expand Down
2 changes: 1 addition & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"django.contrib.sites",
"django_crypto_fields.apps.AppConfig",
"edc_action_item.apps.AppConfig",
"edc_device.apps.AppConfig",
"edc_randomization.apps.AppConfig",
"edc_sites.apps.AppConfig",
"edc_notification.apps.AppConfig",
Expand All @@ -31,7 +32,6 @@
"edc_registration.apps.AppConfig",
"edc_visit_schedule.apps.AppConfig",
"edc_visit_tracking.apps.AppConfig",
"edc_identifier.apps.EdcDeviceAppConfig",
"edc_identifier.apps.AppConfig",
],
add_dashboard_middleware=True,
Expand Down

0 comments on commit 7fea412

Please sign in to comment.