From 46cc3171abb76acbef867cbb048c5445a8488404 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Fri, 29 Dec 2023 13:12:32 +0000 Subject: [PATCH] test(system): test generic shell calls --- tests/test_system.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/test_system.py diff --git a/tests/test_system.py b/tests/test_system.py new file mode 100644 index 0000000..549692e --- /dev/null +++ b/tests/test_system.py @@ -0,0 +1,22 @@ +import pytest +from selfprivacy_api.actions.system import run_blocking, ShellException + +# uname is just an arbitrary command expected to be everywhere we care + + +def test_uname(): + output = run_blocking(["uname"]) + assert output is not None + + +def test_uname_new_session(): + output = run_blocking(["uname"], new_session=True) + assert output is not None + + +def test_uname_nonexistent_args(): + with pytest.raises(ShellException) as exception_info: + # uname: extra operand ‘sldfkjsljf’ + # Try 'uname --help' for more information + run_blocking(["uname", "isdyfhishfaisljhkeysmash"], new_session=True) + assert "extra operand" in exception_info.value.args[0]