tests/test-push-http
branchstable
changeset 12795 3cb0559e44d0
parent 12793 469850088fc1
parent 12794 6bf8d48bec8e
child 12796 bc69ba99e34b
equal deleted inserted replaced
12793:469850088fc1 12795:3cb0559e44d0
     1 #!/bin/sh
       
     2 
       
     3 cp "$TESTDIR"/printenv.py .
       
     4 
       
     5 hg init test
       
     6 cd test
       
     7 echo a > a
       
     8 hg ci -Ama
       
     9 
       
    10 cd ..
       
    11 hg clone test test2
       
    12 cd test2
       
    13 echo a >> a
       
    14 hg ci -mb
       
    15 
       
    16 req() {
       
    17 	hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
       
    18 	cat hg.pid >> $DAEMON_PIDS
       
    19 	hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
       
    20 	kill `cat hg.pid`
       
    21 	echo % serve errors
       
    22 	cat errors.log
       
    23 }
       
    24 
       
    25 cd ../test
       
    26 
       
    27 echo % expect ssl error
       
    28 req
       
    29 
       
    30 echo % expect authorization error
       
    31 echo '[web]' > .hg/hgrc
       
    32 echo 'push_ssl = false' >> .hg/hgrc
       
    33 req
       
    34 
       
    35 echo % expect authorization error: must have authorized user
       
    36 echo 'allow_push = unperson' >> .hg/hgrc
       
    37 req
       
    38 
       
    39 echo % expect success
       
    40 echo 'allow_push = *' >> .hg/hgrc
       
    41 echo '[hooks]' >> .hg/hgrc
       
    42 echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc
       
    43 req
       
    44 
       
    45 hg rollback
       
    46 echo % expect authorization error: all users denied
       
    47 echo '[web]' > .hg/hgrc
       
    48 echo 'push_ssl = false' >> .hg/hgrc
       
    49 echo 'deny_push = *' >> .hg/hgrc
       
    50 req
       
    51 
       
    52 echo % expect authorization error: some users denied, users must be authenticated
       
    53 echo 'deny_push = unperson' >> .hg/hgrc
       
    54 req