Tests: Fix cmd tests
There are 2 tests in TestCinderManageCmd that break other tests that
come after them because the are forcefully replacing cinder_manage.CONF
and not restoring it after the test has run.
This patch modifies these 2 tests to mock it instead:
test_main_remove_cluster
test_main_missing_action
@@ -1152,7 +1152,7 @@ class TestCinderManageCmd(test.TestCase):
script_name = 'cinder-manage'
sys.argv = [script_name, 'cluster', 'remove', 'abinary', 'acluster']
- cinder_manage.CONF = cfg.ConfigOpts()
+ self.mock_object(cinder_manage, 'CONF', cfg.ConfigOpts())
cinder_manage.main()
expected_argument = (['cluster_name'],
@@ -1183,7 +1183,7 @@ class TestCinderManageCmd(test.TestCase):
def test_main_missing_action(self):
sys.argv = ['cinder-manage', 'backup']
- cinder_manage.CONF = cfg.ConfigOpts()
+ self.mock_object(cinder_manage, 'CONF', cfg.ConfigOpts())
stdout = io.StringIO()
with mock.patch('sys.stdout', new=stdout):
