Skip to content

Commit d4321f8

Browse files
committed
Test for appointment status bar
1 parent b0e21b2 commit d4321f8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

manage_breast_screening/participants/tests/factories.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ def current_status(obj, create, extracted, **kwargs):
160160
AppointmentStatusFactory.create(state=extracted, appointment=obj)
161161
)
162162

163+
# Allow passing an explicit status and created_by user
164+
# e.g. `current_status_params={'state': AppointmentStatus.IN_PROGRESS, 'created_by': self.current_user}`
165+
@post_generation
166+
def current_status_params(obj, create, extracted, **kwargs):
167+
if not create or not extracted:
168+
return
169+
obj.statuses.add(AppointmentStatusFactory.create(appointment=obj, **extracted))
170+
163171

164172
class AppointmentNoteFactory(DjangoModelFactory):
165173
class Meta:

0 commit comments

Comments
 (0)