Skip to content

Commit c0eda4c

Browse files
committed
more test fix
1 parent 31b6ecb commit c0eda4c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

django_elasticsearch_dsl/documents.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def bulk(self, actions, **kwargs):
131131
def _prepare_action(self, object_instance, action):
132132
return {
133133
'_op_type': action,
134-
'_index': str(self._index),
135-
'_type': self._doc_type.mapping.doc_type,
134+
'_index': self._index._name,
135+
'_type': self._doc_type.name,
136136
'_id': object_instance.pk,
137137
'_source': (
138138
self.prepare(object_instance) if action != 'delete' else None

tests/test_documents.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def prepare_color(self, instance):
4444
return "blue"
4545

4646
class Meta:
47-
doc_type = MetaField('car_document')
47+
doc_type = 'car_document'
4848

4949
class Django:
5050
fields = ['name', 'price']
@@ -217,7 +217,7 @@ def test_model_instance_update(self):
217217
)
218218
self.assertTrue(mock.call_args_list[0][1]['refresh'])
219219
self.assertEqual(
220-
doc.connection, mock.call_args_list[0][1]['client']
220+
doc._index.connection, mock.call_args_list[0][1]['client']()
221221
)
222222

223223
def test_model_instance_iterable_update(self):
@@ -258,7 +258,7 @@ def test_model_instance_iterable_update(self):
258258
)
259259
self.assertTrue(mock.call_args_list[0][1]['refresh'])
260260
self.assertEqual(
261-
doc.connection, mock.call_args_list[0][1]['client']
261+
doc._index.connection, mock.call_args_list[0][1]['client']()
262262
)
263263

264264
def test_model_instance_update_no_refresh(self):

0 commit comments

Comments
 (0)