From 698a9a770b3a0de3ade232bf5d40fdd814615354 Mon Sep 17 00:00:00 2001 From: wolfyeva Date: Thu, 9 Jun 2022 03:06:51 +0800 Subject: [PATCH] add: device test --- tests/test_devices.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_devices.py diff --git a/tests/test_devices.py b/tests/test_devices.py new file mode 100644 index 0000000..7eaae26 --- /dev/null +++ b/tests/test_devices.py @@ -0,0 +1,20 @@ +from compose_viz.models.device import Device + +def test_device_init_normal() -> None: + try: + d = Device(host_path="/dev/ttyUSB0", container_path="/dev/ttyUSB1") + + assert d.host_path == "/dev/ttyUSB0" + assert d.container_path == "/dev/ttyUSB1" + except Exception as e: + assert False, e + +def test_device_with_cgroup_permissions() -> None: + try: + d = Device(host_path="/dev/sda1", container_path="/dev/xvda", cgroup_permissions="rwm") + + assert d.host_path == "/dev/sda1" + assert d.container_path == "/dev/xvda" + assert d.cgroup_permissions == "rwm" + except Exception as e: + assert False, e \ No newline at end of file