aboutsummaryrefslogtreecommitdiff
path: root/lava/device/tests/test_commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'lava/device/tests/test_commands.py')
-rw-r--r--lava/device/tests/test_commands.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lava/device/tests/test_commands.py b/lava/device/tests/test_commands.py
index 91b204f..22a652a 100644
--- a/lava/device/tests/test_commands.py
+++ b/lava/device/tests/test_commands.py
@@ -32,6 +32,7 @@ from lava.device.commands import (
add,
config,
remove,
+ list,
)
from lava.helper.tests.helper_test import HelperTest
from lava.tool.errors import CommandError
@@ -180,3 +181,18 @@ class ConfigCommanTests(HelperTest):
# Hopefully tests are not run as root.
config_command = config(self.parser, self.args)
self.assertRaises(CommandError, config_command.invoke)
+
+
+class ListCommandTests(HelperTest):
+
+ class FakeDevice(object):
+ def __init__(self, hostname):
+ self.hostname = hostname
+
+ @patch('lava.device.commands.get_devices', create=True)
+ def test_list_devices(self, get_devices):
+ get_devices.return_value = [ListCommandTests.FakeDevice('foo'), ListCommandTests.FakeDevice('bar')]
+ command = list(self.parser, self.args)
+ command.invoke()
+
+ get_devices.assert_any_call()