From e4dbef2e335a052a5243657522091aba5ad5fdc5 Mon Sep 17 00:00:00 2001 From: WinnyTroy Date: Fri, 4 Jan 2019 14:14:04 +0300 Subject: [PATCH] Included test to check if error message is being passed appropriately --- onadata/libs/tests/utils/test_viewer_tools.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/onadata/libs/tests/utils/test_viewer_tools.py b/onadata/libs/tests/utils/test_viewer_tools.py index dc04936123..bbe7d8163c 100644 --- a/onadata/libs/tests/utils/test_viewer_tools.py +++ b/onadata/libs/tests/utils/test_viewer_tools.py @@ -172,11 +172,12 @@ def test_get_form_url(self): @override_settings(TESTING_MODE=False, ENKETO_URL='https://enketo.ona.io') @requests_mock.Mocker() def test_get_submissions_url(self, mocked): - request = RequestFactory().get('/') """Test get_submissions_url(). - Ensures appropriate data is being received. + Ensures appropriate url is being received. """ + request = RequestFactory().get('/') + mocked_response = { "single_url": "https://enketo.ona.io/single/::XZqoZ94y", "code": 200 @@ -195,3 +196,12 @@ def test_get_submissions_url(self, mocked): self.assertEqual( response, 'https://enketo.ona.io/single/::XZqoZ94y') + + @override_settings(TESTING_MODE=False) + def test_get_submissions_url_error_action(self): + """Test get_submissions_url().""" + request = RequestFactory().get('/') + + with self.assertRaises(EnketoError): + get_submission_url( + request, username='Milly', id_string="tag_team", xform_pk=1)