def test_delete_singleton(self): data = {"famous_last_words": []} with self.assertRaises(exceptions.APIError): delete_others(data, FamousLastWords, patient=self.patient, episode=self.episode)
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)
def test_delete_patient_subrecord(self): data = { "patient_colour": [] } delete_others( data, PatientColour, patient=self.patient, episode=self.episode )
def test_delete_non_subrecord(self): data = {"user": []} with self.assertRaises(exceptions.APIError): delete_others(data, User, patient=self.patient, episode=self.episode)
def test_delete_non_subrecord(self): data = { "user": [] } with self.assertRaises(exceptions.APIError): delete_others( data, User, patient=self.patient, episode=self.episode )
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)
def test_delete_singleton(self): data = { "famous_last_words": [] } with self.assertRaises(exceptions.APIError): delete_others( data, FamousLastWords, patient=self.patient, episode=self.episode )