def setUp(self): self.user = User.objects.create(username='******', email='test@localhost', password='******') self.user2 = User.objects.create(username='******', email='test2@localhost', password='******') self.user3 = User.objects.create(username='******', email='test3@localhost', password='******') self.game = Game.new_game(name='test', user=self.user, player_name='storyteller') self.current = self.game.current_round self.player2 = self.game.add_player(self.user2, 'player2') self.player3 = self.game.add_player(self.user3, 'player3')
def test_started_game_without_players_is_abandoned(self): g = Game.new_game(name='test', user=self.user, player_name='storyteller') storyteller = g.current_round.turn Play.play_for_round(g.current_round, storyteller, storyteller._pick_card(), 'story') player2 = g.add_player(self.user2, 'player2') Play.play_for_round(g.current_round, player2, player2._pick_card()) g.players.all().delete() self.assertEqual(g.status, GameStatus.ABANDONED)
def setUp(self): self.user = User.objects.create(username='******', email='test@localhost', password='******') self.user2 = User.objects.create(username='******', email='test2@localhost', password='******') self.game = Game.new_game(name='test', user=self.user, player_name='storyteller') self.player2 = self.game.add_player(self.user2, 'player2')
def setUp(self): self.user = User.objects.create(username='******', email='test@localhost', password='******') self.user2 = User.objects.create(username='******', email='test2@localhost', password='******') self.user3 = User.objects.create(username='******', email='test3@localhost', password='******') self.user4 = User.objects.create(username='******', email='test4@localhost', password='******') self.game = Game.new_game(name='test', user=self.user, player_name='storyteller') self.current = self.game.current_round self.player2 = self.game.add_player(self.user2, 'player2') self.player3 = self.game.add_player(self.user3, 'player3')
def test_bootstrapped_game_is_new(self): g = Game.new_game(name='test', user=self.user, player_name='storyteller') self.assertEqual(g.status, GameStatus.NEW)
def test_bootstrapped_game_has_player_and_round(self): g = Game.new_game(name='test', user=self.user, player_name='storyteller') self.assertEqual(g.players.count(), 1) self.assertTrue(g.current_round is not None)
def test_new_game_is_new(self): g = Game(name='test') self.assertEqual(g.status, GameStatus.NEW)