Show More
@@ -101,20 +101,6 b' class TestHomeController(TestController)' | |||||
101 | RepoGroupModel().delete(repo_group='gr1', force_delete=True) |
|
101 | RepoGroupModel().delete(repo_group='gr1', force_delete=True) | |
102 | Session().commit() |
|
102 | Session().commit() | |
103 |
|
103 | |||
104 | def test_index_with_name_with_tags(self, user_util, autologin_user): |
|
|||
105 | user = user_util.create_user() |
|
|||
106 | username = user.username |
|
|||
107 | user.name = '<img src="/image1" onload="alert(\'Hello, World!\');">' |
|
|||
108 | user.lastname = '#"><img src=x onerror=prompt(document.cookie);>' |
|
|||
109 |
|
||||
110 | Session().add(user) |
|
|||
111 | Session().commit() |
|
|||
112 | user_util.create_repo(owner=username) |
|
|||
113 |
|
||||
114 | response = self.app.get(route_path('home')) |
|
|||
115 | response.mustcontain(h.html_escape(user.first_name)) |
|
|||
116 | response.mustcontain(h.html_escape(user.last_name)) |
|
|||
117 |
|
||||
118 | @pytest.mark.parametrize("name, state", [ |
|
104 | @pytest.mark.parametrize("name, state", [ | |
119 | ('Disabled', False), |
|
105 | ('Disabled', False), | |
120 | ('Enabled', True), |
|
106 | ('Enabled', True), |
@@ -84,7 +84,7 b' class TestRepoIssueTracker(object):' | |||||
84 | extra_environ=xhr_header, params=data) |
|
84 | extra_environ=xhr_header, params=data) | |
85 |
|
85 | |||
86 | assert response.body == \ |
|
86 | assert response.body == \ | |
87 | 'example of <a class="issue-tracker-link" href="http://url">prefix</a> replacement' |
|
87 | 'example of <a class="tooltip issue-tracker-link" href="http://url" title="description">prefix</a> replacement' | |
88 |
|
88 | |||
89 | @request.addfinalizer |
|
89 | @request.addfinalizer | |
90 | def cleanup(): |
|
90 | def cleanup(): |
@@ -144,7 +144,7 b'' | |||||
144 | <%def name="revision(repo_name, rev, commit_id, author, last_msg, commit_date)"> |
|
144 | <%def name="revision(repo_name, rev, commit_id, author, last_msg, commit_date)"> | |
145 | <div> |
|
145 | <div> | |
146 | %if rev >= 0: |
|
146 | %if rev >= 0: | |
147 |
<code><a class="tooltip-hovercard" data-hovercard-alt= |
|
147 | <code><a class="tooltip-hovercard" data-hovercard-alt=${h.tooltip(last_msg)} data-hovercard-url="${h.route_path('hovercard_repo_commit', repo_name=repo_name, commit_id=commit_id)}" href="${h.route_path('repo_commit',repo_name=repo_name,commit_id=commit_id)}">${'r{}:{}'.format(rev,h.short_id(commit_id))}</a></code> | |
148 | %else: |
|
148 | %else: | |
149 | ${_('No commits yet')} |
|
149 | ${_('No commits yet')} | |
150 | %endif |
|
150 | %endif |
@@ -110,6 +110,7 b' def test_extract_issues(backend, text_st' | |||||
110 | 'pat': pattern, |
|
110 | 'pat': pattern, | |
111 | 'url': 'http://r.io/${repo}/i/${issue_id}', |
|
111 | 'url': 'http://r.io/${repo}/i/${issue_id}', | |
112 | 'pref': '#', |
|
112 | 'pref': '#', | |
|
113 | 'desc': 'Test Pattern' | |||
113 | } |
|
114 | } | |
114 | } |
|
115 | } | |
115 |
|
116 | |||
@@ -129,7 +130,7 b' def test_extract_issues(backend, text_st' | |||||
129 |
|
130 | |||
130 | @pytest.mark.parametrize('text_string, pattern, link_format, expected_text', [ |
|
131 | @pytest.mark.parametrize('text_string, pattern, link_format, expected_text', [ | |
131 | ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'html', |
|
132 | ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'html', | |
132 | 'Fix <a class="issue-tracker-link" href="http://r.io/{repo}/i/42">#42</a>'), |
|
133 | 'Fix <a class="tooltip issue-tracker-link" href="http://r.io/{repo}/i/42" title="Test Pattern">#42</a>'), | |
133 |
|
134 | |||
134 | ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'markdown', |
|
135 | ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'markdown', | |
135 | 'Fix [#42](http://r.io/{repo}/i/42)'), |
|
136 | 'Fix [#42](http://r.io/{repo}/i/42)'), | |
@@ -150,6 +151,7 b' def test_process_patterns_repo(backend, ' | |||||
150 | 'pat': pattern, |
|
151 | 'pat': pattern, | |
151 | 'url': 'http://r.io/${repo}/i/${issue_id}', |
|
152 | 'url': 'http://r.io/${repo}/i/${issue_id}', | |
152 | 'pref': '#', |
|
153 | 'pref': '#', | |
|
154 | 'desc': 'Test Pattern' | |||
153 | } |
|
155 | } | |
154 | } |
|
156 | } | |
155 |
|
157 | |||
@@ -163,7 +165,7 b' def test_process_patterns_repo(backend, ' | |||||
163 |
|
165 | |||
164 | @pytest.mark.parametrize('text_string, pattern, expected_text', [ |
|
166 | @pytest.mark.parametrize('text_string, pattern, expected_text', [ | |
165 | ('Fix #42', '(?:#)(?P<issue_id>\d+)', |
|
167 | ('Fix #42', '(?:#)(?P<issue_id>\d+)', | |
166 | 'Fix <a class="issue-tracker-link" href="http://r.io/i/42">#42</a>'), |
|
168 | 'Fix <a class="tooltip issue-tracker-link" href="http://r.io/i/42" title="Test Pattern">#42</a>'), | |
167 | ('Fix #42', '(?:#)?<issue_id>\d+)', |
|
169 | ('Fix #42', '(?:#)?<issue_id>\d+)', | |
168 | 'Fix #42'), # Broken regex |
|
170 | 'Fix #42'), # Broken regex | |
169 | ]) |
|
171 | ]) | |
@@ -176,6 +178,7 b' def test_process_patterns_no_repo(text_s' | |||||
176 | 'pat': pattern, |
|
178 | 'pat': pattern, | |
177 | 'url': 'http://r.io/i/${issue_id}', |
|
179 | 'url': 'http://r.io/i/${issue_id}', | |
178 | 'pref': '#', |
|
180 | 'pref': '#', | |
|
181 | 'desc': 'Test Pattern' | |||
179 | } |
|
182 | } | |
180 | } |
|
183 | } | |
181 |
|
184 | |||
@@ -190,8 +193,8 b' def test_process_patterns_no_repo(text_s' | |||||
190 | def test_process_patterns_non_existent_repo_name(backend): |
|
193 | def test_process_patterns_non_existent_repo_name(backend): | |
191 | text_string = 'Fix #42' |
|
194 | text_string = 'Fix #42' | |
192 | pattern = '(?:#)(?P<issue_id>\d+)' |
|
195 | pattern = '(?:#)(?P<issue_id>\d+)' | |
193 | expected_text = ('Fix <a class="issue-tracker-link" ' |
|
196 | expected_text = ('Fix <a class="tooltip issue-tracker-link" ' | |
194 | 'href="http://r.io/do-not-exist/i/42">#42</a>') |
|
197 | 'href="http://r.io/do-not-exist/i/42" title="Test Pattern">#42</a>') | |
195 |
|
198 | |||
196 | def get_settings_mock(self, cache=True): |
|
199 | def get_settings_mock(self, cache=True): | |
197 | return { |
|
200 | return { | |
@@ -200,6 +203,7 b' def test_process_patterns_non_existent_r' | |||||
200 | 'pat': pattern, |
|
203 | 'pat': pattern, | |
201 | 'url': 'http://r.io/${repo}/i/${issue_id}', |
|
204 | 'url': 'http://r.io/${repo}/i/${issue_id}', | |
202 | 'pref': '#', |
|
205 | 'pref': '#', | |
|
206 | 'desc': 'Test Pattern' | |||
203 | } |
|
207 | } | |
204 | } |
|
208 | } | |
205 |
|
209 |
General Comments 0
You need to be logged in to leave comments.
Login now