Fixed web tests

This commit is contained in:
Scott Wallace 2021-12-29 14:39:20 +00:00
parent 95e9db68c1
commit 7b4a18d795
Signed by: scott
GPG key ID: AA742FDC5AFE2A72

View file

@ -36,7 +36,7 @@ class TestWeb(TestCase):
self.assertEqual(response.status_code, 404)
@mock.patch(
'slinky.web.ShortURLForm',
'slinky.web.AddForm',
return_value=mock.Mock(
shortcode=mock.Mock(data=''),
url=mock.Mock(data='https://example.com'),
@ -49,5 +49,8 @@ class TestWeb(TestCase):
"""
Ensure non-unique shortcode generation returns a 500 error
"""
response = web.add()
request = mock.MagicMock()
request.headers = {'X-Forwarded-For': '127.0.0.1'}
with mock.patch("slinky.web.request", request):
response = web.add()
self.assertEqual(response.status_code, 500)