diff --git a/tests/test_web.py b/tests/test_web.py index 4dda8b6..2f0c6ef 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -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)