summaryrefslogtreecommitdiff
path: root/tests/unit/test_shell.py
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2016-05-03 11:34:02 -0700
committerTim Burke <tim.burke@gmail.com>2016-05-03 14:03:15 -0700
commit5b714f104d7564ff06525465d0eaabaa12a8cbb0 (patch)
treefa5580295ce0b0fa977668c3de2622d59525c76b /tests/unit/test_shell.py
parentc26dec66f6bab260c71d3646b438c19825bea8b8 (diff)
downloadpython-swiftclient-5b714f104d7564ff06525465d0eaabaa12a8cbb0.tar.gz
Parse options to dict
This is a first step toward unifying the options parsing magic between shell.py and service.py Change-Id: If001e07978c0bae729ac0cd9b2c2934092c98447
Diffstat (limited to 'tests/unit/test_shell.py')
-rw-r--r--tests/unit/test_shell.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index 2a47836..0b29952 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -1438,18 +1438,18 @@ class TestParsing(TestBase):
expected_os_opts_dict = expected_os_opts_dict or {}
# check the expected opts are set
for key, v in expected_opts.items():
- actual = getattr(actual_opts, key)
+ actual = actual_opts.get(key)
self.assertEqual(v, actual, 'Expected %s for key %s, found %s' %
(v, key, actual))
for key, v in expected_os_opts.items():
- actual = getattr(actual_opts, "os_" + key)
+ actual = actual_opts.get("os_" + key)
self.assertEqual(v, actual, 'Expected %s for key %s, found %s' %
(v, key, actual))
# check the os_options dict values are set
- self.assertTrue(hasattr(actual_opts, 'os_options'))
- actual_os_opts_dict = getattr(actual_opts, 'os_options')
+ self.assertIn('os_options', actual_opts)
+ actual_os_opts_dict = actual_opts['os_options']
expected_os_opts_keys = ['project_name', 'region_name',
'tenant_name',
'user_domain_name', 'endpoint_type',
@@ -1478,8 +1478,8 @@ class TestParsing(TestBase):
('os_auth_url', 'auth'),
('os_password', 'key')]
for pair in equivalents:
- self.assertEqual(getattr(actual_opts, pair[0]),
- getattr(actual_opts, pair[1]))
+ self.assertEqual(actual_opts.get(pair[0]),
+ actual_opts.get(pair[1]))
def test_minimum_required_args_v3(self):
opts = {"auth_version": "3"}