Mercurial > hg
changeset 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 | d82f3651cd13 |
children | 5ab414f71e87 |
files | tests/test-acl tests/test-acl.out |
diffstat | 2 files changed, 375 insertions(+), 1 deletions(-) [+] |
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 + +
--- a/tests/test-acl.out Tue Apr 27 19:02:11 2010 -0300 +++ b/tests/test-acl.out Wed Apr 28 11:10:58 2010 -0300 @@ -1163,3 +1163,328 @@ rolling back to revision 1 (undo push) 0:6675d58eff77 +asterisk test +fred is always allowed +Pushing as user fred +hgrc = """ +[acl] +sources = push +[extensions] +[acl.allow] +** = fred +""" +pushing to ../b +searching for changes +common changesets up to 6675d58eff77 +invalidating branch cache (tip differs) +3 changesets found +list of changesets: +ef1ea85a6374b77d6da9dcda9541f498f2d17df7 +f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd +911600dab2ae7a9baff75958b84fe606851ce955 +adding changesets +bundling changes: 0 chunks +bundling changes: 1 chunks +bundling changes: 2 chunks +bundling changes: 3 chunks +bundling changes: 4 chunks +bundling changes: 5 chunks +bundling changes: 6 chunks +bundling changes: 7 chunks +bundling changes: 8 chunks +bundling changes: 9 chunks +bundling manifests: 0 chunks +bundling manifests: 1 chunks +bundling manifests: 2 chunks +bundling manifests: 3 chunks +bundling manifests: 4 chunks +bundling manifests: 5 chunks +bundling manifests: 6 chunks +bundling manifests: 7 chunks +bundling manifests: 8 chunks +bundling manifests: 9 chunks +bundling files: foo/Bar/file.txt 0 chunks +bundling files: foo/Bar/file.txt 1 chunks +bundling files: foo/Bar/file.txt 2 chunks +bundling files: foo/Bar/file.txt 3 chunks +bundling files: foo/file.txt 4 chunks +bundling files: foo/file.txt 5 chunks +bundling files: foo/file.txt 6 chunks +bundling files: foo/file.txt 7 chunks +bundling files: quux/file.py 8 chunks +bundling files: quux/file.py 9 chunks +bundling files: quux/file.py 10 chunks +bundling files: quux/file.py 11 chunks +changesets: 1 chunks +add changeset ef1ea85a6374 +changesets: 2 chunks +add changeset f9cafe1212c8 +changesets: 3 chunks +add changeset 911600dab2ae +adding manifests +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) +adding file changes +adding foo/Bar/file.txt revisions +files: 1/3 chunks (33.33%) +adding foo/file.txt revisions +files: 2/3 chunks (66.67%) +adding quux/file.py revisions +files: 3/3 chunks (100.00%) +added 3 changesets with 3 changes to 3 files +calling hook pretxnchangegroup.acl: hgext.acl.hook +acl: acl.allow enabled, 1 entries for user fred +acl: acl.deny not enabled +acl: allowing changeset ef1ea85a6374 +acl: allowing changeset f9cafe1212c8 +acl: allowing changeset 911600dab2ae +updating the branch cache +rolling back to revision 1 (undo push) +0:6675d58eff77 + +no one is allowed inside foo/Bar/ +Pushing as user fred +hgrc = """ +[acl] +sources = push +[extensions] +[acl.allow] +** = fred +[acl.deny] +foo/Bar/** = * +""" +pushing to ../b +searching for changes +common changesets up to 6675d58eff77 +invalidating branch cache (tip differs) +3 changesets found +list of changesets: +ef1ea85a6374b77d6da9dcda9541f498f2d17df7 +f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd +911600dab2ae7a9baff75958b84fe606851ce955 +adding changesets +bundling changes: 0 chunks +bundling changes: 1 chunks +bundling changes: 2 chunks +bundling changes: 3 chunks +bundling changes: 4 chunks +bundling changes: 5 chunks +bundling changes: 6 chunks +bundling changes: 7 chunks +bundling changes: 8 chunks +bundling changes: 9 chunks +bundling manifests: 0 chunks +bundling manifests: 1 chunks +bundling manifests: 2 chunks +bundling manifests: 3 chunks +bundling manifests: 4 chunks +bundling manifests: 5 chunks +bundling manifests: 6 chunks +bundling manifests: 7 chunks +bundling manifests: 8 chunks +bundling manifests: 9 chunks +bundling files: foo/Bar/file.txt 0 chunks +bundling files: foo/Bar/file.txt 1 chunks +bundling files: foo/Bar/file.txt 2 chunks +bundling files: foo/Bar/file.txt 3 chunks +bundling files: foo/file.txt 4 chunks +bundling files: foo/file.txt 5 chunks +bundling files: foo/file.txt 6 chunks +bundling files: foo/file.txt 7 chunks +bundling files: quux/file.py 8 chunks +bundling files: quux/file.py 9 chunks +bundling files: quux/file.py 10 chunks +bundling files: quux/file.py 11 chunks +changesets: 1 chunks +add changeset ef1ea85a6374 +changesets: 2 chunks +add changeset f9cafe1212c8 +changesets: 3 chunks +add changeset 911600dab2ae +adding manifests +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) +adding file changes +adding foo/Bar/file.txt revisions +files: 1/3 chunks (33.33%) +adding foo/file.txt revisions +files: 2/3 chunks (66.67%) +adding quux/file.py revisions +files: 3/3 chunks (100.00%) +added 3 changesets with 3 changes to 3 files +calling hook pretxnchangegroup.acl: hgext.acl.hook +acl: acl.allow enabled, 1 entries for user fred +acl: acl.deny enabled, 1 entries for user fred +acl: allowing changeset ef1ea85a6374 +acl: user fred denied on foo/Bar/file.txt +error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8 +transaction abort! +rollback completed +abort: acl: access denied for changeset f9cafe1212c8 +no rollback information available +0:6675d58eff77 + +OS-level groups +@group1 is always allowed +Pushing as user fred +hgrc = """ +[acl] +sources = push +[extensions] +[acl.allow] +** = @group1 +""" +pushing to ../b +searching for changes +common changesets up to 6675d58eff77 +3 changesets found +list of changesets: +ef1ea85a6374b77d6da9dcda9541f498f2d17df7 +f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd +911600dab2ae7a9baff75958b84fe606851ce955 +adding changesets +bundling changes: 0 chunks +bundling changes: 1 chunks +bundling changes: 2 chunks +bundling changes: 3 chunks +bundling changes: 4 chunks +bundling changes: 5 chunks +bundling changes: 6 chunks +bundling changes: 7 chunks +bundling changes: 8 chunks +bundling changes: 9 chunks +bundling manifests: 0 chunks +bundling manifests: 1 chunks +bundling manifests: 2 chunks +bundling manifests: 3 chunks +bundling manifests: 4 chunks +bundling manifests: 5 chunks +bundling manifests: 6 chunks +bundling manifests: 7 chunks +bundling manifests: 8 chunks +bundling manifests: 9 chunks +bundling files: foo/Bar/file.txt 0 chunks +bundling files: foo/Bar/file.txt 1 chunks +bundling files: foo/Bar/file.txt 2 chunks +bundling files: foo/Bar/file.txt 3 chunks +bundling files: foo/file.txt 4 chunks +bundling files: foo/file.txt 5 chunks +bundling files: foo/file.txt 6 chunks +bundling files: foo/file.txt 7 chunks +bundling files: quux/file.py 8 chunks +bundling files: quux/file.py 9 chunks +bundling files: quux/file.py 10 chunks +bundling files: quux/file.py 11 chunks +changesets: 1 chunks +add changeset ef1ea85a6374 +changesets: 2 chunks +add changeset f9cafe1212c8 +changesets: 3 chunks +add changeset 911600dab2ae +adding manifests +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) +adding file changes +adding foo/Bar/file.txt revisions +files: 1/3 chunks (33.33%) +adding foo/file.txt revisions +files: 2/3 chunks (66.67%) +adding quux/file.py revisions +files: 3/3 chunks (100.00%) +added 3 changesets with 3 changes to 3 files +calling hook pretxnchangegroup.acl: hgext.acl.hook +acl: acl.allow enabled, 1 entries for user fred +acl: acl.deny not enabled +acl: allowing changeset ef1ea85a6374 +acl: allowing changeset f9cafe1212c8 +acl: allowing changeset 911600dab2ae +updating the branch cache +rolling back to revision 1 (undo push) +0:6675d58eff77 + +@group is allowed inside anything but foo/Bar/ +Pushing as user fred +hgrc = """ +[acl] +sources = push +[extensions] +[acl.allow] +** = @group1 +[acl.deny] +foo/Bar/** = @group1 +""" +pushing to ../b +searching for changes +common changesets up to 6675d58eff77 +invalidating branch cache (tip differs) +3 changesets found +list of changesets: +ef1ea85a6374b77d6da9dcda9541f498f2d17df7 +f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd +911600dab2ae7a9baff75958b84fe606851ce955 +adding changesets +bundling changes: 0 chunks +bundling changes: 1 chunks +bundling changes: 2 chunks +bundling changes: 3 chunks +bundling changes: 4 chunks +bundling changes: 5 chunks +bundling changes: 6 chunks +bundling changes: 7 chunks +bundling changes: 8 chunks +bundling changes: 9 chunks +bundling manifests: 0 chunks +bundling manifests: 1 chunks +bundling manifests: 2 chunks +bundling manifests: 3 chunks +bundling manifests: 4 chunks +bundling manifests: 5 chunks +bundling manifests: 6 chunks +bundling manifests: 7 chunks +bundling manifests: 8 chunks +bundling manifests: 9 chunks +bundling files: foo/Bar/file.txt 0 chunks +bundling files: foo/Bar/file.txt 1 chunks +bundling files: foo/Bar/file.txt 2 chunks +bundling files: foo/Bar/file.txt 3 chunks +bundling files: foo/file.txt 4 chunks +bundling files: foo/file.txt 5 chunks +bundling files: foo/file.txt 6 chunks +bundling files: foo/file.txt 7 chunks +bundling files: quux/file.py 8 chunks +bundling files: quux/file.py 9 chunks +bundling files: quux/file.py 10 chunks +bundling files: quux/file.py 11 chunks +changesets: 1 chunks +add changeset ef1ea85a6374 +changesets: 2 chunks +add changeset f9cafe1212c8 +changesets: 3 chunks +add changeset 911600dab2ae +adding manifests +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) +adding file changes +adding foo/Bar/file.txt revisions +files: 1/3 chunks (33.33%) +adding foo/file.txt revisions +files: 2/3 chunks (66.67%) +adding quux/file.py revisions +files: 3/3 chunks (100.00%) +added 3 changesets with 3 changes to 3 files +calling hook pretxnchangegroup.acl: hgext.acl.hook +acl: acl.allow enabled, 1 entries for user fred +acl: acl.deny enabled, 1 entries for user fred +acl: allowing changeset ef1ea85a6374 +acl: user fred denied on foo/Bar/file.txt +error: pretxnchangegroup.acl hook failed: acl: access denied for changeset f9cafe1212c8 +transaction abort! +rollback completed +abort: acl: access denied for changeset f9cafe1212c8 +no rollback information available +0:6675d58eff77 +