Correct mock use in TestCommandLineArgument.setUp
TestCommandLineArgument.setUp mocks get_keystone_client using: shell.client.Client.get_keystone_client = mock.MagicMock() which is incorrect ... as the mock is not clean up during tearDown/cleanup. This change corrects how the mock is done. Closes-Bug: #1445197 Change-Id: If03a27f78fccd8bc5000b258f429dfb6f770f5ee
This commit is contained in:
@@ -18,7 +18,6 @@ import mock
|
||||
from testtools import matchers
|
||||
|
||||
from magnumclient import exceptions
|
||||
from magnumclient import shell
|
||||
from magnumclient.tests import utils
|
||||
|
||||
FAKE_ENV = {'OS_USERNAME': 'username',
|
||||
@@ -50,7 +49,10 @@ class TestCommandLineArgument(utils.TestCase):
|
||||
def setUp(self):
|
||||
super(TestCommandLineArgument, self).setUp()
|
||||
self.make_env(fake_env=FAKE_ENV)
|
||||
shell.client.Client.get_keystone_client = mock.MagicMock()
|
||||
keystone_mock = mock.patch(
|
||||
'magnumclient.v1.client.Client.get_keystone_client')
|
||||
keystone_mock.start()
|
||||
self.addCleanup(keystone_mock.stop)
|
||||
|
||||
def _test_arg_success(self, command):
|
||||
stdout, stderr = self.shell(command)
|
||||
|
||||
Reference in New Issue
Block a user