mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-12 12:57:28 +02:00
Tests et permissions
This commit is contained in:
parent
e617048332
commit
40ac1daece
@ -4694,6 +4694,7 @@
|
|||||||
"name": "GC WEI",
|
"name": "GC WEI",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
22,
|
22,
|
||||||
|
62,
|
||||||
70,
|
70,
|
||||||
72,
|
72,
|
||||||
76,
|
76,
|
||||||
@ -4719,6 +4720,7 @@
|
|||||||
113,
|
113,
|
||||||
128,
|
128,
|
||||||
130,
|
130,
|
||||||
|
142,
|
||||||
271,
|
271,
|
||||||
272,
|
272,
|
||||||
273,
|
273,
|
||||||
@ -4755,7 +4757,6 @@
|
|||||||
285,
|
285,
|
||||||
286,
|
286,
|
||||||
287,
|
287,
|
||||||
288,
|
|
||||||
289,
|
289,
|
||||||
290,
|
290,
|
||||||
291
|
291
|
||||||
@ -4961,7 +4962,6 @@
|
|||||||
285,
|
285,
|
||||||
286,
|
286,
|
||||||
287,
|
287,
|
||||||
288,
|
|
||||||
289,
|
289,
|
||||||
290,
|
290,
|
||||||
291
|
291
|
||||||
|
@ -126,6 +126,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
year=self.year + 1,
|
year=self.year + 1,
|
||||||
date_start=str(self.year + 1) + "-09-01",
|
date_start=str(self.year + 1) + "-09-01",
|
||||||
date_end=str(self.year + 1) + "-09-03",
|
date_end=str(self.year + 1) + "-09-03",
|
||||||
|
caution_amount=12000,
|
||||||
))
|
))
|
||||||
qs = WEIClub.objects.filter(name="Create WEI Test", year=self.year + 1)
|
qs = WEIClub.objects.filter(name="Create WEI Test", year=self.year + 1)
|
||||||
self.assertTrue(qs.exists())
|
self.assertTrue(qs.exists())
|
||||||
@ -160,6 +161,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
membership_end="2000-09-30",
|
membership_end="2000-09-30",
|
||||||
date_start="2000-09-01",
|
date_start="2000-09-01",
|
||||||
date_end="2000-09-03",
|
date_end="2000-09-03",
|
||||||
|
caution_amount=12000,
|
||||||
))
|
))
|
||||||
qs = WEIClub.objects.filter(name="Update WEI Test", id=self.wei.id)
|
qs = WEIClub.objects.filter(name="Update WEI Test", id=self.wei.id)
|
||||||
self.assertRedirects(response, reverse("wei:wei_detail", kwargs=dict(pk=self.wei.pk)), 302, 200)
|
self.assertRedirects(response, reverse("wei:wei_detail", kwargs=dict(pk=self.wei.pk)), 302, 200)
|
||||||
@ -318,6 +320,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
bus=[],
|
bus=[],
|
||||||
team=[],
|
team=[],
|
||||||
roles=[],
|
roles=[],
|
||||||
|
caution_type='check'
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertFalse(response.context["membership_form"].is_valid())
|
self.assertFalse(response.context["membership_form"].is_valid())
|
||||||
@ -335,6 +338,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
bus=[self.bus.id],
|
bus=[self.bus.id],
|
||||||
team=[self.team.id],
|
team=[self.team.id],
|
||||||
roles=[role.id for role in WEIRole.objects.filter(~Q(name="1A")).all()],
|
roles=[role.id for role in WEIRole.objects.filter(~Q(name="1A")).all()],
|
||||||
|
caution_type='check'
|
||||||
))
|
))
|
||||||
qs = WEIRegistration.objects.filter(user_id=user.id)
|
qs = WEIRegistration.objects.filter(user_id=user.id)
|
||||||
self.assertTrue(qs.exists())
|
self.assertTrue(qs.exists())
|
||||||
@ -354,6 +358,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
bus=[self.bus.id],
|
bus=[self.bus.id],
|
||||||
team=[self.team.id],
|
team=[self.team.id],
|
||||||
roles=[role.id for role in WEIRole.objects.filter(~Q(name="1A")).all()],
|
roles=[role.id for role in WEIRole.objects.filter(~Q(name="1A")).all()],
|
||||||
|
caution_type='check'
|
||||||
))
|
))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue("This user is already registered to this WEI." in str(response.context["form"].errors))
|
self.assertTrue("This user is already registered to this WEI." in str(response.context["form"].errors))
|
||||||
@ -506,6 +511,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
team=[self.team.id],
|
team=[self.team.id],
|
||||||
roles=[role.id for role in WEIRole.objects.filter(name="Adhérent⋅e WEI").all()],
|
roles=[role.id for role in WEIRole.objects.filter(name="Adhérent⋅e WEI").all()],
|
||||||
information_json=self.registration.information_json,
|
information_json=self.registration.information_json,
|
||||||
|
caution_type='check'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
qs = WEIRegistration.objects.filter(user_id=self.user.id, soge_credit=False, clothing_size="M")
|
qs = WEIRegistration.objects.filter(user_id=self.user.id, soge_credit=False, clothing_size="M")
|
||||||
@ -560,6 +566,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
team=[self.team.id],
|
team=[self.team.id],
|
||||||
roles=[role.id for role in WEIRole.objects.filter(name="Adhérent⋅e WEI").all()],
|
roles=[role.id for role in WEIRole.objects.filter(name="Adhérent⋅e WEI").all()],
|
||||||
information_json=self.registration.information_json,
|
information_json=self.registration.information_json,
|
||||||
|
caution_type='check'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
qs = WEIRegistration.objects.filter(user_id=self.user.id, clothing_size="L")
|
qs = WEIRegistration.objects.filter(user_id=self.user.id, clothing_size="L")
|
||||||
@ -583,6 +590,7 @@ class TestWEIRegistration(TestCase):
|
|||||||
team=[],
|
team=[],
|
||||||
roles=[],
|
roles=[],
|
||||||
information_json=self.registration.information_json,
|
information_json=self.registration.information_json,
|
||||||
|
caution_type='check'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.assertFalse(response.context["membership_form"].is_valid())
|
self.assertFalse(response.context["membership_form"].is_valid())
|
||||||
|
@ -1084,12 +1084,12 @@ class WEIValidateRegistrationView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
# Vérifier que l'utilisateur a assez d'argent pour tout payer
|
# Vérifier que l'utilisateur a assez d'argent pour tout payer
|
||||||
if not registration.soge_credit and user.note.balance + credit_amount < total_needed:
|
if not registration.soge_credit and user.note.balance + credit_amount < total_needed:
|
||||||
form.add_error('credit_type',
|
form.add_error('credit_type',
|
||||||
_("This user doesn't have enough money to join this club and pay the deposit. "
|
_("This user doesn't have enough money to join this club and pay the deposit. "
|
||||||
"Current balance: %(balance)d€, credit: %(credit)d€, needed: %(needed)d€") % {
|
"Current balance: %(balance)d€, credit: %(credit)d€, needed: %(needed)d€") % {
|
||||||
'balance': user.note.balance,
|
'balance': user.note.balance,
|
||||||
'credit': credit_amount,
|
'credit': credit_amount,
|
||||||
'needed': total_needed,
|
'needed': total_needed}
|
||||||
})
|
)
|
||||||
return super().form_invalid(form)
|
return super().form_invalid(form)
|
||||||
|
|
||||||
if credit_amount:
|
if credit_amount:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user