Mercurial > hg
diff tests/test-hgwebdir @ 5561:22713dce19f6
hgweb: return meaningful HTTP status codes instead of nonsense
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Wed, 28 Nov 2007 08:38:42 -0800 |
parents | |
children | 733b50883f73 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-hgwebdir Wed Nov 28 08:38:42 2007 -0800 @@ -0,0 +1,55 @@ +#!/bin/sh + +mkdir webdir +cd webdir + +hg init a +echo a > a/a +hg --cwd a ci -Ama -d'1 0' + +hg init b +echo b > b/b +hg --cwd b ci -Amb -d'2 0' + +hg init c +echo c > c/c +hg --cwd c ci -Amc -d'3 0' +root=`pwd` + +cd .. + +cat > paths.conf <<EOF +[paths] +a=$root/a +b=$root/b +EOF + +hg serve -p $HGPORT -d --pid-file=hg.pid --webdir-conf paths.conf \ + -A access-paths.log -E error-paths.log +cat hg.pid >> $DAEMON_PIDS + +echo % should give a 404 - file does not exist +"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/bork?style=raw' + +echo % should succeed +"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/?style=raw' +"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/a/file/tip/a?style=raw' +"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/b/file/tip/b?style=raw' + +echo % should give a 404 - repo is not published +"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/c/file/tip/c?style=raw' + +cat > collections.conf <<EOF +[collections] +$root=$root +EOF + +hg serve -p $HGPORT1 -d --pid-file=hg.pid --webdir-conf collections.conf \ + -A access-collections.log -E error-collections.log +cat hg.pid >> $DAEMON_PIDS + +echo % should succeed +"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/?style=raw' +"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/a/file/tip/a?style=raw' +"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/b/file/tip/b?style=raw' +"$TESTDIR/get-with-headers.py" localhost:$HGPORT1 '/c/file/tip/c?style=raw'