mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-08-21 16:07:22 +02:00
Cover also settings files, keep 100% coverage by ignoring production files
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from datetime import timedelta
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
@@ -652,6 +653,14 @@ class TestStudentParticipation(TestCase):
|
||||
))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Unauthenticated user can't update the calendar
|
||||
self.client.logout()
|
||||
response = self.client.get(reverse("participation:calendar"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response = self.client.get(reverse("participation:update_phase", args=(2,)))
|
||||
self.assertRedirects(response, reverse("login") + "?next=" +
|
||||
reverse("participation:update_phase", args=(2,)), 302, 200)
|
||||
|
||||
def test_forbidden_access(self):
|
||||
"""
|
||||
Load personnal pages and ensure that these are protected.
|
||||
@@ -682,6 +691,22 @@ class TestStudentParticipation(TestCase):
|
||||
resp = self.client.get(reverse("participation:delete_question", args=(question.pk,)))
|
||||
self.assertEqual(resp.status_code, 403)
|
||||
|
||||
def test_cover_matrix(self):
|
||||
"""
|
||||
Load matrix scripts, to cover them and ensure that they can run.
|
||||
"""
|
||||
self.user.registration.team = self.team
|
||||
self.user.registration.save()
|
||||
self.second_user.registration.team = self.second_team
|
||||
self.second_user.registration.save()
|
||||
self.team.participation.valid = True
|
||||
self.team.participation.received_participation = self.second_team.participation
|
||||
self.team.participation.save()
|
||||
|
||||
call_command('fix_matrix_channels')
|
||||
call_command('setup_third_phase')
|
||||
os.remove(".matrix_avatar")
|
||||
|
||||
|
||||
class TestAdmin(TestCase):
|
||||
def setUp(self) -> None:
|
||||
|
Reference in New Issue
Block a user