mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(rendercomment): converted to use aurweb.db ORM
- Added aurweb.util.git_search. - Decoupled away from rendercomment for easier testability. - Added aurweb.testing.git.GitRepository. - Added templates/testing/{PKGBUILD,SRCINFO}.j2. - Added aurweb.testing.git.GitRepository + `git` pytest fixture Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
4b0cb0721d
commit
2d0e09cd63
9 changed files with 398 additions and 195 deletions
|
@ -40,3 +40,20 @@ def test_round():
|
|||
assert filters.do_round(1.3) == 1
|
||||
assert filters.do_round(1.5) == 2
|
||||
assert filters.do_round(2.0) == 2
|
||||
|
||||
|
||||
def test_git_search():
|
||||
""" Test that git_search matches the full commit if necessary. """
|
||||
commit_hash = "0123456789abcdef"
|
||||
repo = {commit_hash}
|
||||
prefixlen = util.git_search(repo, commit_hash)
|
||||
assert prefixlen == 16
|
||||
|
||||
|
||||
def test_git_search_double_commit():
|
||||
""" Test that git_search matches a shorter prefix length. """
|
||||
commit_hash = "0123456789abcdef"
|
||||
repo = {commit_hash[:13]}
|
||||
# Locate the shortest prefix length that matches commit_hash.
|
||||
prefixlen = util.git_search(repo, commit_hash)
|
||||
assert prefixlen == 13
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue