From aaaa674625a56f5284454d83df84232efa37312a Mon Sep 17 00:00:00 2001 From: songwenping Date: Wed, 15 Sep 2021 02:24:21 +0000 Subject: [PATCH] Show description attr when list and get device profile Show description attr and modify UT. Change-Id: I88e481866217b3672f42aa390d3606810c4db513 --- cyborgclient/osc/v2/device_profile.py | 9 +++++++-- cyborgclient/tests/unit/osc/v2/fakes.py | 2 ++ cyborgclient/tests/unit/osc/v2/test_device_profile.py | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cyborgclient/osc/v2/device_profile.py b/cyborgclient/osc/v2/device_profile.py index 974ebae..86d5b90 100644 --- a/cyborgclient/osc/v2/device_profile.py +++ b/cyborgclient/osc/v2/device_profile.py @@ -50,25 +50,29 @@ class ListDeviceProfile(command.Lister): "updated_at", "uuid", "name", - "groups" + "groups", + "description" ) columns = ( "created_at", "updated_at", "uuid", "name", - "groups" + "groups", + "description" ) else: column_headers = ( "uuid", "name", "groups", + "description" ) columns = ( "uuid", "name", "groups", + "description" ) data = acc_client.device_profiles() @@ -182,6 +186,7 @@ def _show_device_profile(acc_client, uuid): "uuid", "name", "groups", + "description", ) try: device_profile = acc_client.get_device_profile(uuid) diff --git a/cyborgclient/tests/unit/osc/v2/fakes.py b/cyborgclient/tests/unit/osc/v2/fakes.py index 4278593..e455270 100644 --- a/cyborgclient/tests/unit/osc/v2/fakes.py +++ b/cyborgclient/tests/unit/osc/v2/fakes.py @@ -76,6 +76,7 @@ device_profile_groups = [ "trait:CUSTOM_TRAIT_ALWAYS": "required", } ] +device_profile_description = 'fake_description' DEVICE_PROFILE = { 'created_at': device_profile_created_at, @@ -84,6 +85,7 @@ DEVICE_PROFILE = { 'uuid': device_profile_uuid, 'name': device_profile_name, 'groups': device_profile_groups, + 'description': device_profile_description, } accelerator_request_uuid = uuid.uuid4().hex diff --git a/cyborgclient/tests/unit/osc/v2/test_device_profile.py b/cyborgclient/tests/unit/osc/v2/test_device_profile.py index 921962e..da5935d 100644 --- a/cyborgclient/tests/unit/osc/v2/test_device_profile.py +++ b/cyborgclient/tests/unit/osc/v2/test_device_profile.py @@ -53,6 +53,7 @@ class TestDeviceProfileList(TestDeviceProfile): 'uuid', 'name', 'groups', + 'description' ) self.assertEqual(collist, columns) @@ -60,6 +61,7 @@ class TestDeviceProfileList(TestDeviceProfile): acc_fakes.device_profile_uuid, acc_fakes.device_profile_name, acc_fakes.device_profile_groups, + acc_fakes.device_profile_description, ), ] self.assertEqual(datalist, list(data)) @@ -78,6 +80,7 @@ class TestDeviceProfileList(TestDeviceProfile): 'uuid', 'name', 'groups', + 'description' ) self.assertEqual(collist, columns) @@ -87,6 +90,7 @@ class TestDeviceProfileList(TestDeviceProfile): acc_fakes.device_profile_uuid, acc_fakes.device_profile_name, acc_fakes.device_profile_groups, + acc_fakes.device_profile_description, ), ] self.assertEqual(datalist, list(data)) @@ -136,6 +140,7 @@ class TestDeviceProfileCreate(TestDeviceProfile): 'uuid', 'name', 'groups', + 'description' ) self.assertEqual(collist, columns) @@ -145,5 +150,6 @@ class TestDeviceProfileCreate(TestDeviceProfile): acc_fakes.device_profile_uuid, acc_fakes.device_profile_name, acc_fakes.device_profile_groups, + acc_fakes.device_profile_description, ] self.assertEqual(datalist, list(data))