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