Esempio n. 1
0
    def test_start_the_game_no_level_provided(self):
        game_controller = GameController(1, "username")
        mocked_game = mc.MagicMock()
        game_controller.create_game = mc.MagicMock(return_value=mocked_game)
        game_controller._connect_signals_to_game = mc.MagicMock()
        game_controller.select_level = mc.MagicMock()
        game_controller.start_the_game()

        game_controller._connect_signals_to_game.assert_called_once_with(
            mocked_game)
        game_controller.select_level.assert_called()
Esempio n. 2
0
    def test_start_the_game_with_level_inserted(self):
        game_controller = GameController(1, "username")
        mocked_game = mc.MagicMock().return_value
        mocked_game.hide = mc.MagicMock()
        game_controller.create_game = mc.MagicMock(return_value=mocked_game)
        game_controller._connect_signals_to_game = mc.MagicMock()
        game_controller.level_window = mc.MagicMock().return_value
        game_controller.level_window.hide = mc.MagicMock()
        game_controller._play_selected_level = mc.MagicMock()
        game_controller.start_the_game(1)

        game_controller._connect_signals_to_game.assert_called_once_with(
            mocked_game)
        game_controller.level_window.hide.assert_called()
        game_controller.game.hide.assert_called()
        game_controller._play_selected_level.assert_called_once_with(1)
Esempio n. 3
0
 def test_create_game(self, mock_method):
     hangman_instance = GameController.create_game(Game.Hangman.value,
                                                   "hello")
     self.assertIsInstance(hangman_instance, hangman.HangmanWindow)