Package ndg :: Package xacml :: Package test :: Package context :: Module test_context
[hide private]

Source Code for Module ndg.xacml.test.context.test_context

 1  #!/usr/bin/env python 
 2  """NDG XACML Context unit tests  
 3   
 4  NERC DataGrid 
 5  """ 
 6  __author__ = "P J Kershaw" 
 7  __date__ = "26/03/10" 
 8  __copyright__ = "(C) 2010 Science and Technology Facilities Council" 
 9  __contact__ = "Philip.Kershaw@stfc.ac.uk" 
10  __license__ = "BSD - see LICENSE file in top-level directory" 
11  __contact__ = "Philip.Kershaw@stfc.ac.uk" 
12  __revision__ = "$Id: test_context.py 7955 2011-12-21 18:29:45Z rwilkinson $" 
13  import unittest 
14  import logging 
15  logging.basicConfig(level=logging.DEBUG) 
16   
17  from ndg.xacml.core.context.pdpinterface import PDPInterface 
18  from ndg.xacml.core.context.pdp import PDP 
19  from ndg.xacml.core.context.handler import CtxHandlerInterface 
20  from ndg.xacml.core.context.response import Response 
21  from ndg.xacml.core.context.result import Result, Decision 
22  from ndg.xacml.test.context import XacmlContextBaseTestCase, TestContextHandler   
23   
24   
25 -class XacmlContextTestCase(XacmlContextBaseTestCase):
26 """Test PDP, PAP, PIP and Context handler""" 27
28 - def test01CreateRequest(self):
29 requestCtx = self._createRequestCtx("http://localhost") 30 self.assert_(requestCtx)
31
32 - def test02CreateResponse(self):
38
40 self.assertRaises(TypeError, CtxHandlerInterface, 41 "Context handler is an abstract base class")
42
43 - def test04CreateCtxHandler(self):
45
46 - def test05PDPInterface(self):
47 self.assertRaises(TypeError, PDPInterface)
48
49 - def test06CreatePDP(self):
50 pdp = PDP() 51 self.assert_(pdp)
52
54 pdp = self._createPDPfromNdgTest1Policy() 55 self.assert_(pdp)
56 57 58 if __name__ == "__main__": 59 unittest.main() 60