qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject [2/2] qpid-dispatch git commit: Adjust tests to use new lookup scheme.
Date Sun, 24 Jan 2016 16:46:39 GMT
Adjust tests to use new lookup scheme.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/6bfd1272
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/6bfd1272
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/6bfd1272

Branch: refs/heads/crolke-DISPATCH-188-1
Commit: 6bfd1272d7bd7c4ef13aa8db9b84240c59f63e29
Parents: e84dee4
Author: Chuck Rolke <crolke@redhat.com>
Authored: Sun Jan 24 11:46:28 2016 -0500
Committer: Chuck Rolke <crolke@redhat.com>
Committed: Sun Jan 24 11:46:28 2016 -0500

----------------------------------------------------------------------
 .../management/policy_local.py                  |  2 +-
 tests/system_tests_policy.py                    | 45 ++++++++++++--------
 2 files changed, 28 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6bfd1272/python/qpid_dispatch_internal/management/policy_local.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/policy_local.py b/python/qpid_dispatch_internal/management/policy_local.py
index dbdb339..6c455a7 100644
--- a/python/qpid_dispatch_internal/management/policy_local.py
+++ b/python/qpid_dispatch_internal/management/policy_local.py
@@ -489,7 +489,7 @@ class PolicyLocal(object):
                 return True
 
             if not app in self.policydb:
-                print("LogMe: no policy defined for application %s" % app)
+                # TODO: ("LogMe: no policy defined for application %s" % app)
                 policyname.append("")
                 return False
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6bfd1272/tests/system_tests_policy.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_policy.py b/tests/system_tests_policy.py
index fa531e4..be7389f 100644
--- a/tests/system_tests_policy.py
+++ b/tests/system_tests_policy.py
@@ -162,7 +162,8 @@ class PolicyHostAddrTest(TestCase):
 
 class PolicyFile(TestCase):
 
-    policy = PolicyLocal("../../../tests/policy-1")
+    policy = PolicyLocal()
+    policy.test_load_config()
 
     def dict_compare(self, d1, d2):
         d1_keys = set(d1.keys())
@@ -175,10 +176,14 @@ class PolicyFile(TestCase):
         return len(added) == 0 and len(removed) == 0 and len(modified) == 0
 
     def test_policy1_test_zeke_ok(self):
+        unames = []
+        self.assertTrue(
+            PolicyFile.policy.lookup_user('zeke', '192.168.100.5', 'photoserver', '192.168.100.5:33333',
unames)
+        )
         upolicy = {}
-        self.assertTrue( 
-            PolicyFile.policy.policy_lookup('192.168.100.5:33333', 'zeke', '192.168.100.5',
'photoserver', upolicy) )
-        self.assertTrue(upolicy['policyVersion']             == 1)
+        self.assertTrue(
+            PolicyFile.policy.lookup_settings('photoserver', unames[0], upolicy)
+        )
         self.assertTrue(upolicy['maxFrameSize']            == 444444)
         self.assertTrue(upolicy['maxMessageSize']          == 444444)
         self.assertTrue(upolicy['maxSessionWindow']        == 444444)
@@ -193,33 +198,37 @@ class PolicyFile(TestCase):
         self.assertTrue('private' in upolicy['sources'])
 
     def test_policy1_test_zeke_bad_IP(self):
-        upolicy = {}
+        unames = []
         self.assertFalse(
-            PolicyFile.policy.policy_lookup('192.168.100.5:33333', 'zeke', '10.18.0.1', 
  'photoserver', upolicy) )
+            PolicyFile.policy.lookup_user('zeke', '10.18.0.1',    'photoserver', "connid",
unames) )
         self.assertFalse(
-            PolicyFile.policy.policy_lookup('192.168.100.5:33333', 'zeke', '72.135.2.9',
  'photoserver', upolicy) )
+            PolicyFile.policy.lookup_user('zeke', '72.135.2.9',   'photoserver', "connid",
unames) )
         self.assertFalse(
-            PolicyFile.policy.policy_lookup('192.168.100.5:33333', 'zeke', '127.0.0.1', 
  'photoserver', upolicy) )
+            PolicyFile.policy.lookup_user('zeke', '127.0.0.1',    'photoserver', "connid",
unames) )
 
     def test_policy1_test_zeke_bad_app(self):
-        upolicy = {}
+        unames = []
         self.assertFalse(
-            PolicyFile.policy.policy_lookup('192.168.100.5:33333', 'zeke', '192.168.100.5','galleria',
upolicy) )
+            PolicyFile.policy.lookup_user('zeke', '192.168.100.5','galleria', "connid", unames)
)
 
     def test_policy1_test_users_same_permissions(self):
-        zpolicy = {}
+        znames = []
         self.assertTrue(
-            PolicyFile.policy.policy_lookup('192.168.100.5:33333', 'zeke', '192.168.100.5',
'photoserver', zpolicy) )
-        ypolicy = {}
+            PolicyFile.policy.lookup_user('zeke', '192.168.100.5', 'photoserver', '192.168.100.5:33333',
znames) )
+        ynames = []
         self.assertTrue(
-            PolicyFile.policy.policy_lookup('192.168.100.5:33334', 'ynot', '10.48.255.254',
'photoserver', ypolicy) )
-        self.assertTrue( self.dict_compare(zpolicy, ypolicy) )
+            PolicyFile.policy.lookup_user('ynot', '10.48.255.254', 'photoserver', '192.168.100.5:33334',
ynames) )
+        self.assertTrue( znames[0] == ynames[0] )
 
     def test_policy1_superuser_aggregation(self):
+        unames = []
+        self.assertTrue(
+            PolicyFile.policy.lookup_user('ellen', '72.135.2.9', 'photoserver', '75.135.2.9:33333',
unames)
+        )
         upolicy = {}
-        self.assertTrue( 
-            PolicyFile.policy.policy_lookup('192.168.100.5:33335', 'ellen', '72.135.2.9',
'photoserver', upolicy) )
-        self.assertTrue(upolicy['policyVersion']             == 1)
+        self.assertTrue(
+            PolicyFile.policy.lookup_settings('photoserver', unames[0], upolicy)
+        )
         self.assertTrue(upolicy['maxFrameSize']            == 666666)
         self.assertTrue(upolicy['maxMessageSize']          == 666666)
         self.assertTrue(upolicy['maxSessionWindow']        == 666666)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message