Skip to content

Instantly share code, notes, and snippets.

@mcroydon
Created May 7, 2009 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcroydon/108274 to your computer and use it in GitHub Desktop.
Save mcroydon/108274 to your computer and use it in GitHub Desktop.
diff --git a/tests/core/fixtures/initial_data.json b/tests/core/fixtures/initial_data.json
index 199988c..2cc5b6f 100644
--- a/tests/core/fixtures/initial_data.json
+++ b/tests/core/fixtures/initial_data.json
@@ -14,7 +14,7 @@
"fields": {
"user": "daniel2",
"foo": "bar",
- "pub_date": "2009-03-17 06:00:00"
+ "pub_date": "2009-03-17 07:00:00"
}
},
{
@@ -23,7 +23,7 @@
"fields": {
"user": "daniel3",
"foo": "bar",
- "pub_date": "2009-03-17 06:00:00"
+ "pub_date": "2009-03-17 08:00:00"
}
}
]
diff --git a/tests/core/tests/backends/whoosh_backend.py b/tests/core/tests/backends/whoosh_backend.py
index 28874fc..e593209 100644
--- a/tests/core/tests/backends/whoosh_backend.py
+++ b/tests/core/tests/backends/whoosh_backend.py
@@ -148,3 +148,8 @@ class WhooshSearchBackendTestCase(TestCase):
self.sb.delete_index()
self.assertEqual(self.sb.index.doc_count(), 0)
+
+ def test_order_by(self):
+ self.sb.update(self.smmi, self.sample_objs)
+ self.assertEqual([result.pk for result in self.sb.search('*', sort_by=['pub_date'])['results']], [u'1', u'2', u'3'])
+ self.assertEqual([result.pk for result in self.sb.search('*', sort_by=['-pub_date'])['results']], [u'3', u'2', u'1'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment