# HG changeset patch # User Thomas De Schampheleire # Date 2016-02-03 22:21:31 # Node ID 1ed2e7271e031febe49b9a366650998bf8c4c13d # Parent 9b10493f4e3f4327bc955049bbd0681f11a67ce5 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. diff --git a/kallithea/tests/functional/test_search.py b/kallithea/tests/functional/test_search.py --- a/kallithea/tests/functional/test_search.py +++ b/kallithea/tests/functional/test_search.py @@ -1,3 +1,4 @@ +import mock import os from kallithea.tests import * @@ -12,10 +13,15 @@ class TestSearchController(TestControlle # 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. '