From 491a86f4786a0546d60b8beb417c0597f81a4d5e Mon Sep 17 00:00:00 2001 From: Tsa6 Date: Fri, 29 Sep 2017 17:25:12 -0400 Subject: [PATCH] Added test to reject bad state tokens --- tests/LandingPage/test_views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/LandingPage/test_views.py b/tests/LandingPage/test_views.py index fd6709d..1e31b59 100644 --- a/tests/LandingPage/test_views.py +++ b/tests/LandingPage/test_views.py @@ -44,3 +44,9 @@ class TestLogin(TestCase): self.assertEqual(client.session['user_id'], '935a41b5-b38d-42c3-96ef-653402fc44ca') self.assertEqual(client.session['token'],'1accesstoken1') self.assertEqual(client.session['disp_name'], 'Mr. Smith') + + def test_reject_bad_state(self): + with responses.RequestsMock() as rm: + client = Client() + resp = client.get('/login/redirect?state=%s&code=%s'%('bad_state', 'code')) + self.assertEqual(resp.status_code, 400)