Ejemplo n.º 1
0
 def test_reject_play_game(self, mock_method):
     button_shooter = ButtonShooterWindow("username")
     button_shooter.initialize_game = mock.MagicMock()
     button_shooter.show = mock.MagicMock()
     button_shooter.required_targets = 100
     button_shooter.show_start_screen = mock.MagicMock(
         return_value=QMessageBox.RejectRole)
     button_shooter.emit_game_menu_signal = mock.MagicMock()
     button_shooter.play_game(1)
     button_shooter.emit_game_menu_signal.assert_called()
Ejemplo n.º 2
0
 def test_play_game(self, mock_method):
     button_shooter = ButtonShooterWindow("username")
     button_shooter.initialize_game = mock.MagicMock()
     button_shooter.show = mock.MagicMock()
     button_shooter.required_targets = 100
     button_shooter.show_start_screen = mock.MagicMock(
         return_value=QMessageBox.AcceptRole)
     button_shooter.timer = mock.MagicMock()
     button_shooter.timer.start = mock.MagicMock()
     button_shooter.show_buttons = mock.MagicMock()
     button_shooter.play_game(1)
     button_shooter.show_buttons.assert_called()
Ejemplo n.º 3
0
    def test_end_of_game3(self):
        button_shooter = ButtonShooterWindow("username")
        button_shooter.update_values = mock.MagicMock()
        button_shooter.hit_targets = 2000
        button_shooter.required_targets = 2000
        button_shooter.unlock_next_level = mock.MagicMock()
        button_shooter.show_selection_for_next_game = mock.MagicMock(
            return_value=QMessageBox.RejectRole)
        button_shooter.game_database.save_user_data = mock.MagicMock()
        button_shooter.emit_play_next_level_signal = mock.MagicMock()
        button_shooter.end_the_game()

        button_shooter.emit_play_next_level_signal.assert_called()
Ejemplo n.º 4
0
    def test_end_of_game1(self, mock_method):
        button_shooter = ButtonShooterWindow("username")
        button_shooter.update_values = mock.MagicMock()
        button_shooter.hit_targets = 2000
        button_shooter.required_targets = 2000
        button_shooter.selected_level = button_shooter.max_level
        button_shooter.show_every_level_completed = mock.MagicMock()
        button_shooter.emit_game_menu_signal = mock.MagicMock()

        button_shooter.end_the_game()

        button_shooter.show_every_level_completed.assert_called()
        button_shooter.emit_game_menu_signal.assert_called()
Ejemplo n.º 5
0
    def test_end_of_game_losing(self):
        button_shooter = ButtonShooterWindow("username")
        button_shooter.update_values = mock.MagicMock()
        button_shooter.hit_targets = 200
        button_shooter.required_targets = 2000
        button_shooter.game_database.save_user_data = mock.MagicMock()
        button_shooter.emit_level_menu_signal = mock.MagicMock()

        button_shooter.show_losing_screen = mock.MagicMock(
            return_value=QMessageBox.DestructiveRole)
        button_shooter.end_the_game()
        button_shooter.emit_level_menu_signal.assert_called()

        button_shooter.emit_game_menu_signal = mock.MagicMock()
        button_shooter.show_losing_screen = mock.MagicMock(
            return_value=QMessageBox.AcceptRole)
        button_shooter.end_the_game()
        button_shooter.emit_game_menu_signal.assert_called()

        button_shooter.emit_play_level_again_signal = mock.MagicMock()
        button_shooter.show_losing_screen = mock.MagicMock(
            return_value=QMessageBox.RejectRole)
        button_shooter.end_the_game()
        button_shooter.emit_play_level_again_signal.assert_called()