Added failing test for #937

pull/939/head
Karl Hobley 2015-01-28 09:54:42 +00:00
rodzic aed68f6894
commit 36f782dc03
1 zmienionych plików z 29 dodań i 0 usunięć

Wyświetl plik

@ -135,6 +135,35 @@ class TestElasticSearchBackend(BackendTests, TestCase):
# Even though they both start with the letter "H". This should not be considered a match
self.assertEqual(len(results), 0)
@unittest.expectedFailure
def test_search_with_hyphen(self):
"""
This tests that punctuation characters are treated the same
way in both indexing and querying.
See: https://github.com/torchbox/wagtail/issues/937
"""
# Reset the index
self.backend.reset_index()
self.backend.add_type(models.SearchTest)
self.backend.add_type(models.SearchTestChild)
# Add some test data
obj = models.SearchTest()
obj.title = "Hello-World"
obj.live = True
obj.save()
self.backend.add(obj)
# Refresh the index
self.backend.refresh_index()
# Test search for "Hello-World"
results = self.backend.search("Hello-World", models.SearchTest.objects.all())
# Should find the result
self.assertEqual(len(results), 1)
class TestElasticSearchQuery(TestCase):
def assertDictEqual(self, a, b):