Skip to content

Commit

Permalink
Included test to check if error message is being passed appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
WinnyTroy committed Jan 4, 2019
1 parent b3c0a4f commit e4dbef2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions onadata/libs/tests/utils/test_viewer_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

0 comments on commit e4dbef2

Please sign in to comment.