summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2015-09-17 01:22:24 +0200
committerMonty Taylor <mordred@inaugust.com>2015-09-17 01:25:22 +0200
commitaabf1431a3e23a734431f56df4a8d6ac446509b3 (patch)
tree7d84aaac0d78a1bd469dfa6708f2659892760b2e
parent4287c75c5795665e2a7dfdbab826adbc1a106df4 (diff)
downloados-client-config-aabf1431a3e23a734431f56df4a8d6ac446509b3.tar.gz
Test kwargs passing not just argparse
Change-Id: Ic14365b1daec9a3f51d6a59db38604edb60865d4
-rw-r--r--os_client_config/tests/test_config.py31
1 files changed, 29 insertions, 2 deletions
diff --git a/os_client_config/tests/test_config.py b/os_client_config/tests/test_config.py
index 36fe15d..b4320ad 100644
--- a/os_client_config/tests/test_config.py
+++ b/os_client_config/tests/test_config.py
@@ -199,7 +199,7 @@ class TestConfigArgparse(base.TestCase):
def setUp(self):
super(TestConfigArgparse, self).setUp()
- self.options = argparse.Namespace(
+ self.args = dict(
auth_url='http://example.com/v2',
username='user',
password='password',
@@ -207,6 +207,7 @@ class TestConfigArgparse(base.TestCase):
region_name='other-test-region',
snack_type='cookie',
)
+ self.options = argparse.Namespace(**self.args)
def test_get_one_cloud_argparse(self):
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
@@ -221,7 +222,33 @@ class TestConfigArgparse(base.TestCase):
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
vendor_files=[self.vendor_yaml])
- cc = c.get_one_cloud(cloud='', argparse=self.options)
+ cc = c.get_one_cloud(argparse=self.options)
+ self.assertIsNone(cc.cloud)
+ self.assertEqual(cc.region_name, 'other-test-region')
+ self.assertEqual(cc.snack_type, 'cookie')
+
+ def test_get_one_cloud_just_kwargs(self):
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+
+ cc = c.get_one_cloud(**self.args)
+ self.assertIsNone(cc.cloud)
+ self.assertEqual(cc.region_name, 'other-test-region')
+ self.assertEqual(cc.snack_type, 'cookie')
+
+ def test_get_one_cloud_dash_kwargs(self):
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+
+ args = {
+ 'auth-url': 'http://example.com/v2',
+ 'username': 'user',
+ 'password': 'password',
+ 'project_name': 'project',
+ 'region_name': 'other-test-region',
+ 'snack_type': 'cookie',
+ }
+ cc = c.get_one_cloud(**args)
self.assertIsNone(cc.cloud)
self.assertEqual(cc.region_name, 'other-test-region')
self.assertEqual(cc.snack_type, 'cookie')