From 575c3f27cc8e29097608d108d7c8ee8e588cc8ed Mon Sep 17 00:00:00 2001 From: Tsa6 Date: Fri, 29 Sep 2017 17:40:50 -0400 Subject: [PATCH] Added test that states are unique --- tests/LandingPage/test_views.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/LandingPage/test_views.py b/tests/LandingPage/test_views.py index e8fe503..4615965 100644 --- a/tests/LandingPage/test_views.py +++ b/tests/LandingPage/test_views.py @@ -82,3 +82,15 @@ 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_states_unique(self): + with responses.RequestsMock() as rm: + client1 = Client() + resp1 = client1.get('/login') + state1 = parse.parse_qs(parse.urlparse(resp1['Location']).query)['state'][0] + + client2 = Client() + resp2 = client2.get('/login') + state2 = parse.parse_qs(parse.urlparse(resp2['Location']).query)['state'][0] + + self.assertNotEqual(state1,state2)