Skip to content

Commit

Permalink
test(test_checks): break prefix checks into separate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harens committed Feb 24, 2023
1 parent 8bf9a1d commit aff6dee
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions tests/clipboard_tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,55 @@
def test_user_path(fake_process: FakeProcess) -> None:
# Port prefix
fake_process.register_subprocess(
["/usr/bin/which", "port"], stdout=["/opt/local/bin/port\n"], occurrences=5
["/usr/bin/which", "port"], stdout=["/opt/local/bin/port\n"]
)

assert user_path(True) == "/opt/local/bin"


@beartype
def test_first_party_path(fake_process: FakeProcess) -> None:
fake_process.register_subprocess(
["/usr/bin/which", "port"], stdout=["/opt/local/bin/port\n"]
)

# Default prefix (first party tools)
assert user_path() == "/usr/bin"

# Third party tool prefixes

# If installed by MacPorts
@beartype
def test_macports_install_path(fake_process: FakeProcess) -> None:
fake_process.register_subprocess(
["/usr/bin/which", "port"], stdout=["/opt/local/bin/port\n"]
)

fake_process.register_subprocess(
["/usr/bin/which", "seaport"], stdout=["/opt/local/bin/seaport\n"]
)

assert user_path(False, True) == "/opt/local/bin"

# If installed by Homebrew

@beartype
def test_homebrew_install_path(fake_process: FakeProcess) -> None:
fake_process.register_subprocess(
["/usr/bin/which", "port"], stdout=["/opt/local/bin/port\n"]
)

fake_process.register_subprocess(
["/usr/bin/which", "seaport"], stdout=["/usr/local/bin/seaport\n"]
)

assert user_path(False, True) == "/usr/local/bin"

# Poetry example (should default to MacPorts)

@beartype
def test_poetry_install_path(fake_process: FakeProcess) -> None:
fake_process.register_subprocess(
["/usr/bin/which", "port"], stdout=["/opt/local/bin/port\n"]
)

# Poetry example (should default to MacPorts)
fake_process.register_subprocess(
["/usr/bin/which", "seaport"],
stdout=[
Expand Down

0 comments on commit aff6dee

Please sign in to comment.