mirror of
https://github.com/ae-utbm/sith.git
synced 2026-06-19 14:32:41 +00:00
use election role name for membership description
This commit is contained in:
@@ -13,6 +13,7 @@ from pytest_django.asserts import assertRedirects
|
||||
from club.models import Club, ClubRole, Membership
|
||||
from core.baker_recipes import subscriber_user
|
||||
from core.models import Group, User
|
||||
from election.forms import ApplyElectionResultForm
|
||||
from election.models import Candidature, Election, ElectionList, Role, Vote
|
||||
|
||||
|
||||
@@ -155,6 +156,19 @@ class TestApplyResult(TestCase):
|
||||
response = self.client.post(self.url, data={"candidates": ids})
|
||||
assert response.status_code == 403
|
||||
|
||||
def test_membership_description(self):
|
||||
"""Test that if club role name and election role name are different,
|
||||
then the election role name is used as membership description.
|
||||
"""
|
||||
form = ApplyElectionResultForm(
|
||||
election=self.election, data={"candidates": [self.candidatures[0].id]}
|
||||
)
|
||||
assert form.is_valid()
|
||||
memberships = form.save()
|
||||
assert len(memberships) == 1
|
||||
assert memberships[0].role == self.club_roles[0]
|
||||
assert memberships[0].description == "election role 1"
|
||||
|
||||
def test_no_result_to_apply(self):
|
||||
self.election.roles.update(club_role=None)
|
||||
user = baker.make(
|
||||
|
||||
Reference in New Issue
Block a user