Skip to content

Commit

Permalink
add test to ensure that multiple versions of DEM work with DEMIndex.save
Browse files Browse the repository at this point in the history
#9 type error DEMIndex save
  • Loading branch information
codekiln committed Aug 3, 2018
1 parent db93980 commit 4b30859
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@

from __future__ import (absolute_import, division, print_function, unicode_literals)

from elasticsearch import TransportError
from elasticsearch_dsl.exceptions import IllegalOperation

from django_elastic_migrations import DEMIndexManager
from django_elastic_migrations.utils.test_utils import DEMTestCase
from tests.es_config import ES_CLIENT
from tests.search import MovieSearchIndex, MovieSearchDoc
from tests.models import Movie

Expand All @@ -34,3 +38,15 @@ def test_update_index(self):
results = MovieSearchDoc.get_search(movie_title).execute()
first_result = results[0]
self.assertEqual(str(movie.id), first_result.meta.id)

def test_save_index_elasticsearch_dsl_lt_62(self):
"""
Added for #9 type error DEMIndex save
Tests that DEMIndex.save(using=using) works in 6.1 and 6.2 versions of DEM
"""
try:
# if elasticsearch_dsl <= 6.2, using is not a parameter but shouldn't throw exception
MovieSearchIndex.save(using=ES_CLIENT)
except (TransportError, IllegalOperation):
# the indexes already exist
pass

0 comments on commit 4b30859

Please sign in to comment.