Skip to content

Commit

Permalink
update tests for changes in edc-visit-tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Jul 4, 2018
1 parent 616415b commit d6095bb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ class VisitScheduleMethodsModelMixin(models.Model):

@property
def visit(self):
"""Returns the visit object from the schedule object
for this visit code.
Note: This is not a model instance.
"""
return self.schedule.visits.get(self.visit_code)

@property
def visits(self):
"""Returns all visit objects from the schedule object.
"""
return self.schedule.visits

@property
Expand Down
2 changes: 1 addition & 1 deletion edc_visit_schedule/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
'edc_timepoint.apps.AppConfig',
'edc_protocol.apps.AppConfig',
'edc_metadata.apps.AppConfig',
'edc_visit_tracking.apps.AppConfig',
'edc_visit_schedule.apps.EdcAppointmentAppConfig',
'edc_visit_schedule.apps.EdcVisitTrackingAppConfig',
'edc_visit_schedule.apps.EdcFacilityAppConfig',
'edc_visit_schedule.apps.AppConfig',
]
Expand Down
6 changes: 2 additions & 4 deletions edc_visit_schedule/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
from edc_appointment.models import Appointment
from edc_base import get_utcnow
from edc_base.model_mixins import BaseUuidModel
from edc_visit_tracking.model_mixins import CrfModelMixin
from edc_visit_tracking.model_mixins import CrfModelMixin, VisitModelMixin
from edc_identifier.model_mixins import NonUniqueSubjectIdentifierFieldMixin
from edc_registration.model_mixins import UpdatesOrCreatesRegistrationModelMixin

from ..model_mixins import SubjectScheduleCrfModelMixin
from ..model_mixins import OffScheduleModelMixin, OnScheduleModelMixin
from ..model_mixins import VisitScheduleFieldsModelMixin, VisitScheduleMethodsModelMixin


class SubjectVisit(VisitScheduleFieldsModelMixin,
VisitScheduleMethodsModelMixin, BaseUuidModel):
class SubjectVisit(VisitModelMixin, BaseUuidModel):

appointment = models.OneToOneField(Appointment, on_delete=PROTECT)

Expand Down
1 change: 0 additions & 1 deletion edc_visit_schedule/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def test_crf(self):
offschedule_datetime=appointment.appt_datetime)
self.assertEqual(Appointment.objects.all().count(), 1)

@tag('1')
def test_onschedules_manager(self):
"""Assert can enter a CRF.
"""
Expand Down
4 changes: 2 additions & 2 deletions edc_visit_schedule/tests/test_visit_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from dateutil.relativedelta import relativedelta
from django.test import TestCase, tag
from edc_appointment.models import Appointment
from edc_base.tests.site_test_case_mixin import SiteTestCaseMixin
from edc_base.utils import get_utcnow
from edc_facility.import_holidays import import_holidays
from edc_registration.models import RegisteredSubject

from ..constants import ON_SCHEDULE
Expand All @@ -16,8 +18,6 @@
from ..visit_schedule import VisitScheduleNameError, AlreadyRegisteredSchedule
from .models import OnSchedule, OnScheduleThree, OffSchedule
from .models import SubjectVisit, SubjectConsent
from edc_base.tests.site_test_case_mixin import SiteTestCaseMixin
from edc_facility.import_holidays import import_holidays


class TestVisitSchedule(SiteTestCaseMixin, TestCase):
Expand Down
6 changes: 2 additions & 4 deletions edc_visit_schedule/tests/visit_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,15 @@
visit_schedule = VisitSchedule(
name='visit_schedule',
offstudy_model='edc_visit_schedule.subjectoffstudy',
death_report_model='edc_visit_schedule.deathreport',
visit_model='edc_visit_schedule.subjectvisit')
death_report_model='edc_visit_schedule.deathreport')

visit_schedule.add_schedule(schedule)


visit_schedule2 = VisitSchedule(
name='visit_schedule2',
offstudy_model='edc_visit_schedule.subjectoffstudy2',
death_report_model='edc_visit_schedule.deathreport',
visit_model='edc_visit_schedule.subjectvisit')
death_report_model='edc_visit_schedule.deathreport')


schedule2 = Schedule(
Expand Down

0 comments on commit d6095bb

Please sign in to comment.