commit 9210d298790149ecda176baadae4b1325b1113b5 from: Mark Jamsek via: Thomas Adam date: Wed Nov 27 20:56:51 2024 UTC gotwebd: basic blame and tree action regress; ok stsp@ commit - 386c230ce945394685a9a52cf9cbd33acac93ce7 commit + 9210d298790149ecda176baadae4b1325b1113b5 blob - /dev/null blob + aab925b8016a488419bc22269b98624b2f70ea2a (mode 644) --- /dev/null +++ regress/gotwebd/action_blame.html @@ -0,0 +1,7 @@ +Content-Security-Policy: default-src 'self'; script-src 'none'; object-src 'none'; +Content-Type: text/html + +Gotweb

Blame


1 ${COMMIT_ID8} ${COMMIT_YMD} ${COMMITTER} alpha +

Got Owner

blob - /dev/null blob + 04128f4bdb98962d74f179c4849e04da560b5bec (mode 644) --- /dev/null +++ regress/gotwebd/action_tree.html @@ -0,0 +1,6 @@ +Content-Security-Policy: default-src 'self'; script-src 'none'; object-src 'none'; +Content-Type: text/html + +Gotweb

Tree


alphacommits | blame
betacommits | blame
epsilon/
gamma/
blob - 835f0a599f14f193c79d96780f45c2df410e6988 blob + f585c07b32722294e8e10ab951a1f41825e83fcf --- regress/gotwebd/test_gotwebd.sh +++ regress/gotwebd/test_gotwebd.sh @@ -73,6 +73,63 @@ test_gotwebd_action_commit() test_done "$testroot" "$repo" "$ret" } +test_gotwebd_action_blame() +{ + local testroot=$(test_init gotwebd_action_blame 1) + local repo="${GOTWEBD_TEST_CHROOT}/got/public/repo.git" + local id=$(git_show_head $repo) + local author_time=$(git_show_author_time $repo) + local qs="action=blame&commit=${id}&file=alpha&folder=&path=repo.git" + + COMMIT_ID=$id \ + COMMITTER="flan_hack" \ + COMMIT_ID8=$(printf '%.8s' $id) \ + COMMIT_YMD=$(date -u -r $author_time +"%F") \ + COMMIT_YMDHMS=$(date -u -r $author_time +"%FT%TZ") \ + COMMIT_DATE=$(date -u -r $author_time +"%a %b %e %X %Y") \ + interpolate action_blame.html > $testroot/content.expected + + $GOTWEBD_TEST_FCGI -q "$qs" > $testroot/content + + cmp -s $testroot/content.expected $testroot/content + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/content.expected $testroot/content + test_done "$testroot" "$repo" "$ret" + return 1 + fi + + test_done "$testroot" "$repo" "$ret" +} + +test_gotwebd_action_tree() +{ + local testroot=$(test_init gotwebd_action_tree 1) + local repo="${GOTWEBD_TEST_CHROOT}/got/public/repo.git" + local author_time=$(git_show_author_time $repo) + local qs="action=tree&path=repo.git" + + COMMIT_ID=$(git_show_head $repo) \ + COMMIT_YMDHMS=$(date -u -r $author_time +"%FT%TZ") \ + COMMIT_DATE=$(date -u -r $author_time +"%a %b %e %X %Y") \ + TREE_ID=$(got cat -r $repo main | head -1 | cut -d ' ' -f2) \ + interpolate action_tree.html > $testroot/content.expected + + $GOTWEBD_TEST_FCGI -q "$qs" > $testroot/content + + cmp -s $testroot/content.expected $testroot/content + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/content.expected $testroot/content + test_done "$testroot" "$repo" "$ret" + return 1 + fi + + test_done "$testroot" "$repo" "$ret" +} + test_parseargs "$@" run_test test_gotwebd_action_index run_test test_gotwebd_action_commit +run_test test_gotwebd_action_blame +run_test test_gotwebd_action_tree