Merge pull request #44 from benfirad/agent/remove-integration-wrapper

Remove macOS command wrapper during integration cleanup
This commit is contained in:
Yusuf İpek
2026-08-18 15:40:47 +03:00
committed by GitHub
2 changed files with 48 additions and 4 deletions
+25
View File
@@ -364,6 +364,12 @@ class MacOS(Home):
mock.patch.object(integrate, "_launchctl_reload"):
return integrate.install(force=force)
def remove(self):
with Frozen("/Applications/Dikte.app/Contents/MacOS/Dikte",
home=self.home, platform="darwin"), \
mock.patch("subprocess.run"):
return integrate.remove()
def test_it_writes_a_login_item_and_the_command(self):
app = self.home / "Applications" / "Dikte.app"
(app / "Contents/MacOS").mkdir(parents=True)
@@ -425,6 +431,25 @@ class MacOS(Home):
self.install(app)
self.assertIn("install-mac.sh", command.read_text())
def test_removing_takes_back_the_login_item_and_command_it_wrote(self):
app = self.home / "Applications" / "Dikte.app"
(app / "Contents/MacOS").mkdir(parents=True)
self.install(app)
command = self.home / ".local/bin/dikte"
self.assertEqual(self.remove(), [self.agent(), command])
self.assertFalse(self.agent().exists())
self.assertFalse(command.exists())
def test_removing_leaves_another_installers_command_alone(self):
command = self.home / ".local/bin/dikte"
command.parent.mkdir(parents=True)
command.write_text("#!/bin/sh\n# Written by install-mac.sh.\n"
"exec /usr/local/bin/python3 /src/__main__.py \"$@\"\n")
self.assertEqual(self.remove(), [])
self.assertIn("install-mac.sh", command.read_text())
if __name__ == "__main__":
unittest.main()