Split up backend tests

This commit is contained in:
Karl Hobley 2014-06-22 16:51:06 +01:00 committed by Karl Hobley
parent 2100c6372d
commit 2679dc2fe6
3 changed files with 31 additions and 21 deletions

View file

@ -151,27 +151,6 @@ class BackendTests(object):
self.assertEqual(len(results), 3)
class TestDBBackend(BackendTests, TestCase):
backend_path = 'wagtail.wagtailsearch.backends.db.DBSearch'
@unittest.expectedFailure
def test_callable_indexed_field(self):
super(TestDBBackend, self).test_callable_indexed_field()
class TestElasticSearchBackend(BackendTests, TestCase):
backend_path = 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch'
def test_search_with_spaces_only(self):
# Search for some space characters and hope it doesn't crash
results = self.backend.search(" ", models.SearchTest)
# Queries are lazily evaluated, force it to run
list(results)
# Didn't crash, yay!
@override_settings(WAGTAILSEARCH_BACKENDS={
'default': {'BACKEND': 'wagtail.wagtailsearch.backends.db.DBSearch'}
})

View file

@ -0,0 +1,13 @@
from wagtail.tests.utils import unittest
from django.test import TestCase
from .test_backends import BackendTests
class TestDBBackend(BackendTests, TestCase):
backend_path = 'wagtail.wagtailsearch.backends.db.DBSearch'
@unittest.expectedFailure
def test_callable_indexed_field(self):
super(TestDBBackend, self).test_callable_indexed_field()

View file

@ -0,0 +1,18 @@
from wagtail.tests.utils import unittest
from django.test import TestCase
from .test_backends import BackendTests
class TestElasticSearchBackend(BackendTests, TestCase):
backend_path = 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch'
def test_search_with_spaces_only(self):
# Search for some space characters and hope it doesn't crash
results = self.backend.search(" ", models.SearchTest)
# Queries are lazily evaluated, force it to run
list(results)
# Didn't crash, yay!