##// END OF EJS Templates
tests: unify test-push-http
Matt Mackall -
r12483:fecd4966 default
parent child Browse files
Show More
@@ -1,54 +1,87 b''
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
1
10 cd ..
2 $ cp "$TESTDIR"/printenv.py .
11 hg clone test test2
3 $ hg init test
12 cd test2
4 $ cd test
13 echo a >> a
5 $ echo a > a
14 hg ci -mb
6 $ hg ci -Ama
7 adding a
8 $ cd ..
9 $ hg clone test test2
10 updating to branch default
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 $ cd test2
13 $ echo a >> a
14 $ hg ci -mb
15 $ req() {
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 > cat hg.pid >> $DAEMON_PIDS
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 > kill `cat hg.pid`
20 > echo % serve errors
21 > cat errors.log
22 > }
23 $ cd ../test
15
24
16 req() {
25 expect ssl error
17 hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
26
18 cat hg.pid >> $DAEMON_PIDS
27 $ req
19 hg --cwd ../test2 push http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
28 pushing to http://localhost:*/ (glob)
20 kill `cat hg.pid`
29 searching for changes
21 echo % serve errors
30 remote: ssl required
22 cat errors.log
31 % serve errors
23 }
32
33 expect authorization error
24
34
25 cd ../test
35 $ echo '[web]' > .hg/hgrc
36 $ echo 'push_ssl = false' >> .hg/hgrc
37 $ req
38 pushing to http://localhost:*/ (glob)
39 searching for changes
40 abort: authorization failed
41 % serve errors
42
43 expect authorization error: must have authorized user
26
44
27 echo % expect ssl error
45 $ echo 'allow_push = unperson' >> .hg/hgrc
28 req
46 $ req
47 pushing to http://localhost:*/ (glob)
48 searching for changes
49 abort: authorization failed
50 % serve errors
29
51
30 echo % expect authorization error
52 expect success
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
53
39 echo % expect success
54 $ echo 'allow_push = *' >> .hg/hgrc
40 echo 'allow_push = *' >> .hg/hgrc
55 $ echo '[hooks]' >> .hg/hgrc
41 echo '[hooks]' >> .hg/hgrc
56 $ echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc
42 echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc
57 $ req
43 req
58 pushing to http://localhost:*/ (glob)
59 searching for changes
60 remote: adding changesets
61 remote: adding manifests
62 remote: adding file changes
63 remote: added 1 changesets with 1 changes to 1 files
64 remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http
65 % serve errors
66 $ hg rollback
67 rolling back to revision 0 (undo serve)
68
69 expect authorization error: all users denied
44
70
45 hg rollback
71 $ echo '[web]' > .hg/hgrc
46 echo % expect authorization error: all users denied
72 $ echo 'push_ssl = false' >> .hg/hgrc
47 echo '[web]' > .hg/hgrc
73 $ echo 'deny_push = *' >> .hg/hgrc
48 echo 'push_ssl = false' >> .hg/hgrc
74 $ req
49 echo 'deny_push = *' >> .hg/hgrc
75 pushing to http://localhost:*/ (glob)
50 req
76 searching for changes
77 abort: authorization failed
78 % serve errors
51
79
52 echo % expect authorization error: some users denied, users must be authenticated
80 expect authorization error: some users denied, users must be authenticated
53 echo 'deny_push = unperson' >> .hg/hgrc
81
54 req
82 $ echo 'deny_push = unperson' >> .hg/hgrc
83 $ req
84 pushing to http://localhost:*/ (glob)
85 searching for changes
86 abort: authorization failed
87 % serve errors
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now