[ckan-changes] commit/ckanext-solr: John Glover: Update tests for extras noting why some parts of the test will fail

Bitbucket commits-noreply at bitbucket.org
Mon Aug 15 14:59:22 UTC 2011


1 new changeset in ckanext-solr:

http://bitbucket.org/okfn/ckanext-solr/changeset/a1dcaaef8f44/
changeset:   a1dcaaef8f44
user:        John Glover
date:        2011-08-15 16:59:15
summary:     Update tests for extras noting why some parts of the test will fail
affected #:  1 file (118 bytes)

--- a/tests/test_package_search.py	Thu Aug 11 17:32:08 2011 +0100
+++ b/tests/test_package_search.py	Mon Aug 15 15:59:15 2011 +0100
@@ -1,4 +1,3 @@
-from pylons import config
 from ckan.tests import TestController, CreateTestData
 from ckan import model
 import ckan.lib.search as search
@@ -299,7 +298,7 @@
             assert expected_pkg in fields, expected_pkg
 
     def _filtered_search(self, value, expected_pkgs, count=None):
-        options = QueryOptions()
+        options = search.QueryOptions()
         options.order_by = 'rank'
         result = self.backend.query_for(model.Package).run(fields={'geographic_coverage':value}, options=options)
         pkgs = result['results']
@@ -344,7 +343,7 @@
         search.get_backend().index_for('Package').clear()
     
     def _do_search(self, department, expected_pkgs, count=None):
-        result = self.backend.query_for(model.Package).run(fields={'department':department})
+        result = self.backend.query_for(model.Package).run(fields={'department': department})
         pkgs = result['results']
         fields = [model.Package.by_name(pkg_name).name for pkg_name in pkgs]
         if not (count is None):
@@ -354,11 +353,13 @@
 
     def test_0_basic(self):
         self._do_search(u'bcd', 'b', 1)
-        # TODO: fix this test
+        self._do_search(u'cde abc', 'c', 1)
+        # TODO: solr is not currently set up to allow partial matches 
+        #       and extras are not saved as multivalued so these
+        #       tests will fail
         # self._do_search(u'abc', ['a', 'c'], 2)
         # self._do_search(u'cde', 'c', 1)
         # self._do_search(u'abc cde', 'c', 1)
-        # self._do_search(u'cde abc', 'c', 1)
 
 class TestRank(TestController):
     @classmethod

Repository URL: https://bitbucket.org/okfn/ckanext-solr/

--

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