Mercurial > kallithea
changeset 5697:1ed2e7271e03
tests: search: fix always-skipped empty-search-index test
The test that verifies the output when the search index is empty is always
skipped when following the standard development setup, so is useless.
Instead, fix the test by mocking the configuration, pointing the search
index to a valid location but without index.
author | Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> |
---|---|
date | Wed, 03 Feb 2016 22:21:31 +0100 |
parents | 9b10493f4e3f |
children | 5349281d4c9d |
files | kallithea/tests/functional/test_search.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/functional/test_search.py Wed Jan 27 18:56:48 2016 +0000 +++ b/kallithea/tests/functional/test_search.py Wed Feb 03 22:21:31 2016 +0100 @@ -1,3 +1,4 @@ +import mock import os from kallithea.tests import * @@ -12,10 +13,15 @@ # Test response... def test_empty_search(self): - if os.path.isdir(self.index_location): - raise SkipTest('skipped due to existing index') - else: - self.log_user() + self.log_user() + + config_mock = { + 'app_conf': { + # can be any existing dir that does not contain an actual index + 'index_dir': '.', + } + } + with mock.patch('kallithea.controllers.search.config', config_mock): response = self.app.get(url(controller='search', action='index'), {'q': HG_REPO}) response.mustcontain('There is no index to search in. '