Skip to content

Commit a05cbf4

Browse files
author
Dean Troyer
committed
Rework shell tests
This is the first step in reworking the shell argument handling, clean up and add tests to ensure functionality doesn't change. * Rework shell tests to break down global options and auth options. * Make tests table-driven * Remove 'os_' from 'cacert' and 'default_domain' internal option names Change-Id: Icf69c7e84f3f44b366fe64b6bbf4e3fe958eb302
1 parent 9bf24f3 commit a05cbf4

4 files changed

Lines changed: 182 additions & 217 deletions

File tree

examples/object_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def run(opts):
5252
# NOTE(dtroyer): This converts from the usual OpenStack way to the single
5353
# requests argument and is an app-specific thing because
5454
# we want to be like OpenStackClient.
55-
if opts.os_cacert:
56-
verify = opts.os_cacert
55+
if opts.cacert:
56+
verify = opts.cacert
5757
else:
5858
verify = not opts.insecure
5959

examples/osc-lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def run(opts):
6262
# NOTE(dtroyer): This converts from the usual OpenStack way to the single
6363
# requests argument and is an app-specific thing because
6464
# we want to be like OpenStackClient.
65-
if opts.os_cacert:
66-
verify = opts.os_cacert
65+
if opts.cacert:
66+
verify = opts.cacert
6767
else:
6868
verify = not opts.insecure
6969

openstackclient/shell.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def build_option_parser(self, description, version):
182182
parser.add_argument(
183183
'--os-cacert',
184184
metavar='<ca-bundle-file>',
185+
dest='cacert',
185186
default=utils.env('OS_CACERT'),
186187
help='CA certificate bundle file (Env: OS_CACERT)')
187188
verify_group = parser.add_mutually_exclusive_group()
@@ -200,6 +201,7 @@ def build_option_parser(self, description, version):
200201
parser.add_argument(
201202
'--os-default-domain',
202203
metavar='<auth-domain>',
204+
dest='default_domain',
203205
default=utils.env(
204206
'OS_DEFAULT_DOMAIN',
205207
default=DEFAULT_DOMAIN),
@@ -270,7 +272,7 @@ def initialize_app(self, argv):
270272
self.verify = self.cloud.config.get('verify', self.verify)
271273

272274
# Save default domain
273-
self.default_domain = self.options.os_default_domain
275+
self.default_domain = self.options.default_domain
274276

275277
# Loop through extensions to get API versions
276278
for mod in clientmanager.PLUGIN_MODULES:

0 commit comments

Comments
 (0)