def test_time_deserialisation(self): _, episode = self.new_patient_and_episode_please() dinner_time = "20:00:00" dinner = Dinner() dinner.update_from_dict(dict(episode_id=episode.id, time=dinner_time), self.user) reloaded = Dinner.objects.get() self.assertEqual(reloaded.time, datetime.time(20))
def test_time_deserialisation(self): _, episode = self.new_patient_and_episode_please() dinner_time = "20:00:00" dinner = Dinner() dinner.update_from_dict(dict( episode_id=episode.id, time=dinner_time ), self.user) reloaded = Dinner.objects.get() self.assertEqual( reloaded.time, datetime.time(20) )
def test_to_dict_has_empty_episode_subrecord_keys(self): name = Dinner.get_api_name() self.assertEqual(0, Dinner.objects.filter(episode=self.episode).count()) as_dict = self.episode.to_dict(self.user) self.assertIn(name, as_dict)