Merge branch 'skia/fix_eboutic' into 'master'

Multiple fixes

* Bump `black` and fix issues
* `club`: fix tests broken by inclusive translation
* `gitlab-ci`: use `poetry`, as `pip` was broken anyway
* `eboutic`: et_autoanswer: don't require 'Auto' to proceed checking the request: As described in the [doc](https://www.paybox.com/espace-integrateur-documentation/la-solution-paybox-system/gestion-de-la-reponse/), `Auto` may be missing if the payment failed. Thus, it's not required to proceed checking the bank's answer.

See merge request ae/Sith!296
This commit is contained in:
Skia 2022-03-02 16:21:10 +00:00
commit 234556a172
5 changed files with 39 additions and 30 deletions

View File

@ -7,13 +7,14 @@ test:
- env
- apt-get update
- apt-get install -y gettext libxapian-dev libgraphviz-dev
- pip install .[testing]
- pip install poetry
- poetry install -E testing
- mkdir -p /dev/shm/search_indexes
- ln -s /dev/shm/search_indexes sith/search_indexes
- ./manage.py compilemessages
- coverage run ./manage.py test
- coverage html
- coverage report
- poetry run ./manage.py compilemessages
- poetry run coverage run ./manage.py test
- poetry run coverage html
- poetry run coverage report
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip_tests"
cache:

View File

@ -161,10 +161,10 @@ class ClubTest(TestCase):
response = self.client.get(
reverse("club:club_members", kwargs={"club_id": self.bdf.id})
)
self.assertTrue(response.status_code == 200)
self.assertTrue(
"""Richard Batsbak</a></td>\\n <td>Vice-Pr\\xc3\\xa9sident</td>"""
in str(response.content)
self.assertEqual(response.status_code, 200)
self.assertIn(
"""Richard Batsbak</a></td>\n <td>Vice-Président⸱e</td>""",
response.content.decode(),
)
def test_create_add_user_to_club_from_richard_fail(self):
@ -369,14 +369,15 @@ class ClubTest(TestCase):
response = self.client.get(
reverse("club:club_members", kwargs={"club_id": self.bdf.id})
)
self.assertTrue(response.status_code == 200)
content = str(response.content)
self.assertTrue(
"Richard Batsbak</a></td>\\n <td>Curieux</td>" in content
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertIn(
"Richard Batsbak</a></td>\n <td>Curieux⸱euse</td>",
content,
)
self.assertTrue(
"S&#39; Kia</a></td>\\n <td>Responsable info</td>"
in content
self.assertIn(
"S&#39; Kia</a></td>\n <td>Responsable info</td>",
content,
)

View File

@ -118,11 +118,14 @@ class SelectFile(TextInput):
attrs["class"] = "select_file"
else:
attrs = {"class": "select_file"}
output = '%(content)s<div name="%(name)s" class="choose_file_widget" title="%(title)s"></div>' % {
"content": super(SelectFile, self).render(name, value, attrs, renderer),
"title": _("Choose file"),
"name": name,
}
output = (
'%(content)s<div name="%(name)s" class="choose_file_widget" title="%(title)s"></div>'
% {
"content": super(SelectFile, self).render(name, value, attrs, renderer),
"title": _("Choose file"),
"name": name,
}
)
output += (
'<span name="'
+ name
@ -139,11 +142,14 @@ class SelectUser(TextInput):
attrs["class"] = "select_user"
else:
attrs = {"class": "select_user"}
output = '%(content)s<div name="%(name)s" class="choose_user_widget" title="%(title)s"></div>' % {
"content": super(SelectUser, self).render(name, value, attrs, renderer),
"title": _("Choose user"),
"name": name,
}
output = (
'%(content)s<div name="%(name)s" class="choose_user_widget" title="%(title)s"></div>'
% {
"content": super(SelectUser, self).render(name, value, attrs, renderer),
"title": _("Choose user"),
"name": name,
}
)
output += (
'<span name="'
+ name

View File

@ -252,8 +252,6 @@ class EtransactionAutoAnswer(View):
if (
not "Amount" in request.GET.keys()
or not "BasketID" in request.GET.keys()
or not "Auto"
in request.GET.keys() # If not in the request it means the payment has been refused
or not "Error" in request.GET.keys()
or not "Sig" in request.GET.keys()
):
@ -271,7 +269,10 @@ class EtransactionAutoAnswer(View):
)
except:
return HttpResponse("Bad signature", status=400)
if request.GET["Error"] == "00000":
# Payment authorized:
# * 'Error' is '00000'
# * 'Auto' is in the request
if request.GET["Error"] == "00000" and "Auto" in request.GET.keys():
try:
with transaction.atomic():
b = (

View File

@ -58,7 +58,7 @@ docs = ["Sphinx", "sphinx-rtd-theme", "sphinx-copybutton"]
[tool.poetry.dev-dependencies]
django-debug-toolbar = "^3.2.2"
ipython = "^7.28.0"
black = "^21.9b0"
black = "^22.1.0"
[build-system]
requires = ["poetry-core>=1.0.0"]