source: TI12-security/trunk/python/Tests/GatekeeperClientTest.py @ 971

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/Tests/GatekeeperClientTest.py@971
Revision 971, 2.2 KB checked in by pjkersha, 13 years ago (diff)

Renamed test methods - 'rapid' role doesn't apply to names as an AttCert? containing multiple
roles is passed in.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3"""Test harness for NDG Gatekeeper WS Client
4
5NERC Data Grid Project
6
7P J Kershaw 19/05/06
8
9
10Copyright (C) 2006 CCLRC & NERC
11
12This software may be distributed under the terms of the Q Public License,
13version 1.0 or later.
14"""
15import unittest
16import os
17import sys
18import glob
19
20from NDG.GatekeeperClient import *
21from NDG.AttCert import *
22       
23       
24class GatekeeperClientTestCase(unittest.TestCase):
25   
26    def setUp(self):
27        try:
28            self.gkClnt = GatekeeperClient(wsdl='../www/html/gatekeeper.wsdl')#,
29                                           #traceFile=sys.stderr)
30           
31            self.attCertFilePath = glob.glob('ac-*.xml')[0] 
32            self.sAttCert = open(self.attCertFilePath).read().strip()
33            self.attCert = AttCertParse(self.sAttCert)
34
35        except Exception, e:
36            self.fail(str(e))
37           
38           
39    def tearDown(self):
40        pass
41
42
43    def testReadAccess(self):
44       
45        try:
46            print "Role for read access: '%s'" % \
47                self.gkClnt.readAccess(attCertFilePath=self.attCertFilePath)
48           
49        except Exception, e:
50            self.fail(str(e))
51
52
53    def testWriteAccess(self):
54       
55        try:
56            print "Role for write access: '%s'" % \
57                self.gkClnt.writeAccess(self.sAttCert)
58           
59        except Exception, e:
60            self.fail(str(e))
61
62
63    def testExecuteAccess(self):
64       
65        try:
66            print "Role for execute access: '%s'" % \
67                self.gkClnt.executeAccess(self.attCert)
68           
69        except Exception, e:
70            self.fail(str(e))
71
72           
73#_____________________________________________________________________________       
74class GatekeeperClientTestSuite(unittest.TestSuite):
75   
76    def __init__(self):
77        logTestMap = map(GatekeeperClientTestCase,
78                  (
79                    "testReadAccessForRapid",
80                    "testWriteAccessForRapid",
81                    "testExecuteAccessForRapid"
82                  ))
83        unittest.TestSuite.__init__(self, logTestMap)
84           
85                                                   
86if __name__ == "__main__":
87    unittest.main()       
Note: See TracBrowser for help on using the repository browser.