1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-12-12 09:54:18 +01:00
pwncat/tests/platforms/test_linux.py
2021-04-10 15:52:47 -04:00

17 lines
545 B
Python

#!/usr/bin/env python3
import subprocess
import pytest
def test_linux_popen(session):
# Ensure command output works
id_output_local = subprocess.run(["id"], capture_output=True, text=True)
id_output_remote = session.platform.run(["id"], capture_output=True, text=True)
assert id_output_local.stdout == id_output_remote.stdout
# Ensure we capture the process return code properly
with pytest.raises(subprocess.CalledProcessError):
session.platform.run("echo something | grep nothing", shell=True, check=True)