fix(tests): retire les fixtures méthodes de classe

car elle ne sont plus supportées par pytest
cf. https://github.com/pytest-dev/pytest/issues/3778
pull/244/head
Antoine 2023-01-11 15:56:09 +01:00
Parent fc38d524fd
révision a85f90c971
1 fichiers modifiés avec 19 ajouts et 14 suppressions

Voir le fichier

@ -208,9 +208,9 @@ class TestAssociationIndex:
@pytest.mark.django_db
class TestAssociationDetail:
@classmethod
@pytest.fixture(autouse=True)
def setup_class(cls, association):
def setup(self, association):
cls = type(self)
cls.association = association
cls.url = reverse('association:detail', args=[cls.association.id])
@ -558,13 +558,14 @@ class TestAssociationCreate:
class TestProjet(ManagerOnlyViewMixin):
title = "Liste des projets"
@classmethod
@pytest.fixture(autouse=True)
def setup_class(cls, association):
def setup(self, association):
cls = type(self)
cls.association = association
cls.url = reverse(
'association:project:index', args=[cls.association.id]
)
super().setup()
def test_post_create_update_delete(self, client, user, manager):
client.force_login(user)
@ -648,13 +649,14 @@ class TestProjet(ManagerOnlyViewMixin):
class TestEngagement(ManagerOnlyViewMixin):
title = "Liste des bénévoles"
@classmethod
@pytest.fixture(autouse=True)
def setup_class(cls, association):
def setup(self, association):
cls = type(self)
cls.association = association
cls.url = reverse(
'association:engagement:index', args=[cls.association.id]
)
super().setup()
def test_post_create_update_delete(
self, client, mailoutbox, user, manager, foreign
@ -854,11 +856,12 @@ class TestEngagement(ManagerOnlyViewMixin):
class TestLevel(ManagerOnlyViewMixin):
title = "Liste des niveaux"
@classmethod
@pytest.fixture(autouse=True)
def setup_class(cls, association):
def setup(self, association):
cls = type(self)
cls.association = association
cls.url = reverse('association:level:index', args=[cls.association.id])
super().setup()
def test_post_create_update_delete(self, client, user, manager):
client.force_login(user)
@ -942,11 +945,12 @@ class TestLevel(ManagerOnlyViewMixin):
class TestRole(ManagerOnlyViewMixin):
title = "Liste des rôles"
@classmethod
@pytest.fixture(autouse=True)
def setup_class(cls, association):
def setup(self, association):
cls = type(self)
cls.association = association
cls.url = reverse('association:role:index', args=[cls.association.id])
super().setup()
def test_post_create_update_delete(self, client, user, manager):
client.force_login(user)
@ -1117,13 +1121,14 @@ class TestRole(ManagerOnlyViewMixin):
class TestCategory(ManagerOnlyViewMixin):
title = "Liste des catégories"
@classmethod
@pytest.fixture(autouse=True)
def setup_class(cls, association):
def setup(self, association):
cls = type(self)
cls.association = association
cls.url = reverse(
'association:category:index', args=[cls.association.id]
)
super().setup()
def test_post_create_update_delete(self, client, user, manager):
client.force_login(user)
@ -1203,9 +1208,9 @@ class TestCategory(ManagerOnlyViewMixin):
@pytest.mark.django_db
class TestStatistics:
@classmethod
@pytest.fixture(autouse=True)
def setup_class(cls, association):
def setup(self, association):
cls = type(self)
cls.association = association
cls.url = reverse('association:statistics', args=[cls.association.id])