mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 02:24:26 +00:00
clubs: adapt tests to new display and fix form validation issue for start_date
This commit is contained in:
parent
3eb3565a63
commit
68f61a432a
@ -47,6 +47,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<form action="{{ url('club:club_members', club_id=club.id) }}" id="add_users" method="post">
|
<form action="{{ url('club:club_members', club_id=club.id) }}" id="add_users" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
{{ form.non_field_errors() }}
|
||||||
<p>
|
<p>
|
||||||
{{ form.users.errors }}
|
{{ form.users.errors }}
|
||||||
<label for="{{ form.users.id_for_label }}">{{ form.users.label }} :</label>
|
<label for="{{ form.users.id_for_label }}">{{ form.users.label }} :</label>
|
||||||
@ -58,6 +59,13 @@
|
|||||||
<label for="{{ form.role.id_for_label }}">{{ form.role.label }} :</label>
|
<label for="{{ form.role.id_for_label }}">{{ form.role.label }} :</label>
|
||||||
{{ form.role }}
|
{{ form.role }}
|
||||||
</p>
|
</p>
|
||||||
|
{% if form.start_date %}
|
||||||
|
<p>
|
||||||
|
{{ form.start_date.errors }}
|
||||||
|
<label for="{{ form.start_date.id_for_label }}">{{ form.start_date.label }} :</label>
|
||||||
|
{{ form.start_date }}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
<p>
|
<p>
|
||||||
{{ form.description.errors }}
|
{{ form.description.errors }}
|
||||||
<label for="{{ form.description.id_for_label }}">{{ form.description.label }} :</label>
|
<label for="{{ form.description.id_for_label }}">{{ form.description.label }} :</label>
|
||||||
|
@ -71,7 +71,8 @@ class ClubTest(TestCase):
|
|||||||
self.assertTrue(response.status_code == 200)
|
self.assertTrue(response.status_code == 200)
|
||||||
content = str(response.content)
|
content = str(response.content)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
"S' Kia</a></td>\\n <td>Responsable info</td>" in content
|
"S' Kia</a></td>\\n <td>Responsable info</td>"
|
||||||
|
in content
|
||||||
)
|
)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
"Richard Batsbak</a></td>\\n <td>Responsable info</td>"
|
"Richard Batsbak</a></td>\\n <td>Responsable info</td>"
|
||||||
@ -215,7 +216,8 @@ class ClubTest(TestCase):
|
|||||||
in content
|
in content
|
||||||
)
|
)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
"S' Kia</a></td>\\n <td>Responsable info</td>" in content
|
"S' Kia</a></td>\\n <td>Responsable info</td>"
|
||||||
|
in content
|
||||||
)
|
)
|
||||||
|
|
||||||
# Skia is board member so he should be able to mark as old even without being in the club
|
# Skia is board member so he should be able to mark as old even without being in the club
|
||||||
@ -265,7 +267,8 @@ class ClubTest(TestCase):
|
|||||||
in content
|
in content
|
||||||
)
|
)
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
"S' Kia</a></td>\\n <td>Responsable info</td>" in content
|
"S' Kia</a></td>\\n <td>Responsable info</td>"
|
||||||
|
in content
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_mark_old_user_to_club_from_richard_ok(self):
|
def test_mark_old_user_to_club_from_richard_ok(self):
|
||||||
@ -297,7 +300,8 @@ class ClubTest(TestCase):
|
|||||||
in content
|
in content
|
||||||
)
|
)
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
"S' Kia</a></td>\\n <td>Responsable info</td>" in content
|
"S' Kia</a></td>\\n <td>Responsable info</td>"
|
||||||
|
in content
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test with lower rights
|
# Test with lower rights
|
||||||
@ -366,5 +370,6 @@ class ClubTest(TestCase):
|
|||||||
"Richard Batsbak</a></td>\\n <td>Curieux</td>" in content
|
"Richard Batsbak</a></td>\\n <td>Curieux</td>" in content
|
||||||
)
|
)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
"S' Kia</a></td>\\n <td>Responsable info</td>" in content
|
"S' Kia</a></td>\\n <td>Responsable info</td>"
|
||||||
|
in content
|
||||||
)
|
)
|
||||||
|
@ -397,6 +397,10 @@ class ClubMemberForm(forms.Form):
|
|||||||
"""
|
"""
|
||||||
cleaned_data = super(ClubMemberForm, self).clean()
|
cleaned_data = super(ClubMemberForm, self).clean()
|
||||||
|
|
||||||
|
if "start_date" in cleaned_data and not cleaned_data["start_date"]:
|
||||||
|
# Drop start_date if allowed to edition but not specified
|
||||||
|
cleaned_data.pop("start_date")
|
||||||
|
|
||||||
if not cleaned_data.get("users"):
|
if not cleaned_data.get("users"):
|
||||||
# No user to add equals no check needed
|
# No user to add equals no check needed
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
Loading…
Reference in New Issue
Block a user