예제 #1
0
 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()
예제 #2
0
 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&lt;script&gt;alert('xss')&lt;/script&gt;</em>", render('title'))
     eq_(
         """&lt;a href="http://example" onclick="alert(\'xss\')"&gt;foo&lt;/a&gt;&lt;script&gt;alert(\'xss\')&lt;/script&gt;""",
         render('description'))