Commit c99960c7 authored by Tom Tryfonidis's avatar Tom Tryfonidis Committed by Claude Paroz

Fix tests for people

parent 4072efe1
Pipeline #46776 passed with stage
in 4 minutes and 24 seconds
...@@ -98,7 +98,7 @@ class PeopleTestCase(TestCase): ...@@ -98,7 +98,7 @@ class PeopleTestCase(TestCase):
response = self.client.get(reverse('home')) response = self.client.get(reverse('home'))
self.assertContains( self.assertContains(
response, response,
'<a aria-expanded="false" aria-haspopup="true" role="button" data-toggle="dropdown" class="dropdown-toggle hidden-xs avatar" href="%s"><img alt="generic person icon" src="/static/img/nobody.png"></a>' % ( '<a aria-expanded="false" aria-haspopup="true" role="button" data-toggle="dropdown" class="dropdown-toggle hidden-xs avatar" href="%s"><img class="img-circle" alt="generic person icon" src="/static/img/nobody.png"></a>' % (
reverse('person_detail_username', args=[self.pn.username]),), reverse('person_detail_username', args=[self.pn.username]),),
html=True html=True
) )
...@@ -176,28 +176,28 @@ class PeopleTestCase(TestCase): ...@@ -176,28 +176,28 @@ class PeopleTestCase(TestCase):
pn = self._create_person() pn = self._create_person()
self.assertHTMLEqual( self.assertHTMLEqual(
people.people_image(pn), people.people_image(pn),
'<img src="/static/img/nobody.png" alt="generic person icon">' '<img class="img-circle" src="/static/img/nobody.png" alt="generic person icon">'
) )
pn.image = 'http://www.example.org/my_image.png' pn.image = 'http://www.example.org/my_image.png'
self.assertHTMLEqual( self.assertHTMLEqual(
people.people_image(pn), people.people_image(pn),
'<img alt="John Nothing" onerror="this.onerror = null; this.src=\'/static/img/nobody.png\'" src="http://www.example.org/my_image.png" />' '<img class="img-circle" alt="John Nothing" onerror="this.onerror = null; this.src=\'/static/img/nobody.png\'" src="http://www.example.org/my_image.png" />'
) )
pn.last_name = "<script>Some XSS content</script>" pn.last_name = "<script>Some XSS content</script>"
self.assertIn("&lt;script&gt;Some XSS content&lt;/script&gt;", people.people_image(pn)) self.assertIn("&lt;script&gt;Some XSS content&lt;/script&gt;", people.people_image(pn))
self.assertHTMLEqual( self.assertHTMLEqual(
people.people_image(pn), people.people_image(pn),
'<img alt="John &lt;script&gt;Some XSS content&lt;/script&gt;" onerror="this.onerror = null; this.src=\'/static/img/nobody.png\'" src="http://www.example.org/my_image.png" />' '<img class="img-circle" alt="John &lt;script&gt;Some XSS content&lt;/script&gt;" onerror="this.onerror = null; this.src=\'/static/img/nobody.png\'" src="http://www.example.org/my_image.png" />'
) )
pn.avatar_service = 'gravatar.com' pn.avatar_service = 'gravatar.com'
self.assertHTMLEqual( self.assertHTMLEqual(
people.people_image(pn), people.people_image(pn),
'<img alt="avatar icon" src="https://secure.gravatar.com/avatar/618b8b6c1c973c780ec218242c49cbe7.jpg?s=80&d=identicon&r=g">' '<img class="img-circle" alt="avatar icon" src="https://secure.gravatar.com/avatar/618b8b6c1c973c780ec218242c49cbe7.jpg?s=80&d=identicon&r=g">'
) )
pn.avatar_service = 'libravatar.org' pn.avatar_service = 'libravatar.org'
self.assertHTMLEqual( self.assertHTMLEqual(
people.people_image(pn), people.people_image(pn),
'<img alt="avatar icon" src="https://seccdn.libravatar.org/avatar/618b8b6c1c973c780ec218242c49cbe7?s=80&d=identicon&r=g">' '<img class="img-circle" alt="avatar icon" src="https://seccdn.libravatar.org/avatar/618b8b6c1c973c780ec218242c49cbe7?s=80&d=identicon&r=g">'
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment