示例#1
0
 def test_patient_from_pk(self):
     patient, _ = self.new_patient_and_episode_please()
     some_func = MagicMock()
     request = MagicMock()
     some_self = MagicMock()
     decorated = api.patient_from_pk(some_func)
     decorated(some_self, request, patient.id)
     some_func.assert_called_once_with(some_self, request, patient)
示例#2
0
 def test_patient_from_pk(self):
     patient, _ = self.new_patient_and_episode_please()
     some_func = MagicMock()
     request = MagicMock()
     some_self = MagicMock()
     decorated = api.patient_from_pk(some_func)
     decorated(some_self, request, patient.id)
     some_func.assert_called_once_with(some_self, request, patient)
示例#3
0
 def test_no_patient_exists_exception(self):
     self.assertEqual(models.Patient.objects.count(), 0)
     with self.assertRaises(Http404) as e:
         some_func = MagicMock()
         request = MagicMock()
         some_self = MagicMock()
         decorated = api.patient_from_pk(some_func)
         decorated(some_self, request, 1)
     self.assertEqual(str(e.exception),
                      "No Patient matches the given query.")
示例#4
0
 def test_no_patient_exists_exception(self):
     self.assertEqual(models.Patient.objects.count(), 0)
     with self.assertRaises(Http404) as e:
         some_func = MagicMock()
         request = MagicMock()
         some_self = MagicMock()
         decorated = api.patient_from_pk(some_func)
         decorated(some_self, request, 1)
     self.assertEqual(
         str(e.exception),
         "No Patient matches the given query."
     )