Test file access conditions - they don't work
authorPaul Crowley <paul@lshift.net>
Tue, 15 Dec 2009 13:52:23 +0000
changeset 268 24145a4eb6fc
parent 267 4f24892b33fe
child 269 a09f1bc9a6cf
Test file access conditions - they don't work
action/test1
action/test2
--- a/action/test1	Wed Dec 02 18:52:02 2009 +0000
+++ b/action/test1	Tue Dec 15 13:52:23 2009 +0000
@@ -11,19 +11,31 @@
 Port 2222
 __END__
 
+echo "Cloning hgadmin..."
 hg clone ssh://chroothg/hgadmin
+echo "Updating hgadmin..."
 cd hgadmin
-mkdir -p keys/users
-cp /home/test2/.ssh/id_rsa.pub keys/users/test2
-hg add keys/users/test2
+
+cat > access.conf <<__END__
+read user=restricted/** file=special/**
+write user=restricted/**
+__END__
+mkdir -p keys/restricted
+cp /home/test2/.ssh/id_rsa.pub keys/restricted/test2
+
+hg add keys/restricted/test2 access.conf
 hg commit -u test1 -m "Added user test2"
+echo "Push"
 hg push
 cd ..
 mkdir realrepo
 cd realrepo
 hg init .
 echo "This is a file" > content
-hg add content
+mkdir special
+echo "This is a file not everyone can write to" > special/cantwrite
+hg add content special/cantwrite
 hg commit -u test1 -m "Add a file to the repo"
+echo "Pushing changes"
 hg clone . ssh://chroothg/real/project
-
+echo "Done for user test1"
--- a/action/test2	Wed Dec 02 18:52:02 2009 +0000
+++ b/action/test2	Tue Dec 15 13:52:23 2009 +0000
@@ -11,10 +11,19 @@
 Port 2222
 __END__
 
+echo "Pulling real project"
 hg clone ssh://chroothg/real/project
 cd project
 echo "and I'm adding something" >> content
 hg commit -u test2 -m "Added something to the file"
 hg push
-
-
+echo "This should fail" >> special/cantwrite
+hg commit -u test2 -m "WONTPUSH"
+# Fail only if this succeeds
+echo "About to do bad push"
+hg push && false
+echo "OK, checking that didn't push"
+hg outgoing --template '{desc}'
+echo "really checking now"
+hg outgoing --template '{desc}' | grep -q WONTPUSH
+echo "done"