mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 11:22:24 +02:00
Speedup the tests by using a weaker hash algorythm
This commit is contained in:
parent
b4bdfb8cf4
commit
7373a99aec
3 changed files with 11 additions and 4 deletions
|
@ -37,3 +37,11 @@ def simple_grouped_order(other_user):
|
|||
grouped_order.save()
|
||||
item = Item.objects.create(name="test item", grouped_order=grouped_order, price=2)
|
||||
return grouped_order
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def password_hasher_setup(settings):
|
||||
# Use a weaker password hasher during tests, for speed
|
||||
settings.PASSWORD_HASHERS = [
|
||||
"django.contrib.auth.hashers.MD5PasswordHasher",
|
||||
]
|
||||
|
|
|
@ -35,7 +35,7 @@ def test_send_order_confirmation_mail(mailoutbox, simple_grouped_order, client):
|
|||
m = mailoutbox[0]
|
||||
assert (
|
||||
m.subject
|
||||
== f"[{settings.PROJECT_NAME}] Votre commande pour «Test grouped order»"
|
||||
== f"[{settings.PROJECT_NAME}] Votre commande pour « Test grouped order »"
|
||||
)
|
||||
assert f"{settings.BASE_URL}" in m.alternatives[0][0]
|
||||
assert m.alternatives[0][1] == "text/html"
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
import html2text
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import strip_tags
|
||||
|
||||
from la_chariotte import settings
|
||||
|
||||
|
||||
def send_order_confirmation_mail(order):
|
||||
template_name = "mail/order_confirm_mail.html"
|
||||
|
||||
subject = (
|
||||
f"[{settings.PROJECT_NAME}] Votre commande pour «{order.grouped_order.name}»"
|
||||
f"[{settings.PROJECT_NAME}] Votre commande pour « {order.grouped_order.name} »"
|
||||
)
|
||||
html_message = render_to_string(
|
||||
template_name, {"order": order, "base_url": settings.BASE_URL}
|
||||
|
|
Loading…
Reference in a new issue