Skip to content

Commit

Permalink
Test the ordering of bulk update explicitly in it's own test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller committed Apr 21, 2017
1 parent ec713a2 commit 957b85d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion opal/tests/test_models.py
Expand Up @@ -74,9 +74,27 @@ def test_bulk_update_patient_subrecords(self):

colours = patient.patientcolour_set.all()
self.assertEqual(len(colours), 2)
self.assertTrue(patient.episode_set.exists())

def test_bulk_update_patient_subrecords_respects_order(self):
patient = models.Patient()

d = {
"demographics": [{
"first_name": "Samantha",
"surname": "Sun",
"hospital_number": "123312"
}],
"patient_colour": [
{"name": "green"},
{"name": "purple"},
]
}
patient.bulk_update(d, self.user)
colours = patient.patientcolour_set.all()
self.assertEqual(colours[0].name, "green")
self.assertEqual(colours[1].name, "purple")
self.assertTrue(patient.episode_set.exists())


def test_bulk_update_with_existing_patient_episode(self):
original_patient = models.Patient()
Expand Down

0 comments on commit 957b85d

Please sign in to comment.