Added test that states are unique

This commit is contained in:
Tsa6 2017-09-29 17:40:50 -04:00
parent 40d8d1f5e5
commit 575c3f27cc

View File

@ -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)