summaryrefslogtreecommitdiff
path: root/openstackclient/tests/object/test_container.py
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2013-08-30 17:55:37 -0500
committerDean Troyer <dtroyer@gmail.com>2013-09-26 13:34:11 -0500
commitad59b03be6af9da31230689af268139b12b548e7 (patch)
tree0394d365ab2b1d847ae20f46b0c208a71e5dd9a3 /openstackclient/tests/object/test_container.py
parent74f4e3138996e258d4bdce1a162a5dade62a0c15 (diff)
downloadpython-openstackclient-ad59b03be6af9da31230689af268139b12b548e7.tar.gz
Add object-store show commands
* Add lib.container.show_container() and lib.object.show_object() * Add container and object show commands Change-Id: I963d664c55b59739453345f0f353aa2eaf1bf70e
Diffstat (limited to 'openstackclient/tests/object/test_container.py')
-rw-r--r--openstackclient/tests/object/test_container.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/openstackclient/tests/object/test_container.py b/openstackclient/tests/object/test_container.py
index 9b53e360..24d67633 100644
--- a/openstackclient/tests/object/test_container.py
+++ b/openstackclient/tests/object/test_container.py
@@ -313,3 +313,49 @@ class TestContainerList(TestObject):
(object_fakes.container_name_3, ),
)
self.assertEqual(tuple(data), datalist)
+
+
+@mock.patch(
+ 'openstackclient.object.v1.container.lib_container.show_container'
+)
+class TestContainerShow(TestObject):
+
+ def setUp(self):
+ super(TestContainerShow, self).setUp()
+
+ # Get the command object to test
+ self.cmd = container.ShowContainer(self.app, None)
+
+ def test_container_show(self, c_mock):
+ c_mock.return_value = copy.deepcopy(object_fakes.CONTAINER)
+
+ arglist = [
+ object_fakes.container_name,
+ ]
+ verifylist = [
+ ('container', object_fakes.container_name),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ # DisplayCommandBase.take_action() returns two tuples
+ columns, data = self.cmd.take_action(parsed_args)
+
+ # Set expected values
+ kwargs = {
+ }
+ # lib.container.show_container(api, url, container)
+ c_mock.assert_called_with(
+ self.app.restapi,
+ AUTH_URL,
+ object_fakes.container_name,
+ **kwargs
+ )
+
+ collist = ('bytes', 'count', 'name')
+ self.assertEqual(columns, collist)
+ datalist = (
+ object_fakes.container_bytes,
+ object_fakes.container_count,
+ object_fakes.container_name,
+ )
+ self.assertEqual(data, datalist)