1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-25 05:46:30 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Emmy D'Anello
de22a12e85
Activating translation is not needed
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-02-25 19:22:55 +01:00
Emmy D'Anello
415d83acc7
Read tox dependencies from requirements.txt file
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-02-25 19:15:07 +01:00
Emmy D'Anello
eb7e7c1579
Compile messages in tox tests
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-02-25 19:09:34 +01:00
Emmy D'Anello
348004320c
Add tests for payment management commands
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-02-25 19:01:26 +01:00
Emmy D'Anello
9829541289
Add information about reminders
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2024-02-25 18:44:54 +01:00
4 changed files with 61 additions and 20 deletions

View File

@ -7,7 +7,7 @@ py311:
image: python:3.11-alpine
before_script:
- apk add --no-cache libmagic
- apk add --no-cache git # Useful for django-haystack, remove when the newer versions are in PyPI
- apk add --no-cache gettext git # Useful for django-haystack, remove when the newer versions are in PyPI
- pip install tox --no-cache-dir
script: tox -e py311
@ -16,7 +16,7 @@ py312:
image: python:3.12-alpine
before_script:
- apk add --no-cache libmagic
- apk add --no-cache git # Useful for django-haystack, remove when the newer versions are in PyPI
- apk add --no-cache gettext git # Useful for django-haystack, remove when the newer versions are in PyPI
- pip install tox --no-cache-dir
script: tox -e py312

View File

@ -196,6 +196,12 @@ apparaître. Vous pouvez également utiliser le lien présent dans le volet « I
.. image:: /_static/img/payment_index.png
:alt: Page de paiement
.. note::
Vous recevrez un mail de rappel chaque semaine. Le paiement doit être effectué avant le début du
tournoi, sans quoi votre participation pourrait être refusée. En cas de difficultés de paiement,
merci de nous contacter.
Carte bancaire
""""""""""""""

View File

@ -4,6 +4,7 @@
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.management import call_command
from django.test import LiveServerTestCase, override_settings, TestCase
@ -874,6 +875,29 @@ class TestPayment(TestCase):
payment.refresh_from_db()
self.assertFalse(payment.valid)
def test_payment_reminder(self):
"""
Check that the payment reminder command works correctly.
"""
self.assertEqual(len(mail.outbox), 0)
call_command('remind_payments')
self.assertEqual(len(mail.outbox), 2)
self.assertEqual(mail.outbox[0].subject, "[TFJM²] Rappel pour votre paiement")
payment = Payment.objects.get(registrations=self.user.registration, final=False)
payment2 = Payment.objects.get(registrations=self.second_user.registration, final=False)
payment.type = 'other'
payment.valid = True
payment.save()
payment2.type = 'bank_transfer'
payment2.valid = None
payment2.save()
mail.outbox = []
call_command('remind_payments')
self.assertEqual(len(mail.outbox), 0)
@override_settings(HELLOASSO_TEST_ENDPOINT=True, ROOT_URLCONF="tfjm.helloasso.test_urls")
class TestHelloAssoPayment(LiveServerTestCase):
@ -1076,6 +1100,32 @@ class TestHelloAssoPayment(LiveServerTestCase):
checkout_intent = payment.get_checkout_intent()
self.assertIn('order', checkout_intent)
def test_hello_asso_payment_verification(self):
"""
Check that a payment that is pending verification can be verified.
"""
with self.settings(HELLOASSO_TEST_ENDPOINT_URL=self.live_server_url):
payment = Payment.objects.get(registrations=self.user.registration, final=False)
self.assertFalse(payment.valid)
call_command('check_hello_asso')
payment.refresh_from_db()
self.assertFalse(payment.valid)
self.client.get(reverse('registration:payment_hello_asso', args=(payment.pk,)),
follow=True)
payment.refresh_from_db()
payment.valid = None
payment.additional_information = ""
payment.save()
self.assertIsNone(payment.valid)
call_command('check_hello_asso')
payment.refresh_from_db()
self.assertTrue(payment.valid)
self.assertTrue(payment.additional_information)
class TestAdmin(TestCase):
def setUp(self) -> None:

21
tox.ini
View File

@ -8,26 +8,11 @@ skipsdist = True
[testenv]
sitepackages = False
deps =
coverage
channels[daphne]~=4.0.0
crispy-bootstrap5~=2023.10
Django>=5.0,<6.0
django-crispy-forms~=2.1
django-filter~=23.5
git+https://github.com/django-haystack/django-haystack.git#v3.3b1
django-phonenumber-field~=7.3.0
django-polymorphic~=3.1.0
django-tables2~=2.7.0
djangorestframework~=3.14.0
django-rest-polymorphic~=0.1.10
odfpy~=1.4.1
phonenumbers~=8.13.27
pypdf~=3.17.4
python-magic~=0.4.27
requests~=2.31.0
deps = coverage
-r requirements.txt
commands =
python manage.py compilemessages -i .tox -i venv
coverage run --source=api,draw,logs,participation,registration,tfjm ./manage.py test api/ draw/ logs/ participation/ registration/ tfjm/
coverage report -m