summaryrefslogtreecommitdiff
path: root/openstackclient/tests/common/test_command.py
diff options
context:
space:
mode:
authorRichard Theis <rtheis@us.ibm.com>2016-06-02 09:53:55 -0500
committerRichard Theis <rtheis@us.ibm.com>2016-06-02 10:07:34 -0500
commit6f2c1734e3d66e261f231711455821321c1fc254 (patch)
tree269f19082215e0ccb37c361427062c9d4e91b646 /openstackclient/tests/common/test_command.py
parentb349156059edb1c7ae8e4bdfbd5eb0826d7aa808 (diff)
downloadpython-openstackclient-6f2c1734e3d66e261f231711455821321c1fc254.tar.gz
Fix --enable options on commands
The --enable option on commands is ignored when the arguments are parsed. This is related to the --enable-beta-commands option. Renaming the option to --os-beta-command fixes the problem. There's no need to handle backwards compatibility for the option name change because there hasn't been an OSC release yet with beta commands. Change-Id: I0327ba8a2058858a83e9a42e231470ed733cc834 Closes-Bug: #1588384
Diffstat (limited to 'openstackclient/tests/common/test_command.py')
-rw-r--r--openstackclient/tests/common/test_command.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/openstackclient/tests/common/test_command.py b/openstackclient/tests/common/test_command.py
index 7467d9eb..722a4c06 100644
--- a/openstackclient/tests/common/test_command.py
+++ b/openstackclient/tests/common/test_command.py
@@ -15,6 +15,8 @@
import mock
from openstackclient.common import command
+from openstackclient.common import exceptions
+from openstackclient.tests import fakes as test_fakes
from openstackclient.tests import utils as test_utils
@@ -31,3 +33,16 @@ class TestCommand(test_utils.TestCase):
self.assertTrue(hasattr(cmd, 'log'))
self.assertEqual('openstackclient.tests.common.test_command.'
'FakeCommand', cmd.log.name)
+
+ def test_validate_os_beta_command_enabled(self):
+ cmd = FakeCommand(mock.Mock(), mock.Mock())
+ cmd.app = mock.Mock()
+ cmd.app.options = test_fakes.FakeOptions()
+
+ # No exception is raised when enabled.
+ cmd.app.options.os_beta_command = True
+ cmd.validate_os_beta_command_enabled()
+
+ cmd.app.options.os_beta_command = False
+ self.assertRaises(exceptions.CommandError,
+ cmd.validate_os_beta_command_enabled)