Skip to content

Commit

Permalink
TWLight/users/tests.py should escape any html entities in partner nam…
Browse files Browse the repository at this point in the history
…e assertions against html content.
  • Loading branch information
jsnshrmn committed Nov 19, 2019
1 parent 5ff7791 commit b0a6d3b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions TWLight/users/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from django.core.urlresolvers import resolve, reverse
from django.test import TestCase, Client, RequestFactory
from django.utils.translation import get_language

from django.utils.html import escape
from TWLight.applications.factories import ApplicationFactory
from TWLight.applications.models import Application
from TWLight.resources.factories import PartnerFactory
Expand Down Expand Up @@ -229,12 +229,12 @@ def test_my_applications_page_has_application_history(self):
self.assertEqual(
set(response.context_data["object_list"]), {app1, app2, app3, app4}
)
content = response.render().content.decode(utf-8)
content = response.render().content.decode('utf-8')

self.assertIn(app1.partner.company_name, content.decode("utf-8"))
self.assertIn(app2.partner.company_name, content.decode("utf-8"))
self.assertIn(app3.partner.company_name, content.decode("utf-8"))
self.assertIn(app4.partner.company_name, content.decode("utf-8"))
self.assertIn(escape(app1.partner.company_name), content)
self.assertIn(escape(app2.partner.company_name), content)
self.assertIn(escape(app3.partner.company_name), content)
self.assertIn(escape(app4.partner.company_name), content)

# We can't use assertTemplateUsed with RequestFactory (only with
# Client), and testing that the rendered content is equal to an
Expand Down

0 comments on commit b0a6d3b

Please sign in to comment.