Skip to content

Commit

Permalink
Use SphinxTestCase for search tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
davedash committed Jul 16, 2010
1 parent ab82dc6 commit b048371
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion apps/search/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class SearchTest(SphinxTestCase):
def test_query(self):
eq_(num_results(), 28)

def test_default_ordering(self):
"An empty query should return results in rev-chron order."
import pdb; pdb.set_trace()

def test_product_filter(self):
eq_(num_results(product=1), 28)
eq_(num_results(product=2), 0)
Expand All @@ -88,7 +92,7 @@ def test_date_filter(self):
eq_(num_results(date_start=start, date_end=end), 5)


class SearchViewTest(test_utils.TestCase):
class SearchViewTest(SphinxTestCase):
"""Tests relating to the search template rendering."""

def test_pagination_max(self):
Expand Down
10 changes: 5 additions & 5 deletions apps/search/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ def reindex(rotate=False):
if rotate: # pragma: no cover
calls.append('--rotate')

print call(calls)[0]
call(calls)[0]


def start_sphinx():
"""
Starts sphinx. Note this is only to be used in dev and test environments.
"""

print call([settings.SPHINX_SEARCHD, '--config',
settings.SPHINX_CONFIG_PATH])[0]
call([settings.SPHINX_SEARCHD, '--config',
settings.SPHINX_CONFIG_PATH])[0]


def stop_sphinx():
"""
Stops sphinx. Note this is only to be used in dev and test environments.
"""

print call([settings.SPHINX_SEARCHD, '--stop', '--config',
settings.SPHINX_CONFIG_PATH])[0]
call([settings.SPHINX_SEARCHD, '--stop', '--config',
settings.SPHINX_CONFIG_PATH])[0]
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def JINJA_CONFIG():
SPHINX_SEARCHD = 'searchd'
SPHINX_INDEXER = 'indexer'
SPHINX_CATALOG_PATH = path('tmp/data/sphinx')
SPHINX_LOG_PATH = path('tmp')
SPHINX_LOG_PATH = path('tmp/log/searchd')
SPHINX_CONFIG_PATH = path('configs/sphinx/sphinx.conf')
SEARCH_PERPAGE = 20 # results per page

Expand Down

0 comments on commit b048371

Please sign in to comment.