diff --git a/tests/constantes.py b/tests/constantes.py index 1170a26..bd77ed0 100644 --- a/tests/constantes.py +++ b/tests/constantes.py @@ -30,7 +30,7 @@ } -SERILAIZED_SOCIAL_LINKS = { +SERIALIZED_SOCIAL_LINKS = { "facebook": "http://facebook.com/example", "twitter": "http://twitter.com/example", } diff --git a/tests/serializers.py b/tests/serializers.py index bce03b5..924808e 100644 --- a/tests/serializers.py +++ b/tests/serializers.py @@ -7,7 +7,7 @@ ) from .constantes import ( - SERILAIZED_SOCIAL_LINKS + SERIALIZED_SOCIAL_LINKS ) @@ -34,7 +34,7 @@ def test_serialize_firm_info(db, firm_contact_obj): def test_serialize_firm_social(db, firm_social_links_objs): queryset = Link.objects.all() - expected_output = SERILAIZED_SOCIAL_LINKS + expected_output = SERIALIZED_SOCIAL_LINKS assert serialize_firm_social(queryset) == expected_output diff --git a/tests/templatetags.py b/tests/templatetags.py index c039b3c..e4e76ad 100644 --- a/tests/templatetags.py +++ b/tests/templatetags.py @@ -1,7 +1,10 @@ -from django.test import RequestFactory import pytest +from html import escape + from django.template import RequestContext, Template +from django.test import RequestFactory + from firm_info.models import FirmContact, Link from firm_info.factories import TrackingFactory from firm_info.templatetags.firm_info import ( @@ -11,7 +14,7 @@ firm_tag_analytic, ) -from .constantes import SERILAIZED_SOCIAL_LINKS +from .constantes import SERIALIZED_SOCIAL_LINKS def test_firm_contact_tag(db, firm_contact_obj): @@ -33,10 +36,10 @@ def test_firm_contact_tag(db, firm_contact_obj): firm_contact_obj.city, firm_contact_obj.country, ), - "

Address: {}

".format(firm_contact_obj.address), - "

city: {}

".format(firm_contact_obj.city), - "

postal code: {}

".format(firm_contact_obj.postal_code), - "

country: {}

".format(firm_contact_obj.country) + "

Address: {}

".format(escape(firm_contact_obj.address)), + "

city: {}

".format(escape(firm_contact_obj.city)), + "

postal code: {}

".format(escape(firm_contact_obj.postal_code)), + "

country: {}

".format(escape(firm_contact_obj.country)) ]) assert rendered == expected_output @@ -52,8 +55,8 @@ def test_firm_social_links_tag(db, firm_social_links_objs): template = Template(output) rendered = template.render(context) expected_output = "\n".join([ - f"facebook
", - f"twitter
" + f"facebook
", + f"twitter
" ]) assert rendered == expected_output @@ -70,8 +73,8 @@ def test_firm_description_tag(firm_contact_obj): template = Template(output) rendered = template.render(context) expected_output = "\n".join([ - f"

Baseline: {firm_contact_obj.baseline}

", - f"

Short_description: {firm_contact_obj.short_description}

", + f"

Baseline: {escape(firm_contact_obj.baseline)}

", + f"

Short_description: {escape(firm_contact_obj.short_description)}

", ]) assert rendered == expected_output