Fixed web tests
This commit is contained in:
parent
95e9db68c1
commit
7b4a18d795
|
@ -36,7 +36,7 @@ class TestWeb(TestCase):
|
||||||
self.assertEqual(response.status_code, 404)
|
self.assertEqual(response.status_code, 404)
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
'slinky.web.ShortURLForm',
|
'slinky.web.AddForm',
|
||||||
return_value=mock.Mock(
|
return_value=mock.Mock(
|
||||||
shortcode=mock.Mock(data=''),
|
shortcode=mock.Mock(data=''),
|
||||||
url=mock.Mock(data='https://example.com'),
|
url=mock.Mock(data='https://example.com'),
|
||||||
|
@ -49,5 +49,8 @@ class TestWeb(TestCase):
|
||||||
"""
|
"""
|
||||||
Ensure non-unique shortcode generation returns a 500 error
|
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)
|
self.assertEqual(response.status_code, 500)
|
||||||
|
|
Loading…
Reference in a new issue