forked from DGNum/gestioCOF
Petits cours : tests
This commit is contained in:
parent
edf6a03bc4
commit
b03cf05ef7
2 changed files with 4 additions and 29 deletions
|
@ -8,7 +8,6 @@ from django.urls import reverse
|
|||
from gestioncof.tests.mixins import ViewTestCaseMixin
|
||||
|
||||
from .utils import (
|
||||
PetitCoursTestHelpers,
|
||||
create_petitcours_ability,
|
||||
create_petitcours_demande,
|
||||
create_petitcours_subject,
|
||||
|
@ -160,9 +159,7 @@ class PetitCoursInscriptionViewTestCase(ViewTestCaseMixin, TestCase):
|
|||
self.assertFalse(self.user.petitcoursability_set.all())
|
||||
|
||||
|
||||
class PetitCoursTraitementViewTestCase(
|
||||
ViewTestCaseMixin, PetitCoursTestHelpers, TestCase
|
||||
):
|
||||
class PetitCoursTraitementViewTestCase(ViewTestCaseMixin, TestCase):
|
||||
url_name = "petits-cours-demande-traitement"
|
||||
|
||||
http_methods = ["GET", "POST"]
|
||||
|
@ -188,14 +185,10 @@ class PetitCoursTraitementViewTestCase(
|
|||
self.demande.matieres.add(self.subject)
|
||||
|
||||
def test_get(self):
|
||||
self.require_custommails()
|
||||
|
||||
resp = self.client.get(self.url)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
def test_get_with_match(self):
|
||||
self.require_custommails()
|
||||
|
||||
create_petitcours_ability(
|
||||
user=self.user, matiere=self.subject, niveau="college"
|
||||
)
|
||||
|
@ -211,8 +204,6 @@ class PetitCoursTraitementViewTestCase(
|
|||
)
|
||||
|
||||
def test_post_with_match(self):
|
||||
self.require_custommails()
|
||||
|
||||
create_petitcours_ability(
|
||||
user=self.user, matiere=self.subject, niveau="college"
|
||||
)
|
||||
|
@ -230,9 +221,7 @@ class PetitCoursTraitementViewTestCase(
|
|||
self.assertIsNotNone(self.demande.processed)
|
||||
|
||||
|
||||
class PetitCoursRetraitementViewTestCase(
|
||||
ViewTestCaseMixin, PetitCoursTestHelpers, TestCase
|
||||
):
|
||||
class PetitCoursRetraitementViewTestCase(ViewTestCaseMixin, TestCase):
|
||||
url_name = "petits-cours-demande-retraitement"
|
||||
|
||||
http_methods = ["GET", "POST"]
|
||||
|
@ -253,8 +242,6 @@ class PetitCoursRetraitementViewTestCase(
|
|||
self.demande = create_petitcours_demande()
|
||||
|
||||
def test_get(self):
|
||||
self.require_custommails()
|
||||
|
||||
resp = self.client.get(self.url)
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
|
||||
from gestioncof.tests.utils import create_user
|
||||
from petitscours.models import (
|
||||
PetitCoursAbility,
|
||||
PetitCoursAttributionCounter,
|
||||
|
@ -13,7 +9,7 @@ from petitscours.models import (
|
|||
|
||||
def create_petitcours_ability(**kwargs):
|
||||
if "user" not in kwargs:
|
||||
kwargs["user"] = create_user()
|
||||
kwargs["user"] = create_user("toto")
|
||||
if "matiere" not in kwargs:
|
||||
kwargs["matiere"] = create_petitcours_subject()
|
||||
if "niveau" not in kwargs:
|
||||
|
@ -29,11 +25,3 @@ def create_petitcours_demande(**kwargs):
|
|||
|
||||
def create_petitcours_subject(**kwargs):
|
||||
return PetitCoursSubject.objects.create(**kwargs)
|
||||
|
||||
|
||||
class PetitCoursTestHelpers:
|
||||
def require_custommails(self):
|
||||
data_file = os.path.join(
|
||||
settings.BASE_DIR, "gestioncof", "management", "data", "custommail.json"
|
||||
)
|
||||
call_command("syncmails", data_file, verbosity=0)
|
||||
|
|
Loading…
Reference in a new issue