Skip to content

Instantly share code, notes, and snippets.

@bwreilly
Last active December 20, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bwreilly/6050981 to your computer and use it in GitHub Desktop.
Save bwreilly/6050981 to your computer and use it in GitHub Desktop.
testing search in django (haystack)
TEST_INDEX = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'TIMEOUT': 60 * 10,
'INDEX_NAME': 'test_index',
},
}
@override_settings(HAYSTACK_CONNECTIONS=TEST_INDEX)
class BaseTestCase(TestCase):
def setUp(self):
haystack.connections.reload('default')
super(BaseTestCase, self).setUp()
def tearDown(self):
call_command('clear_index', interactive=False, verbosity=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment