Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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()