]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add unit test for task.devstack.parse_os_table()
authorZack Cerza <zack@cerza.org>
Fri, 21 Feb 2014 17:23:31 +0000 (11:23 -0600)
committerZack Cerza <zack@cerza.org>
Fri, 21 Feb 2014 17:23:31 +0000 (11:23 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/task/test/__init__.py [new file with mode: 0644]
teuthology/task/test/test_devstack.py [new file with mode: 0644]

diff --git a/teuthology/task/test/__init__.py b/teuthology/task/test/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/teuthology/task/test/test_devstack.py b/teuthology/task/test/test_devstack.py
new file mode 100644 (file)
index 0000000..117b307
--- /dev/null
@@ -0,0 +1,48 @@
+from textwrap import dedent
+
+from .. import devstack
+
+
+class TestDevstack(object):
+    def test_parse_os_table(self):
+        table_str = dedent("""
+            +---------------------+--------------------------------------+
+            |       Property      |                Value                 |
+            +---------------------+--------------------------------------+
+            |     attachments     |                  []                  |
+            |  availability_zone  |                 nova                 |
+            |       bootable      |                false                 |
+            |      created_at     |      2014-02-21T17:14:47.548361      |
+            | display_description |                 None                 |
+            |     display_name    |                 NAME                 |
+            |          id         | ffdbd1bb-60dc-4d95-acfe-88774c09ad3e |
+            |       metadata      |                  {}                  |
+            |         size        |                  1                   |
+            |     snapshot_id     |                 None                 |
+            |     source_volid    |                 None                 |
+            |        status       |               creating               |
+            |     volume_type     |                 None                 |
+            +---------------------+--------------------------------------+
+            """).strip()
+        expected = {
+            'Property': 'Value',
+            'attachments': '[]',
+            'availability_zone': 'nova',
+            'bootable': 'false',
+            'created_at': '2014-02-21T17:14:47.548361',
+            'display_description': 'None',
+            'display_name': 'NAME',
+            'id': 'ffdbd1bb-60dc-4d95-acfe-88774c09ad3e',
+            'metadata': '{}',
+            'size': '1',
+            'snapshot_id': 'None',
+            'source_volid': 'None',
+            'status': 'creating',
+            'volume_type': 'None'}
+
+        vol_info = devstack.parse_os_table(table_str)
+        assert vol_info == expected
+
+
+
+