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_title_mx(self): entry = models.Speaker(first_name="Test", last_name="Tester") self.assertEqual(str(entry), '%s %s' % (entry.first_name, entry.last_name)) entry.title = 'mx' self.assertEqual(str(entry), '%s %s' % (entry.first_name, entry.last_name))
def test_string_representation(self): entry = models.Speaker(first_name="Test", last_name="Tester") self.assertEqual(str(entry), '%s %s' % (entry.first_name, entry.last_name)) entry.title = 'mr' self.assertEqual( str(entry), '%s %s %s' % (dict(TITLE_CHOICES)[entry.title], entry.first_name, entry.last_name))
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)