Ignore:
Timestamp:
15/12/08 14:23:40 (12 years ago)
Author:
cbyrom
Message:

Improve test suite, allowing referenced artefacts to be properly set
up and removed before and after tests + set global logging + adjust
file references + add required data files + simplify and fix some tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgutilstests/test_ndgRetrieve.py

    r4488 r4641  
    1818import unittest, os, logging, ConfigParser 
    1919import testconstants as tc 
     20import ndgUtils.lib.existdbclient as dbc 
    2021 
    2122logging.basicConfig(level=logging.DEBUG, 
     
    8081    def testRetrieveAtom(self): 
    8182        '''Get an atom document ''' 
     83        self.createdAtom = tc.createAtomInEXist(tc.xmlString) 
     84        self.dbc = dbc.eXistDBClient(configFile = tc.DBCONFIG_FILE, setUpDB = True) 
     85        self.createdAtom = tc.createAtomInEXist(tc.xmlString) 
    8286        doc= tc.VALID_PROVIDER_ID + "__" + no.ATOM_DOC_TYPE + \ 
    83             "__" + tc.VALID_ATOM_DOC_ID 
     87            "__" + self.createdAtom.datasetID 
    8488        uri=no(doc) 
    8589        status,xml=ndgRetrieve(uri,self.c, discovery=0) 
    8690        self.assertEqual(status,1) 
    87         self.assertNotEqual(xml.find(tc.VALID_ATOM_DOC_ID), -1) 
     91        self.assertNotEqual(xml.find(self.createdAtom.datasetID), -1) 
     92        atomPath = self.createdAtom.getDefaultCollectionPath() + self.createdAtom.atomName 
     93        self.dbc.deleteEXistFile(atomPath) 
    8894         
    8995    def testRetrieveInvalidAtom(self): 
     
    97103    def testRetrieveAtomBackup(self): 
    98104        '''Get a backed up atom document ''' 
     105        self.createdAtom = tc.createAtomInEXist(tc.xmlString) 
     106        self.dbc = dbc.eXistDBClient(configFile = tc.DBCONFIG_FILE, setUpDB = True) 
     107        self.createdAtom = tc.createAtomInEXist(tc.xmlString) 
    99108        doc= tc.VALID_PROVIDER_ID + "__" + no.ATOM_BACKUP_DOC_TYPE + \ 
    100             "__" + tc.VALID_ATOM_DOC_ID 
     109            "__" + self.createdAtom.datasetID 
    101110        uri=no(doc) 
    102111        status,xml=ndgRetrieve(uri,self.c, discovery=0) 
    103112        self.assertEqual(status,1) 
    104         self.assertNotEqual(xml.find(tc.VALID_ATOM_DOC_ID), -1) 
     113        self.assertNotEqual(xml.find(self.createdAtom.datasetID), -1) 
     114        atomPath = self.createdAtom.getDefaultCollectionPath() + self.createdAtom.atomName 
     115        self.dbc.deleteEXistFile(atomPath) 
    105116         
    106117if __name__=="__main__": 
Note: See TracChangeset for help on using the changeset viewer.