Changeset 4652


Ignore:
Timestamp:
15/12/08 16:56:42 (11 years ago)
Author:
cbyrom
Message:

Fix problem with test - test currently fails so doesn't complete -
resulting in a test file being left in the DB - to later cause problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgutilstests/lib/testgranulite.py

    r4651 r4652  
    105105    def testUpdateDataEntity(self): 
    106106        # firstly create a DE to use 
    107         atom = Atom(VTD.DE_TERM) 
    108         atom.fromString(tc.xmlString) 
    109         atom.atomTypeID = VTD.DE_TERM 
    110         self.dbc = dbc.eXistDBClient(configFile = tc.DBCONFIG_FILE, setUpDB = True) 
    111         atom = self.dbc.createAtomInExist(atom) 
    112  
    113         # now set up the granulite 
    114         details = self._initGranule() 
    115         self.g.ingestGranuliteFiles = False # don't worry about reading in CSML/CDML data 
    116         self.g._granulite__applyCoreGranuliteDetails(details) 
    117          
    118         # and now update DE 
    119         self.g._granulite__updateDataEntity(atom.datasetID) 
    120         atomPath = atom.getDefaultCollectionPath() + atom.atomName 
    121         self.assertEqual([], self.dbc.checkAtomSchemaCompliance(atomPath)) 
    122  
    123         updatedAtom = Atom() 
    124         updatedAtom.fromString(self.dbc.getAtom(tc.datasetID)) 
    125         self.assertNotEqual(atom, updatedAtom) 
    126          
    127         # there should be one extra link on the new atom 
    128         self.assertEqual(len(atom.relatedLinks) + 1, len(updatedAtom.relatedLinks)) 
    129         self.dbc.deleteEXistFile(atomPath) 
    130         import pdb 
    131         pdb.set_trace() 
     107        try: 
     108            atom = Atom(VTD.DE_TERM) 
     109            atom.fromString(tc.xmlString) 
     110            atom.atomTypeID = VTD.DE_TERM 
     111            self.dbc = dbc.eXistDBClient(configFile = tc.DBCONFIG_FILE, setUpDB = True) 
     112            atom = self.dbc.createAtomInExist(atom) 
     113     
     114            # now set up the granulite 
     115            details = self._initGranule() 
     116            self.g.ingestGranuliteFiles = False # don't worry about reading in CSML/CDML data 
     117            self.g._granulite__applyCoreGranuliteDetails(details) 
     118             
     119            # and now update DE 
     120            self.g._granulite__updateDataEntity(atom.datasetID) 
     121            atomPath = atom.getDefaultCollectionPath() + atom.atomName 
     122            self.assertEqual([], self.dbc.checkAtomSchemaCompliance(atomPath)) 
     123     
     124            updatedAtom = Atom() 
     125            updatedAtom.fromString(self.dbc.getAtom(tc.datasetID)) 
     126            self.assertNotEqual(atom, updatedAtom) 
     127             
     128            # there should be one extra link on the new atom 
     129            self.assertEqual(len(atom.relatedLinks) + 1, len(updatedAtom.relatedLinks)) 
     130        except: 
     131            self.fail("An exception shouldn't have been thrown") 
     132        finally: 
     133            self.dbc.deleteEXistFile(atomPath) 
    132134 
    133135 
Note: See TracChangeset for help on using the changeset viewer.