def test_update_values_is_false(self, mock_method): button_shooter = ButtonShooterWindow("username") button_shooter.game_database = mock.MagicMock() button_shooter.game_database.get_values = mock.MagicMock( return_value={"hit_targets": 150}) button_shooter.game_database.update_values = mock.MagicMock() button_shooter.hit_targets = 100 button_shooter.update_values() button_shooter.game_database.update_values.assert_called_once_with({})
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()
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()
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()