diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-09-11 11:47:16 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-09-11 11:47:16 -0400 |
| commit | c7ca9c7ec2660d279f5e6957ef882390a8783667 (patch) | |
| tree | 4abdc4faf4ab0c7c2e36681fc6c1ba7271305cc2 /tests | |
| parent | 4b7852b153106a487ad8fac654ea59f00aa8a8e4 (diff) | |
| download | decky-lsfg-vk-c7ca9c7ec2660d279f5e6957ef882390a8783667.tar.gz decky-lsfg-vk-c7ca9c7ec2660d279f5e6957ef882390a8783667.zip | |
handle decky uninstall to avoid unlaunchable game wrappers
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_plugin_migration.py | 5 | ||||
| -rw-r--r-- | tests/test_wrapper_service.py | 18 |
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/test_plugin_migration.py b/tests/test_plugin_migration.py index 1a7cb29..fc51470 100644 --- a/tests/test_plugin_migration.py +++ b/tests/test_plugin_migration.py @@ -66,13 +66,14 @@ class PluginMigrationTests(unittest.TestCase): plugin.wrapper_service = Mock() plugin.flatpak_service.remove_plugin_owned_environment.return_value = {"success": True} plugin.configuration_service.reset_all_flatpak_configs.return_value = {"success": True} - plugin.wrapper_service.purge.return_value = {"success": True} + plugin.wrapper_service.neutralize.return_value = {"success": True} asyncio.run(plugin._uninstall()) plugin.flatpak_service.remove_plugin_owned_environment.assert_called_once_with() plugin.configuration_service.reset_all_flatpak_configs.assert_called_once_with() - plugin.wrapper_service.purge.assert_called_once_with() + plugin.wrapper_service.neutralize.assert_called_once_with() + plugin.wrapper_service.purge.assert_not_called() plugin.installation_service.cleanup_on_uninstall.assert_called_once_with() finally: self._restore(previous_decky, previous_tomllib, previous_plugin) diff --git a/tests/test_wrapper_service.py b/tests/test_wrapper_service.py index 20a08ff..46e029b 100644 --- a/tests/test_wrapper_service.py +++ b/tests/test_wrapper_service.py @@ -187,6 +187,24 @@ class WrapperServiceTests(unittest.TestCase): self.assertTrue(self.service.wrapper_path.exists()) self.assertTrue(self.service.sidecar_path.exists()) + def test_neutralize_leaves_dependency_free_passthrough_wrapper(self): + self.service.set("123", self._state()) + response = self.service.neutralize() + self.assertTrue(response["success"]) + self.assertFalse(self.service.sidecar_path.exists()) + self.assertTrue(self.service.wrapper_path.exists()) + content = self.service.wrapper_path.read_text(encoding="utf-8") + self.assertIn(self.service.MARKER, content) + self.assertNotIn("LSFGVK_CONFIG", content) + self.assertEqual(self._run(123, "/usr/bin/printf", "ok").stdout, "ok") + + def test_neutralize_refuses_foreign_wrapper(self): + self.service.wrapper_path.write_text("#!/bin/sh\necho foreign\n", encoding="utf-8") + response = self.service.neutralize() + self.assertFalse(response["success"]) + self.assertIn("unowned", response["error"]) + self.assertEqual(self.service.wrapper_path.read_text(encoding="utf-8"), "#!/bin/sh\necho foreign\n") + if __name__ == "__main__": unittest.main() |
