From 7b4a18d795a610a8f7482bb92cb0b2a0ff492193 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Wed, 29 Dec 2021 14:39:20 +0000 Subject: [PATCH] Fixed web tests --- tests/test_web.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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)