Merge "Set auth_plugin in __init__"

This commit is contained in:
Jenkins
2015-03-23 19:36:22 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -46,6 +46,9 @@ def _positive_non_zero_int(argument_value):
class CeilometerShell(object):
def __init__(self):
self.auth_plugin = ceiloclient.AuthPlugin()
def get_base_parser(self):
parser = argparse.ArgumentParser(
prog='ceilometer',
@@ -158,7 +161,6 @@ class CeilometerShell(object):
def parse_args(self, argv):
# Parse args once to find version
self.auth_plugin = ceiloclient.AuthPlugin()
parser = self.get_base_parser()
(options, args) = parser.parse_known_args(argv)
self.auth_plugin.parse_opts(options)

View File

@@ -92,6 +92,11 @@ class ShellHelpTest(ShellTestBase):
self.assertThat(help_text,
matchers.MatchesRegex(r, self.RE_OPTIONS))
def test_get_base_parser(self):
standalone_shell = ceilometer_shell.CeilometerShell()
parser = standalone_shell.get_base_parser()
self.assertEqual(600, parser.get_default('timeout'))
class ShellKeystoneV2Test(ShellTestBase):