Small fix in log out + tests
This commit is contained in:
parent
152bd67c70
commit
7f6ad037de
2 changed files with 10 additions and 7 deletions
|
@ -319,9 +319,6 @@ def student_data(request, *args, **kwargs):
|
|||
return redirect('../')
|
||||
|
||||
def log_out(request, *args, **kwargs):
|
||||
if request.session.has_key('is_logged'):
|
||||
del request.session[request.session.session_key]
|
||||
del request.session['is_logged']
|
||||
return JsonResponse({'logOut': True})
|
||||
else:
|
||||
return redirect('../')
|
||||
del request.session[request.session.session_key]
|
||||
del request.session['is_logged']
|
||||
return JsonResponse({'logOut': True})
|
|
@ -48,6 +48,7 @@ class TestViews(TestCase):
|
|||
joanna_data = students[3]
|
||||
cookies_data['data']['register_r']['data'] = [joanna_data]
|
||||
get_data_test(self.client, cookies_data, self.assertEquals)
|
||||
log_out_test(self.client, self.assertEquals)
|
||||
|
||||
|
||||
def get_data_test(client, cookies_data, assertEquals):
|
||||
|
@ -137,4 +138,9 @@ def get_data_test(client, cookies_data, assertEquals):
|
|||
'message_id': id
|
||||
}
|
||||
response = client.post(reverse('message_content'), content_type='application/xml', data=json.dumps(send_data))
|
||||
assertEquals(response.status_code, 200)
|
||||
assertEquals(response.status_code, 200)
|
||||
|
||||
def log_out_test(client, assertEquals):
|
||||
#LOG OUT
|
||||
response = client.get(reverse('log_out'), content_type='application/xml')
|
||||
assertEquals(response.status_code, 200)
|
Loading…
Reference in a new issue