From c347d53e1abd1a718f03dcb62ca49a4eaaa3f14c Mon Sep 17 00:00:00 2001 From: sqozz Date: Tue, 1 May 2018 03:51:57 +0200 Subject: [PATCH] Add test for empty urls --- tests/functional_tests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/functional_tests.py b/tests/functional_tests.py index a91c4a4..1c04079 100755 --- a/tests/functional_tests.py +++ b/tests/functional_tests.py @@ -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