Merge "Tests: Don't write bash-completion cache files"
This commit is contained in:
commit
15295acb07
|
@ -91,6 +91,8 @@ class Manager(common_base.HookableMixin):
|
|||
except KeyError:
|
||||
pass
|
||||
|
||||
# FIXME(eharney): This is probably a bug - we should only call
|
||||
# completion_cache for the shell, not here.
|
||||
with self.completion_cache('human_id', obj_class, mode="w"):
|
||||
with self.completion_cache('uuid', obj_class, mode="w"):
|
||||
items_new = [obj_class(self, res, loaded=True)
|
||||
|
|
|
@ -59,6 +59,8 @@ class ShellTest(utils.TestCase):
|
|||
self.useFixture(fixtures.EnvironmentVariable(var,
|
||||
self.FAKE_ENV[var]))
|
||||
|
||||
self.mock_completion()
|
||||
|
||||
def shell(self, argstr):
|
||||
orig = sys.stdout
|
||||
try:
|
||||
|
@ -294,6 +296,11 @@ class ShellTest(utils.TestCase):
|
|||
|
||||
class CinderClientArgumentParserTest(utils.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(CinderClientArgumentParserTest, self).setUp()
|
||||
|
||||
self.mock_completion()
|
||||
|
||||
def test_ambiguity_solved_for_one_visible_argument(self):
|
||||
parser = shell.CinderClientArgumentParser(add_help=False)
|
||||
parser.add_argument('--test-parameter',
|
||||
|
@ -336,6 +343,10 @@ class CinderClientArgumentParserTest(utils.TestCase):
|
|||
|
||||
|
||||
class TestLoadVersionedActions(utils.TestCase):
|
||||
def setUp(self):
|
||||
super(TestLoadVersionedActions, self).setUp()
|
||||
|
||||
self.mock_completion()
|
||||
|
||||
def test_load_versioned_actions(self):
|
||||
parser = cinderclient.shell.CinderClientArgumentParser()
|
||||
|
|
|
@ -15,6 +15,7 @@ import json
|
|||
import os
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
import requests
|
||||
from requests_mock.contrib import fixture as requests_mock_fixture
|
||||
import six
|
||||
|
@ -40,6 +41,9 @@ class TestCase(testtools.TestCase):
|
|||
stderr = self.useFixture(fixtures.StringStream('stderr')).stream
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
|
||||
|
||||
# FIXME(eharney) - this should only be needed for shell tests
|
||||
self.mock_completion()
|
||||
|
||||
def _assert_request_id(self, obj, count=1):
|
||||
self.assertTrue(hasattr(obj, 'request_ids'))
|
||||
self.assertEqual(REQUEST_ID * count, obj.request_ids)
|
||||
|
@ -49,6 +53,16 @@ class TestCase(testtools.TestCase):
|
|||
return self.shell.cs.assert_called_anytime(method, url, body,
|
||||
partial_body)
|
||||
|
||||
def mock_completion(self):
|
||||
patcher = mock.patch(
|
||||
'cinderclient.base.Manager.write_to_completion_cache')
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
|
||||
patcher = mock.patch('cinderclient.base.Manager.completion_cache')
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
|
||||
|
||||
class FixturedTestCase(TestCase):
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ class ShellTest(utils.TestCase):
|
|||
self.useFixture(fixtures.EnvironmentVariable(var,
|
||||
self.FAKE_ENV[var]))
|
||||
|
||||
self.mock_completion()
|
||||
|
||||
self.shell = shell.OpenStackCinderShell()
|
||||
|
||||
# HACK(bcwaldon): replace this when we start using stubs
|
||||
|
|
|
@ -51,6 +51,8 @@ class ShellTest(utils.TestCase):
|
|||
self.useFixture(fixtures.EnvironmentVariable(var,
|
||||
self.FAKE_ENV[var]))
|
||||
|
||||
self.mock_completion()
|
||||
|
||||
self.shell = shell.OpenStackCinderShell()
|
||||
|
||||
self.requests = self.useFixture(requests_mock_fixture.Fixture())
|
||||
|
|
|
@ -79,6 +79,8 @@ class ShellTest(utils.TestCase):
|
|||
self.useFixture(fixtures.EnvironmentVariable(var,
|
||||
self.FAKE_ENV[var]))
|
||||
|
||||
self.mock_completion()
|
||||
|
||||
self.shell = shell.OpenStackCinderShell()
|
||||
|
||||
self.requests = self.useFixture(requests_mock_fixture.Fixture())
|
||||
|
|
Loading…
Reference in New Issue