Skip to content

Commit

Permalink
umu_test: add test for create_shim
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Nov 14, 2024
1 parent 98fe341 commit b74c942
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions umu/umu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,26 @@ def test_create_shim_exe(self):
os.access(shim, os.X_OK), f"Expected '{shim}' to be executable"
)

def test_create_shim_none(self):
"""Test create_shim when not passed a Path."""
shim = None

# When not passed a Path, the function should default to creating $HOME/.local/share/umu/umu-shim
with (
TemporaryDirectory() as tmp,
patch.object(Path, "joinpath", return_value=Path(tmp, "umu-shim")),
):
umu_runtime.create_shim()
self.assertTrue(
Path(tmp, "umu-shim").is_file(),
f"Expected '{shim}' to be a file",
)
# Ensure there's data
self.assertTrue(
Path(tmp, "umu-shim").stat().st_size > 0,
f"Expected '{shim}' to have data",
)

def test_create_shim(self):
"""Test create_shim."""
shim = None
Expand Down

0 comments on commit b74c942

Please sign in to comment.