[ckan-changes] commit/ckanext-solr: John Glover: Fix broken test in test_order_by

Bitbucket commits-noreply at bitbucket.org
Mon Aug 15 15:20:44 UTC 2011


1 new changeset in ckanext-solr:

http://bitbucket.org/okfn/ckanext-solr/changeset/aa298d8c3ece/
changeset:   aa298d8c3ece
user:        John Glover
date:        2011-08-15 17:20:40
summary:     Fix broken test in test_order_by
affected #:  1 file (81 bytes)

--- a/tests/test_package_search.py	Mon Aug 15 15:59:15 2011 +0100
+++ b/tests/test_package_search.py	Mon Aug 15 16:20:40 2011 +0100
@@ -192,14 +192,14 @@
         assert fields == sorted_fields, repr(fields) + repr(sorted_fields)
 
         # extra field
-        # TODO: Fix this test
-        # options = SearchOptions({'q':self.q_all})
-        # options.order_by = 'date_released'
-        # result = Search().run(options)
-        # pkgs = result['results']
-        # fields = [model.Package.by_name(pkg_name).extras.get('date_released') for pkg_name in pkgs]
-        # sorted_fields = fields; sorted_fields.sort()
-        # assert fields == sorted_fields, repr(fields) + repr(sorted_fields)
+        options = search.QueryOptions()
+        options.order_by = 'date_released'
+        result = self.backend.query_for(model.Package).run(query=self.q_all, options=options)
+        pkgs = result['results']
+        fields = [model.Package.by_name(pkg_name) for pkg_name in pkgs]
+        fields = [field.extras.get('date_released') for field in fields]
+        sorted_fields = fields; sorted_fields.sort()
+        assert fields == sorted_fields, repr(fields) + repr(sorted_fields)
 
     def test_search_notes_on(self):
         result = self.backend.query_for(model.Package).run(query=u'restrictions')
@@ -356,7 +356,7 @@
         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
+        #       tests will fail. Make multivalued or remote these?
         # self._do_search(u'abc', ['a', 'c'], 2)
         # self._do_search(u'cde', 'c', 1)
         # self._do_search(u'abc cde', 'c', 1)

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