Skip to content

Commit

Permalink
WIP: no with proper fixture and more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ejoerns committed Nov 3, 2023
1 parent 40826f5 commit 6b0f10f
Showing 1 changed file with 40 additions and 17 deletions.
57 changes: 40 additions & 17 deletions test/test_rauc_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,36 +83,59 @@ def test_rauc_status_no_service_output_nvalid():
# wait ${RAUC_DBUS_SERVICE_PID}
# }

import time
import subprocess

def test_rauc_status(rauc_service):
from pydbus import SessionBus

import subprocess

@pytest.fixture
def rauc_dbus_service():
service = subprocess.Popen('rauc service --conf=test.conf '
'--override-boot-slot=system0 -d'.split())

from pydbus import SessionBus
bus = SessionBus()

# Create an object that will proxy for a particular remote object.
rauc = bus.get(
"de.pengutronix.rauc", # Bus name
"/" # Object path
)
# Wait for de.pengutronix.rauc to appear on the bus
timeout = time.monotonic() + 5.0
while True:
try:
bus.get("de.pengutronix.rauc", "/")
break
except Exception:
if time.monotonic() > timeout:
raise

print("Proxy set up")
yield

# Introspection returns an XML document containing information
# about the methods supported by an interface.
print("Introspection data:\n")
print(rauc.GetSlotStatus())
service.kill()

out, err = service.communicate()

print(out)
print(err)
print(service.returncode)
def test_rauc_status(rauc_service, rauc_dbus_service):

# Test callling 'rauc status'
out, err, exitcode = run("rauc status")

assert exitcode == 0
assert out.startswith("=== System Info ===")


def test_rauc_status_readable(rauc_service, rauc_dbus_service):

# Test callling 'rauc status'
out, err, exitcode = run("rauc status --detailed --output-format=readable")

assert exitcode == 0
assert out.startswith("=== System Info ===")


def test_rauc_status_shell(rauc_service, rauc_dbus_service):

# Test callling 'rauc status'
out, err, exitcode = run("rauc status --detailed --output-format=shell")

assert exitcode == 0
assert out.startswith("RAUC_SYSTEM_COMPATIBLE='Test Config'")

"""
Expand Down

0 comments on commit 6b0f10f

Please sign in to comment.