def test_talk_status(self): speaker = models.Speaker(first_name="Test", last_name="Scheduler") talk = models.Talk(title="Test Talk schedule", primary_speaker=speaker, status=Talk.DRAFT) entry = models.Schedule(start=timezone.now(), duration=0, talk=talk) self.assertRaises(ValidationError, entry.full_clean) talk.status = Talk.APPROVED self.assertTrue(entry.full_clean)
def test_different_speakers(self): speaker1 = models.Speaker(first_name="Test", last_name="Tester") speaker2 = models.Speaker(first_name="Test", last_name="Testovac") talk = models.Talk(title="Test Talk speakers") talk.primary_speaker = speaker1 self.assertTrue(talk.clean) talk.secondary_speaker = speaker2 self.assertTrue(talk.clean) talk.secondary_speaker = speaker1 self.assertRaises(ValidationError, talk.clean)
def test_string_representation(self): entry = models.Talk(title="Test Talk title") self.assertEqual(str(entry), entry.title)