Skip to content

Commit

Permalink
Coverage | import get task status | tests for flower service failed
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Mar 24, 2022
1 parent 812965a commit fd5288a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/importers/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,23 @@ def test_get_task_pending(self, async_result_klass_mock, task_exists_mock):
self.assertEqual(response.status_code, 202)
self.assertEqual(response.data, dict(task=task_id, state='PENDING', username='foobar', queue='normal'))

@patch('core.importers.views.flower_get')
def test_get_flower_failed(self, flower_get_mock):
flower_get_mock.side_effect = Exception('Service Down')

response = self.client.get(
'/importers/bulk-import/?username=ocladmin',
HTTP_AUTHORIZATION='Token ' + self.token,
format='json'
)

self.assertEqual(response.status_code, 422)
self.assertEqual(
response.data,
dict(detail='Flower service returned unexpected result. Maybe check healthcheck.',
exception=str('Service Down'))
)

def test_post_400(self):
response = self.client.post(
'/importers/bulk-import/?update_if_exists=1',
Expand Down

0 comments on commit fd5288a

Please sign in to comment.