Changeset 4797 for exist


Ignore:
Timestamp:
13/01/09 09:53:07 (10 years ago)
Author:
cbyrom
Message:

Fix eXistdbclient tests - to use latest test data and to properly clean
up after itself.

File:
1 edited

Legend:

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

    r4788 r4797  
    88import ndgUtils.lib.existdbclient as dbc 
    99from ndgUtils.eXistConnector import eXistConnector as ec 
    10 import unittests.testdata as data 
    1110from ndgUtils.ndgXqueries import ndgXqueries 
    1211from ndgUtils.models.Atom import Atom 
     
    3433    def testCreateOrUpdateEXistFile(self): 
    3534        try: 
    36             self.utils.dbc.createOrUpdateEXistFile(data.testdata.xmlString, \ 
     35            self.utils.dbc.createOrUpdateEXistFile(tc.xmlString, \ 
    3736                                             self.VALID_COLLECTION_PATH, \ 
    3837                                             self.VALID_FILE) 
    3938            self.createdAtoms.append(self.VALID_FILE_PATH) 
    40             self.utils.dbc.createOrUpdateEXistFile(data.testdata.xmlString, \ 
     39            self.utils.dbc.createOrUpdateEXistFile(tc.xmlString, \ 
    4140                                             self.VALID_COLLECTION_PATH, \ 
    4241                                             self.VALID_FILE) 
     
    6059        atom = self.utils.createAtomInEXist(tc.xmlString) 
    6160        self.createdAtoms.append(atom.getFullPath()) 
    62         atomPath = atom.getDefaultCollectionPath() + atom.atomName 
     61        atomPath = atom.getFullPath() 
    6362        self.assertEqual([], self.utils.dbc.checkAtomSchemaCompliance(atomPath)) 
    6463         
     
    8180    def testValidCheckAtomSchemaComplianceWithKeyword(self): 
    8281        atom = self.utils.createAtom(tc.xmlString) 
    83         self.createdAtoms.append(atom.getFullPath()) 
    8482        self.assertEqual([], self.utils.dbc.checkAtomSchemaCompliance('', atom = atom)) 
    8583 
     
    166164 
    167165    def testLookupEXistFileFind(self): 
    168         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     166        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    169167        self.assertNotEquals(self.utils.dbc._eXistDBClient__lookupEXistFile(self.VALID_FILE_PATH), None) 
    170168         
     
    174172    def testIsNewEXistFileBeforeAndAfterCreateFile(self): 
    175173        self.assertEquals(self.utils.dbc.isNewEXistFile(self.VALID_FILE_PATH), True) 
    176         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     174        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    177175        self.createdAtoms.append(self.VALID_FILE_PATH) 
    178176        self.assertEquals(self.utils.dbc.isNewEXistFile(self.VALID_FILE_PATH), False) 
    179177             
    180178    def testCreateEXistFile(self): 
    181         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     179        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    182180        self.createdAtoms.append(self.VALID_FILE_PATH) 
    183181         
    184182    def testCreateEXistFileDuplicate(self): 
    185         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     183        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    186184        self.createdAtoms.append(self.VALID_FILE_PATH) 
    187185        # NB, this just overwrites the file - so is valid here 
    188         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     186        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    189187         
    190188    def testDeleteEXistFile(self): 
    191         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     189        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    192190        self.assertEquals(self.utils.dbc.deleteEXistFile(self.VALID_FILE_PATH), True) 
    193191     
     
    196194     
    197195    def testGetEXistFileSucceed(self): 
    198         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     196        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    199197        self.createdAtoms.append(self.VALID_FILE_PATH) 
    200198        self.assertNotEquals(self.utils.dbc.getEXistFile(self.VALID_FILE_PATH), None) 
    201199     
    202200    def testBackupEXistFile(self): 
    203         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     201        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    204202        self.createdAtoms.append(self.VALID_FILE_PATH) 
    205203        backupFile = self.utils.dbc.backupEXistFile(self.VALID_COLLECTION_PATH, self.VALID_FILE) 
     
    213211             
    214212    def testGetAtomFileCollectionPath(self): 
    215         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    216         self.createdAtoms.append(self.VALID_FILE_PATH) 
    217         self.utils.dbc.getAtomFileCollectionPath(data.testdata.id) 
     213        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     214        self.createdAtoms.append(self.VALID_FILE_PATH) 
     215        self.utils.dbc.getAtomFileCollectionPath(tc.id) 
    218216             
    219217    def testGetAtomFileCollectionPath(self): 
     
    221219             
    222220    def testGetAllAtomIDs(self): 
    223         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     221        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    224222        self.createdAtoms.append(self.VALID_FILE_PATH) 
    225223        ids = self.utils.dbc.getAllAtomIDs() 
     
    228226             
    229227    def testGetAllAtomCollections(self): 
    230         self.assertEquals(self.utils.dbc.createEXistFile(data.testdata.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
     228        self.assertEquals(self.utils.dbc.createEXistFile(tc.xmlString, self.VALID_COLLECTION_PATH, self.VALID_FILE), True) 
    231229        self.createdAtoms.append(self.VALID_FILE_PATH) 
    232230        ids = self.utils.dbc.getAllAtomCollections() 
     
    247245    def testRestoreBackup(self): 
    248246        atom = self.utils.createAtomInEXist(tc.xmlString) 
    249         self.createdAtoms.append(self.VALID_FILE_PATH) 
     247        self.createdAtoms.append(atom.getFullPath()) 
    250248        atom = self.utils.createAtomInEXist(tc.xmlString) 
    251249        backupPath = self.utils.dbc.backupName 
Note: See TracChangeset for help on using the changeset viewer.