0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Update test_single_result to use custom ordering

For consistency with other slicing tests
This commit is contained in:
Karl Hobley 2017-10-19 16:58:13 +01:00
parent ecb52e9271
commit 8cf2c14619
3 changed files with 3 additions and 19 deletions

View File

@ -56,8 +56,3 @@ class TestPostgresSearchBackend(BackendTests, TestCase):
@unittest.expectedFailure
def test_order_by_non_filterable_field(self):
super(TestPostgresSearchBackend, self).test_order_by_non_filterable_field()
# Broken
@unittest.expectedFailure
def test_single_result(self):
super(TestPostgresSearchBackend, self).test_single_result()

View File

@ -331,16 +331,10 @@ class BackendTests(WagtailTestUtils):
# SLICING TESTS
def test_single_result(self):
# Note: different to test_ranking as that casts the results to the list before doing a key lookup
# This test sends the key IDs back into Elasticsearch, performing two separate queries
results = self.backend.search("JavaScript Definitive", models.Book, operator='or')
self.assertEqual(set(r.title for r in results), {
"JavaScript: The good parts",
"JavaScript: The Definitive Guide"
})
results = self.backend.search(None, models.Novel.objects.order_by('number_of_pages'), order_by_relevance=False)
self.assertEqual(results[0].title, "JavaScript: The Definitive Guide")
self.assertEqual(results[1].title, "JavaScript: The good parts")
self.assertEqual(results[0].title, "Foundation")
self.assertEqual(results[1].title, "The Hobbit")
def test_limit(self):
# Note: we need consistant ordering for this test

View File

@ -40,11 +40,6 @@ class TestDBBackend(BackendTests, TestCase):
def test_order_by_non_filterable_field(self):
super(TestDBBackend, self).test_order_by_non_filterable_field()
# Broken
@unittest.expectedFailure
def test_single_result(self):
super(TestDBBackend, self).test_single_result()
# Doesn't support the index API used in this test
@unittest.expectedFailure
def test_same_rank_pages(self):