def test_skip(self): _, mock_view, _ = self.make_all_mocks() mock_level0 = Mock() mock_levels = [mock_level0] game = Sokoban(mock_levels) game.handle_key(Key.SKIP) self.assertEqual(mock_view.setup_world.call_count, 2)
def test_quit(self): _, mock_view, _ = self.make_all_mocks() mock_level0 = Mock() mock_levels = [mock_level0] game = Sokoban(mock_levels) game.handle_key(Key.QUIT) mock_view.quit.assert_called_with()
def test_game_over(self): mock_engine, mock_view, _ = self.make_all_mocks() mock_level0 = Mock() mock_levels = [mock_level0] game = Sokoban(mock_levels) mock_engine.is_game_over.return_value = True game.handle_key(Key.UP) self.assertEqual(mock_view.setup_world.call_count, 2)
def test_move_right(self): mock_engine, mock_view, mock_world = self.make_all_mocks() mock_level0 = Mock() mock_levels = [mock_level0] game = Sokoban(mock_levels) game.handle_key(Key.RIGHT) mock_engine.move.assert_called_with(Dir.RT, mock_world) mock_view.show_world.assert_called_with(mock_world)