def test_save_tournament(self): tournament = TournamentFactory() th = TournamentHomepage() th.tournament = tournament th.save() self.assertEqual(TournamentHomepage.objects.count(), 1)
def test_save_same_tournament_two_times(self): tournament = TournamentFactory() th = TournamentHomepage() th.tournament = tournament th.save() th = TournamentHomepage() th.tournament = tournament self.assertRaises(ValidationError, th.clean) self.assertEqual(TournamentHomepage.objects.count(), 1)