tooltips: small fixes/tests fixes.
This commit is contained in:
parent
1e60975f0e
commit
db66dae0fa
4 changed files with 10 additions and 20 deletions
|
|
@ -101,20 +101,6 @@ class TestHomeController(TestController):
|
|||
RepoGroupModel().delete(repo_group='gr1', force_delete=True)
|
||||
Session().commit()
|
||||
|
||||
def test_index_with_name_with_tags(self, user_util, autologin_user):
|
||||
user = user_util.create_user()
|
||||
username = user.username
|
||||
user.name = '<img src="/image1" onload="alert(\'Hello, World!\');">'
|
||||
user.lastname = '#"><img src=x onerror=prompt(document.cookie);>'
|
||||
|
||||
Session().add(user)
|
||||
Session().commit()
|
||||
user_util.create_repo(owner=username)
|
||||
|
||||
response = self.app.get(route_path('home'))
|
||||
response.mustcontain(h.html_escape(user.first_name))
|
||||
response.mustcontain(h.html_escape(user.last_name))
|
||||
|
||||
@pytest.mark.parametrize("name, state", [
|
||||
('Disabled', False),
|
||||
('Enabled', True),
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class TestRepoIssueTracker(object):
|
|||
extra_environ=xhr_header, params=data)
|
||||
|
||||
assert response.body == \
|
||||
'example of <a class="issue-tracker-link" href="http://url">prefix</a> replacement'
|
||||
'example of <a class="tooltip issue-tracker-link" href="http://url" title="description">prefix</a> replacement'
|
||||
|
||||
@request.addfinalizer
|
||||
def cleanup():
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ ${h.style_metatag(tag_type, tag)|n,trim}
|
|||
<%def name="revision(repo_name, rev, commit_id, author, last_msg, commit_date)">
|
||||
<div>
|
||||
%if rev >= 0:
|
||||
<code><a class="tooltip-hovercard" data-hovercard-alt="${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>
|
||||
<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>
|
||||
%else:
|
||||
${_('No commits yet')}
|
||||
%endif
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ def test_extract_issues(backend, text_string, pattern, expected):
|
|||
'pat': pattern,
|
||||
'url': 'http://r.io/${repo}/i/${issue_id}',
|
||||
'pref': '#',
|
||||
'desc': 'Test Pattern'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +130,7 @@ def test_extract_issues(backend, text_string, pattern, expected):
|
|||
|
||||
@pytest.mark.parametrize('text_string, pattern, link_format, expected_text', [
|
||||
('Fix #42', '(?:#)(?P<issue_id>\d+)', 'html',
|
||||
'Fix <a class="issue-tracker-link" href="http://r.io/{repo}/i/42">#42</a>'),
|
||||
'Fix <a class="tooltip issue-tracker-link" href="http://r.io/{repo}/i/42" title="Test Pattern">#42</a>'),
|
||||
|
||||
('Fix #42', '(?:#)(?P<issue_id>\d+)', 'markdown',
|
||||
'Fix [#42](http://r.io/{repo}/i/42)'),
|
||||
|
|
@ -150,6 +151,7 @@ def test_process_patterns_repo(backend, text_string, pattern, expected_text, lin
|
|||
'pat': pattern,
|
||||
'url': 'http://r.io/${repo}/i/${issue_id}',
|
||||
'pref': '#',
|
||||
'desc': 'Test Pattern'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +165,7 @@ def test_process_patterns_repo(backend, text_string, pattern, expected_text, lin
|
|||
|
||||
@pytest.mark.parametrize('text_string, pattern, expected_text', [
|
||||
('Fix #42', '(?:#)(?P<issue_id>\d+)',
|
||||
'Fix <a class="issue-tracker-link" href="http://r.io/i/42">#42</a>'),
|
||||
'Fix <a class="tooltip issue-tracker-link" href="http://r.io/i/42" title="Test Pattern">#42</a>'),
|
||||
('Fix #42', '(?:#)?<issue_id>\d+)',
|
||||
'Fix #42'), # Broken regex
|
||||
])
|
||||
|
|
@ -176,6 +178,7 @@ def test_process_patterns_no_repo(text_string, pattern, expected_text):
|
|||
'pat': pattern,
|
||||
'url': 'http://r.io/i/${issue_id}',
|
||||
'pref': '#',
|
||||
'desc': 'Test Pattern'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,8 +193,8 @@ def test_process_patterns_no_repo(text_string, pattern, expected_text):
|
|||
def test_process_patterns_non_existent_repo_name(backend):
|
||||
text_string = 'Fix #42'
|
||||
pattern = '(?:#)(?P<issue_id>\d+)'
|
||||
expected_text = ('Fix <a class="issue-tracker-link" '
|
||||
'href="http://r.io/do-not-exist/i/42">#42</a>')
|
||||
expected_text = ('Fix <a class="tooltip issue-tracker-link" '
|
||||
'href="http://r.io/do-not-exist/i/42" title="Test Pattern">#42</a>')
|
||||
|
||||
def get_settings_mock(self, cache=True):
|
||||
return {
|
||||
|
|
@ -200,6 +203,7 @@ def test_process_patterns_non_existent_repo_name(backend):
|
|||
'pat': pattern,
|
||||
'url': 'http://r.io/${repo}/i/${issue_id}',
|
||||
'pref': '#',
|
||||
'desc': 'Test Pattern'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue