Esempio n. 1
0
 def test_emit_game_window_signal(self):
     game_controller = GameController(1, "username")
     game_controller.game = mc.MagicMock().return_value
     game_controller.game.hide = mc.MagicMock()
     game_controller.level_window = mc.MagicMock().return_value
     game_controller.level_window.hide = mc.MagicMock()
     game_controller.game_menu_signal = mc.MagicMock().return_value
     game_controller.game_menu_signal.emit = mc.MagicMock()
     game_controller.emit_game_menu_signal()
     game_controller.game_menu_signal.emit.assert_called_once_with(
         "username")
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)