diff options
| author | Zuul <zuul@review.opendev.org> | 2019-08-27 00:59:46 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2019-08-27 00:59:46 +0000 |
| commit | 6c818c492569bc9304c166a79bf812603cbb6358 (patch) | |
| tree | b3787647b58a1adf7c250468ca90b97ee5e5990d /openstackclient | |
| parent | 7b7488d51c795fac6b0e1c9c99a895b06bb3a4a8 (diff) | |
| parent | 75f0f82c411e0bc94648c845669dc9312f0152ba (diff) | |
| download | python-openstackclient-6c818c492569bc9304c166a79bf812603cbb6358.tar.gz | |
Merge "Add CLI argument tests before making changes"
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/tests/functional/common/test_args.py | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/common/test_args.py b/openstackclient/tests/functional/common/test_args.py new file mode 100644 index 00000000..dd1fd0fb --- /dev/null +++ b/openstackclient/tests/functional/common/test_args.py @@ -0,0 +1,79 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import json + +from openstackclient.tests.functional import base + + +class ArgumentTests(base.TestCase): + """Functional tests for command line arguments""" + + def test_default_auth_type(self): + cmd_output = json.loads(self.openstack( + 'configuration show -f json', + cloud='', + )) + self.assertIsNotNone(cmd_output) + self.assertIn( + 'auth_type', + cmd_output.keys(), + ) + self.assertEqual( + 'password', + cmd_output['auth_type'], + ) + + def test_auth_type_none(self): + cmd_output = json.loads(self.openstack( + 'configuration show -f json', + cloud=None, + )) + self.assertIsNotNone(cmd_output) + self.assertIn( + 'auth_type', + cmd_output.keys(), + ) + self.assertEqual( + 'none', + cmd_output['auth_type'], + ) + + def test_auth_type_token_endpoint_opt(self): + cmd_output = json.loads(self.openstack( + 'configuration show -f json --os-auth-type token_endpoint', + cloud=None, + )) + self.assertIsNotNone(cmd_output) + self.assertIn( + 'auth_type', + cmd_output.keys(), + ) + self.assertEqual( + 'token_endpoint', + cmd_output['auth_type'], + ) + + def test_auth_type_password_opt(self): + cmd_output = json.loads(self.openstack( + 'configuration show -f json --os-auth-type password', + cloud=None, + )) + self.assertIsNotNone(cmd_output) + self.assertIn( + 'auth_type', + cmd_output.keys(), + ) + self.assertEqual( + 'password', + cmd_output['auth_type'], + ) |
