Skip to content

Commit

Permalink
umu_test: add tests for __main__.main
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Nov 29, 2024
1 parent 7f3f601 commit d9e95b1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions umu/umu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ def tearDown(self):
if self.test_cache_home.exists():
rmtree(self.test_cache_home.as_posix())

def test_main_nomusl(self):
"""Test __main__.main to ensure an exit when on a musl-based system."""
os.environ["LD_LIBRARY_PATH"] = f"{os.environ['LD_LIBRARY_PATH']}:musl"
with self.assertRaises(SystemExit):
__main__.main()

def test_main_noroot(self):
"""Test __main__.main to ensure an exit when run as a privileged user."""
with (
self.assertRaises(SystemExit),
patch.object(os, "geteuid", return_value=0),
):
__main__.main()

def test_restore_umu_cb_false(self):
"""Test _restore_umu when the callback evaluates to False."""
mock_cb = Mock(return_value=False)
Expand Down

0 comments on commit d9e95b1

Please sign in to comment.