Add test for empty urls

This commit is contained in:
sqozz 2018-05-01 03:51:57 +02:00
parent 51e8e32dee
commit c347d53e1a
1 changed files with 7 additions and 0 deletions

View File

@ -46,6 +46,13 @@ class SchortRegressionTests(unittest.TestCase, WebTestCase):
req = self.assertPostReq(BASE_URL + "/", data={"url" : "https://github.com/sqozz/schort"})
self.assertEqual(req.status_code, 200, msg="Could not handle a request without wishId in the parameter-list")
def test_empty_url(self):
"""Test an empty user supplied URL"""
req = requests.post(BASE_URL + "/", data={"url": ""})
self.assertEqual(req.status_code, 400, msg="Could not handle a request with empty url")
req = requests.post(BASE_URL + "/", data={})
self.assertEqual(req.status_code, 400, msg="Could not handle a request with url at all")
class SchortShortLinkCase(object):
pass