summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hellmann <doug@doughellmann.com>2015-07-10 13:18:50 +0000
committerDoug Hellmann <doug@doughellmann.com>2015-07-12 19:07:02 +0000
commitbb6dec2466e8c03ae83fe57d81ffa4d15fa7d97a (patch)
treea5bbe247f76d639b1405fcd92ab103796db4d2f3
parent85baf7d16fc9da47aba54f03a16d14071da4f9df (diff)
downloadoslo-middleware-bb6dec2466e8c03ae83fe57d81ffa4d15fa7d97a.tar.gz
Fix mocking for 1.1.0
Call the right assertion method on the mock in test_disablefile_unconfigured, and fix the way the mock is set up so it works. Combine this with the change to pin the version of mock used on python 2.6 and to raise the minimum version of mock used elsewhere. Change-Id: I1ac9f9796227a860df75d4c72464479dbe66258c
-rw-r--r--oslo_middleware/tests/test_healthcheck.py13
-rw-r--r--test-requirements.txt3
2 files changed, 10 insertions, 6 deletions
diff --git a/oslo_middleware/tests/test_healthcheck.py b/oslo_middleware/tests/test_healthcheck.py
index a9fa2a9..13aa5fd 100644
--- a/oslo_middleware/tests/test_healthcheck.py
+++ b/oslo_middleware/tests/test_healthcheck.py
@@ -51,14 +51,17 @@ class HealthcheckTests(test_base.BaseTestCase):
conf = {'path': '/hidden_healthcheck'}
self._do_test(conf, path='/toto', expected_body=b'Hello, World!!!')
- @mock.patch('logging.warn')
- def test_disablefile_unconfigured(self, fake_warn):
+ @mock.patch('oslo_middleware.healthcheck.disable_by_file.LOG')
+ def test_disablefile_unconfigured(self, fake_log):
+ fake_warn = fake_log.warning
conf = {'backends': 'disable_by_file'}
self._do_test(conf, expected_body=b'OK')
self.assertIn('disable_by_file', self.app._backends.names())
- fake_warn.assert_called_once('DisableByFile healthcheck middleware '
- 'enabled without disable_by_file_path '
- 'set')
+ fake_warn.assert_called_once_with(
+ 'DisableByFile healthcheck middleware '
+ 'enabled without disable_by_file_path '
+ 'set'
+ )
def test_disablefile_enabled(self):
conf = {'backends': 'disable_by_file',
diff --git a/test-requirements.txt b/test-requirements.txt
index f7dec7d..aacc73a 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -4,7 +4,8 @@
fixtures>=1.3.1
hacking<0.11,>=0.10.0
-mock>=1.0
+mock>=1.1;python_version!='2.6'
+mock==1.0.1;python_version=='2.6'
oslosphinx>=2.5.0 # Apache-2.0
oslotest>=1.5.1 # Apache-2.0
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2