tests/test-hgweb
author Bryan O'Sullivan <bos@serpentine.com>
Wed, 28 Nov 2007 11:54:39 -0600
changeset 5564 b4af2dd9868a
parent 5561 22713dce19f6
child 5580 f429e0e067a8
permissions -rwxr-xr-x
hgweb: account for Python 2.4 in one test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3942
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     1
#!/bin/sh
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     2
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     3
hg init test
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     4
cd test
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     5
mkdir da
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     6
echo foo > da/foo
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     7
echo foo > foo
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
     8
hg ci -Ambase -d '0 0'
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3942
diff changeset
     9
hg serve -p $HGPORT -d --pid-file=hg.pid
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    10
cat hg.pid >> $DAEMON_PIDS
3942
8eccfce0ab5e hgweb: simple tests
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
    11
echo % manifest
5384
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3942
diff changeset
    12
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/?style=raw')
e3a0c092b4e2 Allow tests to run in parallel.
Bryan O'Sullivan <bos@serpentine.com>
parents: 3942
diff changeset
    13
("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/da?style=raw')
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    14
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    15
echo % plain file
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    16
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    17
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    18
echo % should give a 404 - static file that does not exist
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    19
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/bogus'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    20
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    21
echo % should give a 404 - bad revision
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    22
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/spam/foo?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    23
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    24
echo % should give a 400 - bad command
5564
b4af2dd9868a hgweb: account for Python 2.4 in one test
Bryan O'Sullivan <bos@serpentine.com>
parents: 5561
diff changeset
    25
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/foo?cmd=spam&style=raw' | sed 's/400.*/400/'
5561
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    26
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    27
echo % should give a 404 - file does not exist
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    28
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/bork?style=raw'
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    29
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    30
echo % static file
22713dce19f6 hgweb: return meaningful HTTP status codes instead of nonsense
Bryan O'Sullivan <bos@serpentine.com>
parents: 5384
diff changeset
    31
"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/static/style-gitweb.css'