diff --git a/searchlight/tests/unit/test_wsgi.py b/searchlight/tests/unit/test_wsgi.py index b61587c5..d182f994 100644 --- a/searchlight/tests/unit/test_wsgi.py +++ b/searchlight/tests/unit/test_wsgi.py @@ -13,9 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import gettext - -from babel import localedata +import fixtures import mock import webob @@ -34,7 +32,9 @@ class RequestTest(test_utils.BaseTestCase): def returns_some_locales(*args, **kwargs): return all_locales - self.stubs.Set(localedata, 'locale_identifiers', returns_some_locales) + self.useFixture(fixtures.MonkeyPatch( + 'babel.localedata.local_identifiers', returns_some_locales + )) # Override gettext.find to return other than None for some languages. def fake_gettext_find(lang_id, *args, **kwargs): @@ -47,7 +47,9 @@ class RequestTest(test_utils.BaseTestCase): return found_ret return None - self.stubs.Set(gettext, 'find', fake_gettext_find) + self.useFixture(fixtures.MonkeyPatch( + 'gettext.find', fake_gettext_find + )) def test_language_accept_default(self): request = wsgi.Request.blank('/tests/123') diff --git a/searchlight/tests/utils.py b/searchlight/tests/utils.py index c0c5811d..b00abe4b 100644 --- a/searchlight/tests/utils.py +++ b/searchlight/tests/utils.py @@ -27,7 +27,6 @@ import subprocess import fixtures import mock from oslo_config import cfg -from oslotest import moxstubout import six from six.moves import BaseHTTPServer import testtools @@ -53,8 +52,6 @@ class BaseTestCase(testtools.TestCase): # the following policy tests config.parse_args(args=[], default_config_files=[]) self.addCleanup(CONF.reset) - mox_fixture = self.useFixture(moxstubout.MoxStubout()) - self.stubs = mox_fixture.stubs self.mock_exception = mock.patch( 'searchlight.common.exception',