source: TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/paster_templates/test_paster_templates.py @ 7756

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/paster_templates/test_paster_templates.py@7756
Revision 7756, 1.5 KB checked in by pjkersha, 10 years ago (diff)

Incomplete - task 16: NDG Security 2.x.x - incl. updated Paster templates

Line 
1'''
2Created on 18 Nov 2010
3
4@author: pjkersha
5'''
6import unittest
7from os import path, listdir
8import shutil
9from paste.script.create_distro import CreateDistroCommand
10
11from ndg.security.server.paster_templates.template import \
12    AuthorisationServiceTemplate
13   
14
15class AuthorisationServiceTemplateTestCase(unittest.TestCase):
16    HERE_DIR = path.dirname(path.abspath(__file__))
17    TMPL_CONFIG_FILEPATH = path.join(HERE_DIR, 'template.cfg')
18    AUTHORISATION_SERVICE_TMPL_NAME = 'ndgsecurity_authorisation_service'
19    AUTHORISATION_SERVICE_CONF_DIR = 'authorisation-service'
20    AUTHORISATION_SERVICE_CONF_DIRPATH = path.join(HERE_DIR, 
21                                                AUTHORISATION_SERVICE_CONF_DIR)
22    AUTHORISATION_SERVICE_CONF_DIR_FILES = (
23        'pki', 'pip-mapping.txt', 'authorisation-service.ini', 'policy.xml'
24    )
25   
26    def test01Run(self):
27        cmd = CreateDistroCommand(None)
28        cmd.default_interactive = False
29        cmd.run([self.__class__.AUTHORISATION_SERVICE_CONF_DIR, 
30                 '-t', 
31                 self.__class__.AUTHORISATION_SERVICE_TMPL_NAME])
32       
33        createdFiles = listdir(
34                            self.__class__.AUTHORISATION_SERVICE_CONF_DIRPATH)
35       
36        for _file in self.__class__.AUTHORISATION_SERVICE_CONF_DIR_FILES:
37            self.assert_(_file in createdFiles, "Missing file %r" % _file)
38
39    def tearDown(self):
40        shutil.rmtree(self.__class__.AUTHORISATION_SERVICE_CONF_DIRPATH, True)
41
42if __name__ == "__main__":
43    unittest.main()
Note: See TracBrowser for help on using the repository browser.