mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 13:58:25 +02:00
Fix tests
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
# Generated by Django 3.0.11 on 2020-12-30 12:02
|
||||
|
||||
from datetime import date
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
@ -78,8 +80,8 @@ class Migration(migrations.Migration):
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, unique=True, verbose_name='name')),
|
||||
('date_start', models.DateField(default=django.utils.timezone.now, verbose_name='start')),
|
||||
('date_end', models.DateField(default=django.utils.timezone.now, verbose_name='end')),
|
||||
('date_start', models.DateField(default=date.today, verbose_name='start')),
|
||||
('date_end', models.DateField(default=date.today, verbose_name='end')),
|
||||
('inscription_limit', models.DateTimeField(default=django.utils.timezone.now, verbose_name='limit date for registrations')),
|
||||
('solution_limit', models.DateTimeField(default=django.utils.timezone.now, verbose_name='limit date to upload solutions')),
|
||||
('syntheses_first_phase_limit', models.DateTimeField(default=django.utils.timezone.now, verbose_name='limit date to upload the syntheses for the first phase')),
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from datetime import date
|
||||
import os
|
||||
|
||||
from address.models import AddressField
|
||||
@ -123,12 +124,12 @@ class Tournament(models.Model):
|
||||
|
||||
date_start = models.DateField(
|
||||
verbose_name=_("start"),
|
||||
default=timezone.now,
|
||||
default=date.today,
|
||||
)
|
||||
|
||||
date_end = models.DateField(
|
||||
verbose_name=_("end"),
|
||||
default=timezone.now,
|
||||
default=date.today,
|
||||
)
|
||||
|
||||
place = AddressField(
|
||||
|
@ -9,7 +9,7 @@ from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from registration.models import CoachRegistration, StudentRegistration
|
||||
|
||||
from .models import Participation, Team
|
||||
from .models import Participation, Team, Tournament
|
||||
|
||||
|
||||
class TestStudentParticipation(TestCase):
|
||||
@ -67,6 +67,11 @@ class TestStudentParticipation(TestCase):
|
||||
)
|
||||
CoachRegistration.objects.create(user=self.coach)
|
||||
|
||||
self.tournament = Tournament.objects.create(
|
||||
name="France",
|
||||
place="Here",
|
||||
)
|
||||
|
||||
def test_admin_pages(self):
|
||||
"""
|
||||
Load Django-admin pages.
|
||||
@ -347,6 +352,7 @@ class TestStudentParticipation(TestCase):
|
||||
))
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
self.team.participation.tournament = self.tournament
|
||||
self.team.participation.valid = False
|
||||
self.team.participation.save()
|
||||
|
||||
|
@ -174,10 +174,10 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
|
||||
# A team is complete when there are at least 4 members plus a coache that have sent their authorizations,
|
||||
# their health sheet, they confirmed their email address and under-18 people sent their parental authorization.
|
||||
context["can_validate"] = team.students.count() >= 4 and team.coaches.exists() and \
|
||||
all(r.email_confirmed for r in team.students.all()) and \
|
||||
all(r.photo_authorization for r in team.participants.all()) and \
|
||||
all(r.health_sheet for r in team.participants.all()) and \
|
||||
all(r.parental_authorization for r in team.students.all() if r.under_18)
|
||||
all(r.email_confirmed for r in team.students.all()) and \
|
||||
all(r.photo_authorization for r in team.participants.all()) and \
|
||||
all(r.health_sheet for r in team.participants.all()) and \
|
||||
all(r.parental_authorization for r in team.students.all() if r.under_18)
|
||||
|
||||
return context
|
||||
|
||||
|
Reference in New Issue
Block a user