source: TI03-DataExtractor/branches/repackaging/server/lib/ndg/dx/server/test/__init__.py @ 1815

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI03-DataExtractor/branches/repackaging/server/lib/ndg/dx/server/test/__init__.py@1815
Revision 1815, 1022 bytes checked in by spascoe, 14 years ago (diff)

Move part 2 (svn complained about doinging it in 1 step).

Line 
1"""
2Unit tests for the data extractor server.
3
4@author: Stephen Pascoe
5"""
6
7import unittest, os, pkg_resources, tempfile, shutil
8from ndg.utils.config import config
9from nbg.dx.server.scripts import DXWSInterface
10
11class TestCase(unittest.TestCase):
12    def setUp(self):
13        # Add the test configuration file
14        configStream = pkg_resources.resource_stream('ndg.dx.server.test', 'server.conf')
15        config.readfp(configStream)
16
17        # Get the dxs configuration directory
18        dxsPath = pkg_resources.resource_filename('ndg.dx.server', 'dxs')
19
20        # Create a temporary basedir
21        self.tempdir = tempfile.mkdtemp()
22
23        # Copy dxs to tempdir to preserve state.
24        shutil.copytree(dxsPath, os.path.join(self.tempdir, 'dxs'))
25
26    def testStartSession(self):
27        print DXWSInterface.startSession('rob', 'rob1')
28
29    def tearDown(self):
30        shutil.rmtree(self.tempdir)
31
32
33test_suite = unittest.TestSuite()
34test_suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(TestCase))
Note: See TracBrowser for help on using the repository browser.