Ignore:
Timestamp:
19/01/09 16:52:53 (11 years ago)
Author:
cbyrom
Message:

Improve url check, by creating new method which sets the default
proxies to use with the lookup + adjust CSML creation to have the
dataset ID as a keyword - to allow this to be randomly generated if not
set.

Location:
ndgCommon/trunk/ndg/common/unittests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/unittests/clients/xmldb/eXist/testexistdbclient.py

    r4810 r4844  
    129129 
    130130    def testSetUpEXistDB(self): 
    131         molesSchema = self.VALID_COLLECTION_PATH + \ 
    132                 ndgXqueries.ATOM_MOLES_SCHEMA  + '.xsd' 
    133         self.utils.dbc.deleteEXistFile(molesSchema) 
    134         self.assertEquals(None, self.utils.dbc._eXistDBClient__lookupEXistFile(molesSchema)) 
     131        fileName = self.utils.dbc.xmldb.xq.xsd.keys()[0] + '.xsd' 
     132        pathName = ec.BASE_COLLECTION_PATH + fileName 
     133        self.utils.dbc.deleteEXistFile(pathName) 
     134        self.assertEquals(None, self.utils.dbc._eXistDBClient__lookupEXistFile(pathName)) 
    135135 
    136136        newClient = dbc.eXistDBClient(configFile = self.confFile, setUpDB = True) 
    137         self.assertNotEquals(None, newClient._eXistDBClient__lookupEXistFile(molesSchema)) 
     137        self.assertNotEquals(None, newClient._eXistDBClient__lookupEXistFile(pathName)) 
    138138 
    139139 
     
    242242        atom = self.utils.createAtomInEXist(tc.xmlString) 
    243243        atom = self.utils.createAtomInEXist(tc.xmlString) 
     244        time.sleep(5) 
    244245        backupPath = self.utils.dbc.backupName 
    245246        self.utils.dbc.deleteAtomInExist(atom) 
     
    259260        self.createdAtoms.append(atom.getFullPath()) 
    260261        self.utils.dbc.createDIFDocumentFromAtom(atom) 
     262 
     263    def testTransformAtomIntoDIF(self): 
     264        atom = self.utils.createAtom(tc.xmlString) 
     265        atom.atomTypeID = VTD.DE_TERM 
     266        atom = self.utils.dbc.createAtomInExist(atom) 
     267        self.createdAtoms.append(atom.getFullPath()) 
     268        doc = self.utils.dbc.transformAtomIntoDIF(atom) 
     269        self.assertNotEquals(None, doc) 
     270        self.assertTrue(doc.find('DIF') > -1) 
     271        self.assertTrue(doc.find(atom.datasetID) > -1) 
    261272         
    262273    def tearDown(self): 
  • ndgCommon/trunk/ndg/common/unittests/lib/testutilities.py

    r4793 r4844  
    1010class testUtilities(unittest.TestCase): 
    1111     
     12    VALID_URL = 'http://bbc.co.uk' 
     13    INVALID_URL = 'http://bbc.co.ukblah' 
     14     
    1215    def setUp(self): 
    1316        ''' 
    1417        set up data used in the tests. 
    1518        ''' 
     19 
     20    def testOpenURLWithProxy(self): 
     21        pageData = utilities.openURLWithProxy(self.VALID_URL) 
     22        self.assertNotEqual(None, pageData) 
     23 
     24    def testInvalidOpenURLWithProxy(self): 
     25        pageData = utilities.openURLWithProxy(self.INVALID_URL) 
     26        self.assertTrue(pageData.find('The requested URL could not be retrieved') > -1) 
     27 
     28    def testSimpleURLCheck(self): 
     29        self.assertEquals(1, utilities.simpleURLCheck(self.VALID_URL)) 
     30 
     31    def testInvalidSimpleURLCheck(self): 
     32        self.assertEquals(0, utilities.simpleURLCheck(self.INVALID_URL)) 
    1633 
    1734    def testGetISO8601Date(self): 
Note: See TracChangeset for help on using the changeset viewer.