def test_get_elastic_method_without_search(self): model_mixin = ModelMixin() model_mixin.elastic = dict(_id=1, status="not found") result = model_mixin.get_elastic() assert result == model_mixin.elastic
def test_get_elastic_method(self, mocker): mocked_es_get = mocker.patch.object(Elasticsearch, "get") model_mixin = ModelMixin() model_mixin.id = 1 model_mixin.get_elastic() mocked_es_get.assert_called_once()
def test_get_elastic_method_as_json(self): model_mixin = ModelMixin() model_mixin.elastic = dict(_id=1, status="not found") expected = json.dumps(model_mixin.elastic) result = model_mixin.get_elastic(as_json=True) assert result == expected