[ckan-changes] commit/ckan: John Glover: [search][xs] Test bug fix: check that search is supported before trying to load the home page or checking solr config

Bitbucket commits-noreply at bitbucket.org
Wed Sep 21 16:28:47 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/93c99b1499ed/
changeset:   93c99b1499ed
user:        John Glover
date:        2011-09-21 18:27:59
summary:     [search][xs] Test bug fix: check that search is supported before trying to load the home page or checking solr config
affected #:  3 files (-1 bytes)

--- a/ckan/tests/functional/test_cors.py	Wed Sep 21 16:41:51 2011 +0100
+++ b/ckan/tests/functional/test_cors.py	Wed Sep 21 17:27:59 2011 +0100
@@ -1,5 +1,6 @@
 import webtest
 from ckan.tests import TestController
+from ckan.tests import is_search_supported
 
 class TestCORS(TestController):
 
@@ -12,6 +13,12 @@
         assert len(str(out.body)) == 0, 'OPTIONS must return no content'
 
     def test_headers(self):
+        # the home page does a package search so have to skip this test if
+        # search is not supported
+        if not is_search_supported():
+            from nose import SkipTest
+            raise SkipTest("Search not supported")
+
         out = self.app.get('/')
         headers = dict(out.headers)
         print headers


--- a/ckan/tests/functional/test_group.py	Wed Sep 21 16:41:51 2011 +0100
+++ b/ckan/tests/functional/test_group.py	Wed Sep 21 17:27:59 2011 +0100
@@ -4,7 +4,7 @@
 
 from ckan.plugins import SingletonPlugin, implements, IGroupController
 from ckan import plugins
-from ckan.tests import search_related
+from ckan.tests import search_related, is_search_supported
 
 class MockGroupControllerPlugin(SingletonPlugin):
     implements(IGroupController)
@@ -43,6 +43,12 @@
         model.repo.rebuild_db()
 
     def test_mainmenu(self):
+        # the home page does a package search so have to skip this test if
+        # search is not supported
+        if not is_search_supported():
+            from nose import SkipTest
+            raise SkipTest("Search not supported")
+
         offset = url_for(controller='home', action='index')
         res = self.app.get(offset)
         assert 'Groups' in res, res


--- a/ckan/tests/lib/test_solr_search_index.py	Wed Sep 21 16:41:51 2011 +0100
+++ b/ckan/tests/lib/test_solr_search_index.py	Wed Sep 21 17:27:59 2011 +0100
@@ -2,13 +2,17 @@
 from pylons import config
 from ckan import model
 import ckan.lib.search as search 
-from ckan.tests import TestController, CreateTestData, setup_test_search_index
+from ckan.tests import TestController, CreateTestData, setup_test_search_index, is_search_supported
 
 class TestSolrConfig(TestController):
     """
     Make sure that solr is enabled for this ckan instance.
     """
     def test_solr_url_exists(self):
+        if not is_search_supported():
+            from nose import SkipTest
+            raise SkipTest("Search not supported")
+
         assert config.get('solr_url')
         # solr.SolrConnection.query will throw an exception if it can't connect
         conn = solr.SolrConnection(config.get('solr_url'))

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list