Beispiel #1
0
 def test_delete_singleton(self):
     data = {"famous_last_words": []}
     with self.assertRaises(exceptions.APIError):
         delete_others(data,
                       FamousLastWords,
                       patient=self.patient,
                       episode=self.episode)
Beispiel #2
0
 def test_delete_episode_subrecord(self):
     data = {
         "colour": []
     }
     delete_others(data, Colour, patient=self.patient, episode=self.episode)
     self.assertEqual(self.episode.colour_set.count(), 0)
     self.assertEqual(Colour.objects.get().id, self.other_colour.id)
Beispiel #3
0
 def test_delete_patient_subrecord(self):
     data = {
         "patient_colour": []
     }
     delete_others(
         data, PatientColour, patient=self.patient, episode=self.episode
     )
Beispiel #4
0
 def test_delete_non_subrecord(self):
     data = {"user": []}
     with self.assertRaises(exceptions.APIError):
         delete_others(data,
                       User,
                       patient=self.patient,
                       episode=self.episode)
Beispiel #5
0
 def test_delete_episode_subrecord(self):
     data = {
         "colour": []
     }
     delete_others(data, Colour, patient=self.patient, episode=self.episode)
     self.assertEqual(self.episode.colour_set.count(), 0)
     self.assertEqual(Colour.objects.get().id, self.other_colour.id)
Beispiel #6
0
 def test_delete_patient_subrecord(self):
     data = {
         "patient_colour": []
     }
     delete_others(
         data, PatientColour, patient=self.patient, episode=self.episode
     )
Beispiel #7
0
 def test_delete_non_subrecord(self):
     data = {
         "user": []
     }
     with self.assertRaises(exceptions.APIError):
         delete_others(
             data, User, patient=self.patient, episode=self.episode
         )
Beispiel #8
0
 def test_dont_delete_episode_subrecord(self):
     data = {
         "colour": [
             dict(name="red", id=self.existing_colour.id),
         ]
     }
     delete_others(data, Colour, patient=self.patient, episode=self.episode)
     only_colour = self.episode.colour_set.get()
     self.assertEqual(only_colour.id, self.existing_colour.id)
     other = Colour.objects.exclude(id=self.existing_colour.id).get()
     self.assertEqual(other.id, self.other_colour.id)
Beispiel #9
0
 def test_delete_singleton(self):
     data = {
         "famous_last_words": []
     }
     with self.assertRaises(exceptions.APIError):
         delete_others(
             data,
             FamousLastWords,
             patient=self.patient,
             episode=self.episode
         )
Beispiel #10
0
 def test_dont_delete_episode_subrecord(self):
     data = {
         "colour": [
             dict(name="red", id=self.existing_colour.id),
         ]
     }
     delete_others(data, Colour, patient=self.patient, episode=self.episode)
     only_colour = self.episode.colour_set.get()
     self.assertEqual(only_colour.id, self.existing_colour.id)
     other = Colour.objects.exclude(id=self.existing_colour.id).get()
     self.assertEqual(other.id, self.other_colour.id)