]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | from textwrap import dedent |
2 | ||
e306af50 | 3 | from tasks import devstack |
7c673cae FG |
4 | |
5 | ||
6 | class TestDevstack(object): | |
7 | def test_parse_os_table(self): | |
8 | table_str = dedent(""" | |
9 | +---------------------+--------------------------------------+ | |
10 | | Property | Value | | |
11 | +---------------------+--------------------------------------+ | |
12 | | attachments | [] | | |
13 | | availability_zone | nova | | |
14 | | bootable | false | | |
15 | | created_at | 2014-02-21T17:14:47.548361 | | |
16 | | display_description | None | | |
17 | | display_name | NAME | | |
18 | | id | ffdbd1bb-60dc-4d95-acfe-88774c09ad3e | | |
19 | | metadata | {} | | |
20 | | size | 1 | | |
21 | | snapshot_id | None | | |
22 | | source_volid | None | | |
23 | | status | creating | | |
24 | | volume_type | None | | |
25 | +---------------------+--------------------------------------+ | |
26 | """).strip() | |
27 | expected = { | |
28 | 'Property': 'Value', | |
29 | 'attachments': '[]', | |
30 | 'availability_zone': 'nova', | |
31 | 'bootable': 'false', | |
32 | 'created_at': '2014-02-21T17:14:47.548361', | |
33 | 'display_description': 'None', | |
34 | 'display_name': 'NAME', | |
35 | 'id': 'ffdbd1bb-60dc-4d95-acfe-88774c09ad3e', | |
36 | 'metadata': '{}', | |
37 | 'size': '1', | |
38 | 'snapshot_id': 'None', | |
39 | 'source_volid': 'None', | |
40 | 'status': 'creating', | |
41 | 'volume_type': 'None'} | |
42 | ||
43 | vol_info = devstack.parse_os_table(table_str) | |
44 | assert vol_info == expected | |
45 | ||
46 | ||
47 | ||
48 |