source: ndgCommon/trunk/ndg/common/unittests/models/teststubb.py @ 4944

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/ndgCommon/trunk/ndg/common/unittests/models/teststubb.py@4944
Revision 4944, 1.0 KB checked in by cbyrom, 11 years ago (diff)

Update tests for the models package - removing tests for redundant
code + adding new tests where needed + improve old tests to better
set up and remove the required test environment + remove dependencies
on xmlHandler2.

Line 
1import unittest
2from ndg.common.src.models.stubB import *
3from ndg.common.src.models.ndgObject import *
4from ndg.common.src.dal.ndgRetrieve import ndgRetrieve
5from xml.etree import ElementTree as ET
6from ndg.common.src.models.myconfig import myConfig
7import ndg.common.unittests.testconstants as tc
8   
9class TestCase(unittest.TestCase):
10
11        def OFFtestDE(self):
12            # NB, this requires a valid NDGB1 file to be available
13            ''' Test rendering a DataEntity stubB '''
14            doc='badc.nerc.ac.uk__NDG-B1__dataent_EASOE'#dataent_COAPEC'
15            xml=self.getit(doc)     
16            self.doit(xml.tree)
17           
18        def getit(self,doc):
19            self.c=myConfig(tc.NDG_CONFIG_FILE)
20            uri=ndgObject(doc)
21            status,xml=ndgRetrieve(uri,self.c, discovery=0)
22            self.assertEqual(status,1)
23            xml = ET.fromstring(xml)
24            return xml
25     
26        def doit(self,xml):
27            x=stubB(xml,self.c)
28           
29     
30if __name__=="__main__":
31    unittest.main()
32           
33           
Note: See TracBrowser for help on using the repository browser.