Here are the examples of the python api elasticutils.contrib.django.S taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Example 1
def test_get_doctypes(self):
"""Test get_doctypes always returns a list of strings."""
# Pulls from ._meta.db_table.
s = S(FakeDjangoMappingType)
eq_(s.get_doctypes(), ['fake'])
# Pulls from doctypes.
s = S(FakeDjangoMappingType).doctypes('footype')
eq_(s.get_doctypes(), ['footype'])
s = S(FakeDjangoMappingType).doctypes('footype', 'footype2')
eq_(s.get_doctypes(), ['footype', 'footype2'])
s = S(FakeDjangoMappingType).doctypes('footype').doctypes('footype2')
eq_(s.get_doctypes(), ['footype2'])
0
Example 2
Project: elasticutils Source File: test_query.py
def test_q_all(self):
eq_(len(S(FakeDjangoMappingType)), 5)
0
Example 3
Project: elasticutils Source File: test_s.py
def test_get_indexes(self):
"""Test get_indexes always returns a list of strings."""
# Pulls it from ES_INDEXES (list of strings).
s = S(FakeDjangoMappingType)
eq_(s.get_indexes(), ['elasticutilstest'])
# Pulls it from ES_INDEXES (string).
old_indexes = settings.ES_INDEXES
try:
settings.ES_INDEXES = {'default': 'elasticutilstest'}
s = S(FakeDjangoMappingType)
eq_(s.get_indexes(), ['elasticutilstest'])
finally:
settings.ES_INDEXES = old_indexes
# Pulls from indexes.
s = S(FakeDjangoMappingType).indexes('footest')
eq_(s.get_indexes(), ['footest'])
s = S(FakeDjangoMappingType).indexes('footest', 'footest2')
eq_(s.get_indexes(), ['footest', 'footest2'])
s = S(FakeDjangoMappingType).indexes('footest').indexes('footest2')
eq_(s.get_indexes(), ['footest2'])