def _create_commit(self): c = GitHubCommit(self.env, git_url=GIT_URL, **COMMITS[0]) c.time = self.now c.save() c = GitHubCommit(self.env, git_url=GIT_URL, **COMMITS[1]) c.time = self.now + 5 c.url = 'http://example.com/example.git' c.save()
def test_render_xss_event(self): commit = GitHubCommit(self.env, git_url=GIT_URL, **COMMITS[0]) commit.url = """http://example" onclick="alert('xss')""" commit.id = """1234567<script>alert('xss')</script>""" commit.message = """<a href="http://example" onclick="alert('xss')">foo</a><script>alert('xss')</script>""" def render(field): return str(self.github_event_provider.render_timeline_event({}, field, ('','','',commit))) eq_("Revision <em>1234567<script>alert('xss')</script></em>", render('title')) eq_( """<a href="http://example" onclick="alert(\'xss\')">foo</a><script>alert(\'xss\')</script>""", render('description'))