Ejemplo n.º 1
0
    def test_board_returns_2_dimensional_list(self):
        game = Game()
        board = game.board()

        self.assertTrue(type(board) == list)
        self.assertTrue(type(board[0]) == list)
        self.assertTrue(len(board) == BOARD_SIZE)
        self.assertTrue(len(board[0]) == BOARD_SIZE)
Ejemplo n.º 2
0
    def test_is_users_move_confirms_users_move(self):
        user = User()
        game = Game()

        game.first_player = user
        game.status = "F"

        self.assertTrue(game.is_users_move(user))
Ejemplo n.º 3
0
    def test_is_users_move_stops_wrong_users_move(self):
        user1 = User()
        user2 = User()
        game = Game()

        game.first_player = user1
        game.second_player = user2
        game.status = "F"

        self.assertFalse(game.is_users_move(user2))
Ejemplo n.º 4
0
 def setUp(self):
     game = Game()
     self.move = Move()
     self.move.game = game
Ejemplo n.º 5
0
    def test_get_absolute_url_returns_correct_url(self):
        game = Game()
        game.id = 1
        target = reverse("gameplay_detail", args=[game.id])

        self.assertEqual(game.get_absolute_url(), target)
Ejemplo n.º 6
0
    def test_new_move_prevents_move_in_completed_game(self):
        game = Game()
        game.status = "W"

        self.assertRaises(ValueError, lambda: game.new_move())
Ejemplo n.º 7
0
    def test_new_move_returns_move(self):
        game = Game()
        game.status = "F"

        self.assertTrue(isinstance(game.new_move(), Move))