Ignore:
Timestamp:
10/02/09 17:40:45 (11 years ago)
Author:
cbyrom
Message:

Extend test constants to improve available data for use in tests + add
new utility method to create old moles docs to use with old code tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/unittests/testutils.py

    r4793 r4937  
    1414 
    1515from ndg.common.src.models.vocabtermdata import VocabTermData as VTD 
    16 import ndg.common.src.clients.xmldb.eXist.existdbclient as dbc 
     16from ndg.common.src.clients.xmldb.eXist.atomclient import AtomClient as ac 
     17import ndg.common.src.clients.xmldb.eXist.dbconstants as dc 
    1718from ndg.common.src.models.Atom import Atom 
     19import ndg.common.unittests.testconstants as tc 
     20import os 
    1821 
    1922class testUtils(object): 
    2023    def __init__(self, confFile): 
    21         self.dbc = dbc.eXistDBClient(configFile = confFile, setUpDB = True) 
     24        self.host = tc.EXIST_DB 
     25        self.ac = ac(dbHostName = self.host, configFileName = confFile, setUpDB = True) 
    2226     
    2327    def createAtom(self, content): 
     
    2832    def createAtomInEXist(self, content): 
    2933        atom = self.createAtom(content) 
    30         return self.dbc.createAtomInExist(atom) 
     34        return self.ac.createAtom(atom) 
    3135     
    32     def deleteAtomInExist(self, path): 
    33         self.dbc.deleteEXistFile(path) 
     36    def deleteDoc(self, path): 
     37        self.ac.deleteDoc(path) 
     38         
     39    def createOldMolesDoc(self): 
     40        ''' 
     41        Create an old moles1.0 doc 
     42        ''' 
     43        # firstly, load a moles do to eXist 
     44        f = open(tc.MOLES_FILE_NAME, 'r') 
     45        xml = f.read() 
     46        f.close() 
     47        fileName = f.name.split(os.sep)[-1] 
     48        path = dc.MOLES_COLLECTION_PATH + tc.GRANULITE_PROVIDER_ID 
     49        self.ac.createDoc(xml, path, fileName) 
     50        return path 
Note: See TracChangeset for help on using the changeset viewer.