Mercurial > hg
comparison tests/test-acl.t @ 36506:74c033b9d579
test-acl: mock up util.getuser() to trust $LOGNAME on Windows
The test relies on POSIX-like getuser() behavior, so we can't use
windows.getuser().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 27 Feb 2018 22:37:57 +0900 |
parents | 1d118f9f4f57 |
children | 2090044a288d |
comparison
equal
deleted
inserted
replaced
36505:db33c5bc781f | 36506:74c033b9d579 |
---|---|
19 > hg --cwd b rollback | 19 > hg --cwd b rollback |
20 > hg --cwd b --quiet tip | 20 > hg --cwd b --quiet tip |
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 |
27 > from hgext import acl | 36 > from hgext import acl |
28 > def fakegetusers(ui, group): | 37 > def fakegetusers(ui, group): |
39 > pretxnchangegroup.acl = python:hgext.acl.hook | 48 > pretxnchangegroup.acl = python:hgext.acl.hook |
40 > [acl] | 49 > [acl] |
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 |
47 $ hg init a | 57 $ hg init a |
48 $ cd a | 58 $ cd a |
70 new changesets 6675d58eff77 | 80 new changesets 6675d58eff77 |
71 updating to branch default | 81 updating to branch default |
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 |
78 $ do_push fred | 92 $ do_push fred |
79 Pushing as user fred | 93 Pushing as user fred |
1124 [hooks] | 1138 [hooks] |
1125 pretxnchangegroup.acl = python:hgext.acl.hook | 1139 pretxnchangegroup.acl = python:hgext.acl.hook |
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 """ |
1132 pushing to ../b | 1147 pushing to ../b |
1133 query 1; heads | 1148 query 1; heads |
1204 [hooks] | 1219 [hooks] |
1205 pretxnchangegroup.acl = python:hgext.acl.hook | 1220 pretxnchangegroup.acl = python:hgext.acl.hook |
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] |
1212 foo/Bar/** = * | 1228 foo/Bar/** = * |
1213 """ | 1229 """ |
1285 [hooks] | 1301 [hooks] |
1286 pretxnchangegroup.acl = python:hgext.acl.hook | 1302 pretxnchangegroup.acl = python:hgext.acl.hook |
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 """ |
1293 pushing to ../b | 1310 pushing to ../b |
1294 query 1; heads | 1311 query 1; heads |
1366 [hooks] | 1383 [hooks] |
1367 pretxnchangegroup.acl = python:hgext.acl.hook | 1384 pretxnchangegroup.acl = python:hgext.acl.hook |
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] |
1374 foo/Bar/** = @group1 | 1392 foo/Bar/** = @group1 |
1375 """ | 1393 """ |
1489 [hooks] | 1507 [hooks] |
1490 pretxnchangegroup.acl = python:hgext.acl.hook | 1508 pretxnchangegroup.acl = python:hgext.acl.hook |
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 |
1497 searching for changes | 1516 searching for changes |
1498 all remote heads known locally | 1517 all remote heads known locally |
1571 [hooks] | 1590 [hooks] |
1572 pretxnchangegroup.acl = python:hgext.acl.hook | 1591 pretxnchangegroup.acl = python:hgext.acl.hook |
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 """ |
1579 pushing to ../b | 1599 pushing to ../b |
1580 query 1; heads | 1600 query 1; heads |
1649 [hooks] | 1669 [hooks] |
1650 pretxnchangegroup.acl = python:hgext.acl.hook | 1670 pretxnchangegroup.acl = python:hgext.acl.hook |
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 |
1657 query 1; heads | 1678 query 1; heads |
1658 searching for changes | 1679 searching for changes |
1721 [hooks] | 1742 [hooks] |
1722 pretxnchangegroup.acl = python:hgext.acl.hook | 1743 pretxnchangegroup.acl = python:hgext.acl.hook |
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 """ |
1729 pushing to ../b | 1751 pushing to ../b |
1730 query 1; heads | 1752 query 1; heads |
1788 [hooks] | 1810 [hooks] |
1789 pretxnchangegroup.acl = python:hgext.acl.hook | 1811 pretxnchangegroup.acl = python:hgext.acl.hook |
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 """ |
1796 pushing to ../b | 1819 pushing to ../b |
1797 query 1; heads | 1820 query 1; heads |
1876 [hooks] | 1899 [hooks] |
1877 pretxnchangegroup.acl = python:hgext.acl.hook | 1900 pretxnchangegroup.acl = python:hgext.acl.hook |
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 |
1884 """ | 1908 """ |
1885 pushing to ../b | 1909 pushing to ../b |
1963 [hooks] | 1987 [hooks] |
1964 pretxnchangegroup.acl = python:hgext.acl.hook | 1988 pretxnchangegroup.acl = python:hgext.acl.hook |
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 |
1971 * = george | 1996 * = george |
1972 """ | 1997 """ |
2037 [hooks] | 2062 [hooks] |
2038 pretxnchangegroup.acl = python:hgext.acl.hook | 2063 pretxnchangegroup.acl = python:hgext.acl.hook |
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 """ |
2045 pushing to ../b | 2071 pushing to ../b |
2046 query 1; heads | 2072 query 1; heads |
2119 [hooks] | 2145 [hooks] |
2120 pretxnchangegroup.acl = python:hgext.acl.hook | 2146 pretxnchangegroup.acl = python:hgext.acl.hook |
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 """ |
2127 pushing to ../b | 2154 pushing to ../b |
2128 query 1; heads | 2155 query 1; heads |