def test_moves(self): game = Game() game.save() self.used_game_ids.append(game.id) moves = ['e4', 'e5', 'Nf3', 'Nc6'] game.moves = moves game.save() game.refresh() self.assertEqual(game.moves, moves)
def test_get_board(self): game = Game() game.save() self.used_game_ids.append(game.id) moves = ['e4', 'e5', 'Nf3', 'Nc6'] expected_board = Board() for move in moves: expected_board.push_san(move) game.moves = moves game.save() game.refresh() self.assertEqual(game.get_board(), expected_board)
def test_total_time_and_black_clock_and_white_clock(self): game = Game() game.save() self.used_game_ids.append(game.id) total_time = timedelta(seconds=30, microseconds=13231) game.total_time = total_time black_clock = timedelta(seconds=310, microseconds=321312) game.black_clock = black_clock white_clock = timedelta(seconds=312, microseconds=31231) game.white_clock = white_clock game.save() game.refresh() self.assertEqual(game.total_time, total_time) self.assertEqual(game.black_clock, black_clock) self.assertEqual(game.white_clock, white_clock)