Skip to content

Commit 6c098b5

Browse files
author
Mathieu Chataigner
committed
Add test for value not found in ES backend
1 parent afe3457 commit 6c098b5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

t/unit/backends/test_elasticsearch.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ def test_get_none(self):
6060
index=x.index,
6161
)
6262

63+
def test_get_task_not_found(self):
64+
x = ElasticsearchBackend(app=self.app)
65+
x._server = Mock()
66+
x._server.get.side_effect = [
67+
exceptions.NotFoundError(404, '{"_index":"celery","_type":"_doc","_id":"toto","found":false}',
68+
{'_index': 'celery', '_type': '_doc', '_id': 'toto', 'found': False})
69+
]
70+
71+
res = x.get(sentinel.task_id)
72+
assert res == None
73+
6374
def test_delete(self):
6475
x = ElasticsearchBackend(app=self.app)
6576
x._server = Mock()

0 commit comments

Comments
 (0)