Initial commit
This commit is contained in:
27
tests/test_pyobjc_surface.py
Normal file
27
tests/test_pyobjc_surface.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import platform
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from applepy.checks.pyobjc_surface import check_running_applications_native
|
||||
from applepy.context import RunContext
|
||||
|
||||
|
||||
def test_non_macos_finding(tmp_path: Path) -> None:
|
||||
if platform.system() == "Darwin":
|
||||
pytest.skip("macOS uses objc-003/objc-002 path")
|
||||
ctx = RunContext(home=tmp_path, output_dir=tmp_path, phase="unprivileged")
|
||||
out = check_running_applications_native(ctx)
|
||||
assert len(out) == 1
|
||||
assert out[0].id == "objc-001"
|
||||
assert "Darwin" in out[0].description or "macOS" in out[0].description
|
||||
|
||||
|
||||
@pytest.mark.skipif(platform.system() != "Darwin", reason="PyObjC AppKit only on macOS")
|
||||
def test_macos_returns_workspace_or_import_finding(tmp_path: Path) -> None:
|
||||
ctx = RunContext(home=tmp_path, output_dir=tmp_path, phase="unprivileged")
|
||||
out = check_running_applications_native(ctx)
|
||||
assert len(out) == 1
|
||||
assert out[0].id in ("objc-002", "objc-003")
|
||||
if out[0].id == "objc-003":
|
||||
assert "NSWorkspace" in out[0].evidence
|
||||
assert "\t" in out[0].evidence or "bundle_id" in out[0].evidence
|
||||
Reference in New Issue
Block a user