##// END OF EJS Templates
test-acl: mock up util.getuser() to trust $LOGNAME on Windows...
Yuya Nishihara -
r36524:74c033b9 default
parent child Browse files
Show More
@@ -21,6 +21,15
21 21 > echo
22 22 > }
23 23
24 > cat > posixgetuser.py <<'EOF'
25 > import getpass
26 > from mercurial import pycompat, util
27 > def posixgetuser():
28 > return pycompat.fsencode(getpass.getuser())
29 > if not pycompat.isposix:
30 > util.getuser = posixgetuser # forcibly trust $LOGNAME
31 > EOF
32
24 33 > init_config()
25 34 > {
26 35 > cat > fakegroups.py <<EOF
@@ -41,6 +50,7
41 50 > sources = push
42 51 > [extensions]
43 52 > f=`pwd`/fakegroups.py
53 > posixgetuser=$TESTTMP/posixgetuser.py
44 54 > EOF
45 55 > }
46 56
@@ -72,6 +82,10
72 82 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 83
74 84 $ config=b/.hg/hgrc
85 $ cat >> "$config" <<EOF
86 > [extensions]
87 > posixgetuser=$TESTTMP/posixgetuser.py
88 > EOF
75 89
76 90 Extension disabled for lack of a hook
77 91
@@ -1126,6 +1140,7 fred is always allowed
1126 1140 [acl]
1127 1141 sources = push
1128 1142 [extensions]
1143 posixgetuser=$TESTTMP/posixgetuser.py
1129 1144 [acl.allow]
1130 1145 ** = fred
1131 1146 """
@@ -1206,6 +1221,7 no one is allowed inside foo/Bar/
1206 1221 [acl]
1207 1222 sources = push
1208 1223 [extensions]
1224 posixgetuser=$TESTTMP/posixgetuser.py
1209 1225 [acl.allow]
1210 1226 ** = fred
1211 1227 [acl.deny]
@@ -1287,6 +1303,7 OS-level groups
1287 1303 [acl]
1288 1304 sources = push
1289 1305 [extensions]
1306 posixgetuser=$TESTTMP/posixgetuser.py
1290 1307 [acl.allow]
1291 1308 ** = @group1
1292 1309 """
@@ -1368,6 +1385,7 OS-level groups
1368 1385 [acl]
1369 1386 sources = push
1370 1387 [extensions]
1388 posixgetuser=$TESTTMP/posixgetuser.py
1371 1389 [acl.allow]
1372 1390 ** = @group1
1373 1391 [acl.deny]
@@ -1491,6 +1509,7 No branch acls specified
1491 1509 [acl]
1492 1510 sources = push
1493 1511 [extensions]
1512 posixgetuser=$TESTTMP/posixgetuser.py
1494 1513 """
1495 1514 pushing to ../b
1496 1515 query 1; heads
@@ -1573,6 +1592,7 Branch acl deny test
1573 1592 [acl]
1574 1593 sources = push
1575 1594 [extensions]
1595 posixgetuser=$TESTTMP/posixgetuser.py
1576 1596 [acl.deny.branches]
1577 1597 foobar = *
1578 1598 """
@@ -1651,6 +1671,7 Branch acl empty allow test
1651 1671 [acl]
1652 1672 sources = push
1653 1673 [extensions]
1674 posixgetuser=$TESTTMP/posixgetuser.py
1654 1675 [acl.allow.branches]
1655 1676 """
1656 1677 pushing to ../b
@@ -1723,6 +1744,7 Branch acl allow other
1723 1744 [acl]
1724 1745 sources = push
1725 1746 [extensions]
1747 posixgetuser=$TESTTMP/posixgetuser.py
1726 1748 [acl.allow.branches]
1727 1749 * = george
1728 1750 """
@@ -1790,6 +1812,7 Branch acl allow other
1790 1812 [acl]
1791 1813 sources = push
1792 1814 [extensions]
1815 posixgetuser=$TESTTMP/posixgetuser.py
1793 1816 [acl.allow.branches]
1794 1817 * = george
1795 1818 """
@@ -1878,6 +1901,7 push foobar into the remote
1878 1901 [acl]
1879 1902 sources = push
1880 1903 [extensions]
1904 posixgetuser=$TESTTMP/posixgetuser.py
1881 1905 [acl.allow.branches]
1882 1906 foobar = astro
1883 1907 * = george
@@ -1965,6 +1989,7 Branch acl conflicting deny
1965 1989 [acl]
1966 1990 sources = push
1967 1991 [extensions]
1992 posixgetuser=$TESTTMP/posixgetuser.py
1968 1993 [acl.deny.branches]
1969 1994 foobar = astro
1970 1995 default = astro
@@ -2039,6 +2064,7 User 'astro' must not be denied
2039 2064 [acl]
2040 2065 sources = push
2041 2066 [extensions]
2067 posixgetuser=$TESTTMP/posixgetuser.py
2042 2068 [acl.deny.branches]
2043 2069 default = !astro
2044 2070 """
@@ -2121,6 +2147,7 Non-astro users must be denied
2121 2147 [acl]
2122 2148 sources = push
2123 2149 [extensions]
2150 posixgetuser=$TESTTMP/posixgetuser.py
2124 2151 [acl.deny.branches]
2125 2152 default = !astro
2126 2153 """
General Comments 0
You need to be logged in to leave comments. Login now