Mercurial > hg-stable
diff tests/test-acl @ 11043:08681cb66231
acl: add tests for asterisk and for OS-level groups
author | Elifarley Callado Coelho Cruz <elifarley@gmail.com> |
---|---|
date | Wed, 28 Apr 2010 11:10:58 -0300 |
parents | bb5ea66789e3 |
children | a869a6a42c9e |
line wrap: on
line diff
--- a/tests/test-acl Tue Apr 27 19:02:11 2010 -0300 +++ b/tests/test-acl Wed Apr 28 11:10:58 2010 -0300 @@ -7,7 +7,7 @@ echo "Pushing as user $user" echo 'hgrc = """' - sed -e 1,2d b/.hg/hgrc + sed -e 1,2d b/.hg/hgrc | grep -v /tmp/ echo '"""' if test -f acl.config; then echo 'acl.config = """' @@ -24,6 +24,24 @@ echo } +init_config() +{ +cat > fakegroups.py <<EOF +from hgext import acl +acl._getusers = lambda x: ["fred", "betty"] +EOF + +rm -f acl.config +cat > $config <<EOF +[hooks] +pretxnchangegroup.acl = python:hgext.acl.hook +[acl] +sources = push +[extensions] +f=$PWD/fakegroups.py +EOF +} + hg init a cd a mkdir foo foo/Bar quux @@ -111,3 +129,34 @@ echo 'changegroup.acl = false' >> acl.config do_push barney +# asterisk + +init_config + +echo 'asterisk test' +echo '[acl.allow]' >> $config +echo "** = fred" >> $config +echo "fred is always allowed" +do_push fred + +echo '[acl.deny]' >> $config +echo "foo/Bar/** = *" >> $config +echo "no one is allowed inside foo/Bar/" +do_push fred + +# Groups + +init_config + +echo 'OS-level groups' +echo '[acl.allow]' >> $config +echo "** = @group1" >> $config +echo "@group1 is always allowed" +do_push fred + +echo '[acl.deny]' >> $config +echo "foo/Bar/** = @group1" >> $config +echo "@group is allowed inside anything but foo/Bar/" +do_push fred + +