def test_invalid_duplicate_games(self): a_player = Player.objects.create() Game.objects.create(player=a_player, text="bla") with self.assertRaises(ValidationError): game = Game(player=a_player, text="bla") game.full_clean()
def test_allows_duplicate_games_different_players(self): player_1 = Player.objects.create() player_2 = Player.objects.create() Game.objects.create(player=player_1, text="bla") game = Game(player=player_2, text="bla") game.full_clean() # should not raise
def test_doesnt_save_empty_games(self): a_player = Player.objects.create() a_game = Game(player=a_player, text="") with self.assertRaises(ValidationError): a_game.save() a_game.full_clean()