mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-07-04 19:04:03 +02:00
Add a lot of comments
This commit is contained in:
@ -10,6 +10,9 @@ from .models import CoachRegistration, Registration, StudentRegistration
|
||||
|
||||
class TestIndexPage(TestCase):
|
||||
def test_index(self) -> None:
|
||||
"""
|
||||
Display the index page, without any right.
|
||||
"""
|
||||
response = self.client.get(reverse("index"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@ -29,6 +32,9 @@ class TestRegistration(TestCase):
|
||||
CoachRegistration.objects.create(user=self.coach, professional_activity="Teacher")
|
||||
|
||||
def test_admin_pages(self):
|
||||
"""
|
||||
Check that admin pages are rendering successfully.
|
||||
"""
|
||||
response = self.client.get(reverse("admin:index") + "registration/registration/")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@ -45,6 +51,9 @@ class TestRegistration(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_registration(self):
|
||||
"""
|
||||
Ensure that the signup form is working successfully.
|
||||
"""
|
||||
response = self.client.get(reverse("registration:signup"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@ -109,6 +118,9 @@ class TestRegistration(TestCase):
|
||||
self.assertRedirects(response, reverse("registration:email_validation_sent"), 302, 200)
|
||||
|
||||
def test_login(self):
|
||||
"""
|
||||
With a registered user, try to log in
|
||||
"""
|
||||
response = self.client.get(reverse("login"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@ -127,6 +139,9 @@ class TestRegistration(TestCase):
|
||||
self.assertRedirects(response, reverse("index"), 302, 200)
|
||||
|
||||
def test_user_detail(self):
|
||||
"""
|
||||
Load a user detail page.
|
||||
"""
|
||||
response = self.client.get(reverse("registration:my_account_detail"))
|
||||
self.assertRedirects(response, reverse("registration:user_detail", args=(self.user.pk,)))
|
||||
|
||||
@ -134,6 +149,9 @@ class TestRegistration(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_update_user(self):
|
||||
"""
|
||||
Update the user information, for each type of user.
|
||||
"""
|
||||
for user, data in [(self.user, dict(role="Bot")),
|
||||
(self.student, dict(student_class=11, school="Sky")),
|
||||
(self.coach, dict(professional_activity="God"))]:
|
||||
@ -162,6 +180,9 @@ class TestRegistration(TestCase):
|
||||
self.assertEqual(user.first_name, "Changed")
|
||||
|
||||
def test_upload_photo_authorization(self):
|
||||
"""
|
||||
Try to upload a photo authorization.
|
||||
"""
|
||||
response = self.client.get(reverse("registration:upload_user_photo_authorization",
|
||||
args=(self.student.registration.pk,)))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
Reference in New Issue
Block a user