sapling/tests/test-hgweb

45 lines
1.5 KiB
Plaintext
Raw Normal View History

2006-12-20 04:14:45 +03:00
#!/bin/sh
# Some tests for hgweb. Tests static files, plain files and different 404's.
2006-12-20 04:14:45 +03:00
hg init test
cd test
mkdir da
echo foo > da/foo
echo foo > foo
hg ci -Ambase -d '0 0'
hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
cat hg.pid >> $DAEMON_PIDS
2006-12-20 04:14:45 +03:00
echo % manifest
2007-10-05 23:17:01 +04:00
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw')
echo % plain file
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw'
echo % should give a 404 - static file that does not exist
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus'
echo % should give a 404 - bad revision
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw'
echo % should give a 400 - bad command
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/'
echo % should give a 404 - file does not exist
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw'
2008-03-24 01:08:18 +03:00
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork'
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/tip/bork?style=raw'
2007-12-24 19:21:40 +03:00
echo % stop and restart
kill `cat hg.pid`
hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log
cat hg.pid >> $DAEMON_PIDS
# Test the access/error files are opened in append mode
python -c "print len(file('access.log').readlines()), 'log lines written'"
echo % static file
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css'
echo % errors
cat errors.log