test/unittest_ruleset.py
changeset 372 80f78674c56e
parent 371 e9ce904b62a9
--- a/test/unittest_ruleset.py	Mon Nov 03 11:12:35 2014 +0100
+++ b/test/unittest_ruleset.py	Mon Nov 03 11:12:45 2014 +0100
@@ -4,7 +4,7 @@
 from mercurialserver import ruleset
 
 class _RuleSetBaseTC(TestCase):
-    alllevels = ["init", "write", "read", "deny", "none"]
+    alllevels = ["init", "publish", "write", "read", "deny", "none"]
     levels = alllevels[:-1]
     def setUp(self):
         self.rs = ruleset.Ruleset()
@@ -161,6 +161,27 @@
         self.check_level('deny', repo='no')
         self.check_level('write', repo='other')
 
+class RuleSetPublishTC(_RuleSetBaseTC):
+    accessrules = '''
+init user=root/**
+deny repo=hgadmin
+init user=users/toto/* repo=toto
+publish user=users/toto/* repo=pub/**
+publish repo=allpub/**
+write user=users/w/*
+read user=users/**
+'''
+    def test_publish(self):
+        self.rs.set(user='users/w/key')
+        self.check_level('publish', repo='allpub/stuff')
+        self.check_level('write', repo='toto')
+        self.check_level('write', repo='other/stuff')
+
+        self.rs.set(repo='pub/stuff')
+        self.check_level('write', user='users/w/key')
+        self.check_level('publish', user='users/toto/key')
+
+
 if __name__ == '__main__':
     from unittest import main
     main()