def test_set_elastic_method_with_update(self, mocker): mocked_es_update = mocker.patch.object(Elasticsearch, "update") model_mixin = ModelMixin() model_mixin.id = 1 result = model_mixin.set_elastic(body={"field": "updated-value"}, update=True) mocked_es_update.assert_called_once()
def test_set_elastic_method(self, mocker): mocked_es_index = mocker.patch.object(Elasticsearch, "index") model_mixin = ModelMixin() model_mixin.id = 1 result = model_mixin.set_elastic(body={"field": "value"}) mocked_es_index.assert_called_once()