From 1d329b62c2dc4d8ccc41d5689f75389aa6a4fb6d Mon Sep 17 00:00:00 2001 From: Rajith Muditha Attapattu Date: Wed, 12 May 2010 18:39:24 +0000 Subject: Added a few more test cases for acl file format. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@943624 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/acl.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/tests/acl.py b/cpp/src/tests/acl.py index a7725b36a6..2d6a5b489d 100755 --- a/cpp/src/tests/acl.py +++ b/cpp/src/tests/acl.py @@ -168,8 +168,23 @@ class ACLTests(TestBase010): if (result.text.find("Non-continuation line must start with \"group\" or \"acl\"",0,len(result.text)) == -1): self.fail(result) + def test_llegal_extension_lines(self): + """ + Test proper extention lines + """ + aclf = ACLFile() + aclf.write('group test1 joe@EXAMPLE.com \\ \n') # should be allowed + aclf.write(' jack@EXAMPLE.com \\ \n') # should be allowed + aclf.write('jill@TEST.COM \\ \n') # should be allowed + aclf.write('host/123.example.com@TEST.COM\n') # should be allowed + aclf.write('acl allow all all') + aclf.close() + + result = self.reload_acl() + if (result.text.find("ACL format error",0,len(result.text)) != -1): + self.fail(result) - def test_user_domain(self): + def test_user_realm(self): """ Test a user defined without a realm Ex. group admin rajith @@ -191,8 +206,7 @@ class ACLTests(TestBase010): """ aclf = ACLFile() aclf.write('group test1 joe@EXAMPLE.com\n') # should be allowed - aclf.write('group test2 jack-jill@EXAMPLE.com\n') # should be allowed - aclf.write('group test3 jack_jill@EXAMPLE.com\n') # should be allowed + aclf.write('group test2 jack_123-jill@EXAMPLE.com\n') # should be allowed aclf.write('group test4 host/somemachine.example.com@EXAMPLE.COM\n') # should be allowed aclf.write('acl allow all all') aclf.close() @@ -201,6 +215,15 @@ class ACLTests(TestBase010): if (result.text.find("ACL format error",0,len(result.text)) != -1): self.fail(result) + aclf = ACLFile() + aclf.write('group test1 joe$H@EXAMPLE.com\n') # shouldn't be allowed + aclf.write('acl allow all all') + aclf.close() + + result = self.reload_acl() + if (result.text.find("Username \"joe$H@EXAMPLE.com\" contains illegal characters",0,len(result.text)) == -1): + self.fail(result) + #===================================== # ACL validation tests #===================================== -- cgit v1.2.1