diff --git a/apps/member/tests/test_login.py b/apps/member/tests/test_login.py new file mode 100644 index 00000000..6b712687 --- /dev/null +++ b/apps/member/tests/test_login.py @@ -0,0 +1,52 @@ +# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + +from django.contrib.auth.models import User +from django.test import TestCase + +""" +Test that login page still works +""" + + +class TemplateLoggedOutTests(TestCase): + def test_login_page(self): + response = self.client.get('/accounts/login/') + self.assertEqual(response.status_code, 200) + + +class TemplateLoggedInTests(TestCase): + def setUp(self): + self.user = User.objects.create_superuser( + username="admin", + password="adminadmin", + email="admin@example.com", + ) + self.client.force_login(self.user) + sess = self.client.session + sess["permission_mask"] = 42 + sess.save() + + def test_login_page(self): + response = self.client.get('/accounts/login/') + self.assertEqual(response.status_code, 200) + + def test_admin_index(self): + response = self.client.get('/admin/') + self.assertEqual(response.status_code, 200) + + def test_accounts_password_reset(self): + response = self.client.get('/accounts/password_reset/') + self.assertEqual(response.status_code, 200) + + def test_logout_page(self): + response = self.client.get('/accounts/logout/') + self.assertEqual(response.status_code, 200) + + def test_transfer_page(self): + response = self.client.get('/note/transfer/') + self.assertEqual(response.status_code, 200) + + def test_consos_page(self): + response = self.client.get('/note/consos/') + self.assertEqual(response.status_code, 200)