Skip to content

Commit

Permalink
Add check for titles with url domain as value
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Ekisa <[email protected]>
  • Loading branch information
ivermac committed Feb 1, 2021
1 parent 62ab134 commit bc4baf4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions onadata/apps/api/tests/viewsets/test_xform_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2714,13 +2714,23 @@ def test_update_xform_using_put_with_invalid_input(self):
'version': unsanitized_html_str
}

# trigger error is form version is invalid
with self.assertRaises(XLSFormError) as err:
request = self.factory.put('/', data=put_data, **self.extra)
response = view(request, pk=form_id)

self.assertEqual(
"Invalid title value; shouldn't matches a url",
"Invalid title value; value shouldn't match a URL",
str(err.exception)
)

put_data['title'] = 'api.kfc.burger-king.nandos.io'

with self.assertRaises(XLSFormError) as err:
request = self.factory.put('/', data=put_data, **self.extra)
response = view(request, pk=form_id)

self.assertEqual(
"Invalid title value; value shouldn't match a URL",
str(err.exception)
)

Expand Down

0 comments on commit bc4baf4

Please sign in to comment.