##// END OF EJS Templates
helpers: fix tests and tag replacers
super-admin -
r5152:f352498b default
parent child Browse files
Show More
@@ -1069,7 +1069,8 b' tags_patterns = OrderedDict('
1069 re.compile(
1069 re.compile(
1070 r"\[license\ \=\>\ *([a-zA-Z0-9\/\=\?\&\ \:\/\.\-]*)\]"
1070 r"\[license\ \=\>\ *([a-zA-Z0-9\/\=\?\&\ \:\/\.\-]*)\]"
1071 ),
1071 ),
1072 r'<div class="metatag" tag="license"><a href="http:\/\/www.opensource.org/licenses/\\1">\\1</a></div>',
1072 # don't make it a raw string here...
1073 '<div class="metatag" tag="license"><a href="http:\/\/www.opensource.org/licenses/\\1">\\1</a></div>',
1073 ),
1074 ),
1074 ),
1075 ),
1075 (
1076 (
@@ -28,7 +28,7 b' from rhodecode.tests import no_newline_i'
28
28
29
29
30 @pytest.mark.parametrize('url, expected_url', [
30 @pytest.mark.parametrize('url, expected_url', [
31 (r'https://rc.com', '<a href="https://rc.com">http://rc.com</a>'),
31 (r'https://rc.com', '<a href="https://rc.com">https://rc.com</a>'),
32 (r'https://rc.com/test', '<a href="https://rc.com/test">https://rc.com/test</a>'),
32 (r'https://rc.com/test', '<a href="https://rc.com/test">https://rc.com/test</a>'),
33 (r'https://rc.com/!foo', '<a href="https://rc.com/!foo">https://rc.com/!foo</a>'),
33 (r'https://rc.com/!foo', '<a href="https://rc.com/!foo">https://rc.com/!foo</a>'),
34 (r'https://rc.com/&foo', '<a href="https://rc.com/&amp;foo">https://rc.com/&amp;foo</a>'),
34 (r'https://rc.com/&foo', '<a href="https://rc.com/&amp;foo">https://rc.com/&amp;foo</a>'),
@@ -131,13 +131,13 b' def test_extract_issues(backend, text_st'
131
131
132 @pytest.mark.parametrize('text_string, pattern, link_format, expected_text', [
132 @pytest.mark.parametrize('text_string, pattern, link_format, expected_text', [
133 ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'html',
133 ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'html',
134 'Fix <a class="tooltip issue-tracker-link" href="http://r.io/{repo}/i/42" title="Test Pattern">#42</a>'),
134 'Fix <a class="tooltip issue-tracker-link" href="https://r.io/{repo}/i/42" title="Test Pattern">#42</a>'),
135
135
136 ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'markdown',
136 ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'markdown',
137 'Fix [#42](http://r.io/{repo}/i/42)'),
137 'Fix [#42](https://r.io/{repo}/i/42)'),
138
138
139 ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'rst',
139 ('Fix #42', '(?:#)(?P<issue_id>\d+)', 'rst',
140 'Fix `#42 <http://r.io/{repo}/i/42>`_'),
140 'Fix `#42 <https://r.io/{repo}/i/42>`_'),
141
141
142 ('Fix #42', '(?:#)?<issue_id>\d+)', 'html',
142 ('Fix #42', '(?:#)?<issue_id>\d+)', 'html',
143 'Fix #42'), # Broken regex
143 'Fix #42'), # Broken regex
@@ -150,7 +150,7 b' def test_process_patterns_repo(backend, '
150 '123': {
150 '123': {
151 'uid': '123',
151 'uid': '123',
152 'pat': pattern,
152 'pat': pattern,
153 'url': 'http://r.io/${repo}/i/${issue_id}',
153 'url': 'https://r.io/${repo}/i/${issue_id}',
154 'pref': '#',
154 'pref': '#',
155 'desc': 'Test Pattern'
155 'desc': 'Test Pattern'
156 }
156 }
@@ -166,7 +166,7 b' def test_process_patterns_repo(backend, '
166
166
167 @pytest.mark.parametrize('text_string, pattern, expected_text', [
167 @pytest.mark.parametrize('text_string, pattern, expected_text', [
168 ('Fix #42', '(?:#)(?P<issue_id>\d+)',
168 ('Fix #42', '(?:#)(?P<issue_id>\d+)',
169 'Fix <a class="tooltip issue-tracker-link" href="http://r.io/i/42" title="Test Pattern">#42</a>'),
169 'Fix <a class="tooltip issue-tracker-link" href="https://r.io/i/42" title="Test Pattern">#42</a>'),
170 ('Fix #42', '(?:#)?<issue_id>\d+)',
170 ('Fix #42', '(?:#)?<issue_id>\d+)',
171 'Fix #42'), # Broken regex
171 'Fix #42'), # Broken regex
172 ])
172 ])
@@ -177,7 +177,7 b' def test_process_patterns_no_repo(text_s'
177 '123': {
177 '123': {
178 'uid': '123',
178 'uid': '123',
179 'pat': pattern,
179 'pat': pattern,
180 'url': 'http://r.io/i/${issue_id}',
180 'url': 'https://r.io/i/${issue_id}',
181 'pref': '#',
181 'pref': '#',
182 'desc': 'Test Pattern'
182 'desc': 'Test Pattern'
183 }
183 }
@@ -193,16 +193,16 b' def test_process_patterns_no_repo(text_s'
193
193
194 def test_process_patterns_non_existent_repo_name(backend):
194 def test_process_patterns_non_existent_repo_name(backend):
195 text_string = 'Fix #42'
195 text_string = 'Fix #42'
196 pattern = '(?:#)(?P<issue_id>\d+)'
196 pattern = r'(?:#)(?P<issue_id>\d+)'
197 expected_text = ('Fix <a class="tooltip issue-tracker-link" '
197 expected_text = ('Fix <a class="tooltip issue-tracker-link" '
198 'href="http://r.io/do-not-exist/i/42" title="Test Pattern">#42</a>')
198 'href="https://r.io/do-not-exist/i/42" title="Test Pattern">#42</a>')
199
199
200 def get_settings_mock(self, cache=True):
200 def get_settings_mock(self, cache=True):
201 return {
201 return {
202 '123': {
202 '123': {
203 'uid': '123',
203 'uid': '123',
204 'pat': pattern,
204 'pat': pattern,
205 'url': 'http://r.io/${repo}/i/${issue_id}',
205 'url': 'https://r.io/${repo}/i/${issue_id}',
206 'pref': '#',
206 'pref': '#',
207 'desc': 'Test Pattern'
207 'desc': 'Test Pattern'
208 }
208 }
General Comments 0
You need to be logged in to leave comments. Login now