Changeset 5130 for ndgCommon


Ignore:
Timestamp:
23/03/09 11:54:09 (10 years ago)
Author:
cbyrom
Message:

Update feed client test to properly clean up artifacts after tests +
remove some unecessary code.

File:
1 edited

Legend:

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

    r5097 r5130  
    1717class testFeedClient(unittest.TestCase): 
    1818     
    19     VALID_COLLECTION_PATH = dc.ATOM_COLLECTION_PATH 
     19    VALID_COLLECTION_PATH = dc.SCHEMAS_COLLECTION_PATH 
    2020    VALID_FILE = "tst.xml" 
    2121    VALID_FILE_PATH = VALID_COLLECTION_PATH + VALID_FILE 
     
    2727        set up data used in the tests. 
    2828        ''' 
    29         self.createdAtoms = []    # array to store paths to atoms created - in order to then delete them 
     29        self.createdFeeds = []    # array to store paths to atoms created - in order to then delete them 
    3030        self.confFile = tc.EXIST_DBCONFIG_FILE 
    3131        self.utils = tu(self.confFile) 
     
    4141            self.feedClient.createAtomFeed(self.VALID_COLLECTION_PATH,  
    4242                                          self.feedClient.TOPLEVEL_ATOM_FEED_TITLE) 
     43            self.createdFeeds.append(self.VALID_COLLECTION_PATH) 
    4344        except: 
    4445            self.fail("Should not have thrown an exception") 
     
    4748    def testCreateGenericFeedEntry(self): 
    4849        try: 
     50            self.feedClient.createAtomFeed(self.VALID_COLLECTION_PATH,  
     51                                          self.feedClient.TOPLEVEL_ATOM_FEED_TITLE) 
     52            self.createdFeeds.append(self.VALID_COLLECTION_PATH) 
    4953            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
    5054            self.assertTrue(feed.feed.has_key('links')) 
     
    7377    def testGetAtomFeed(self): 
    7478        try: 
     79            self.feedClient.createAtomFeed(self.VALID_COLLECTION_PATH,  
     80                                          self.feedClient.TOPLEVEL_ATOM_FEED_TITLE) 
     81            self.createdFeeds.append(self.VALID_COLLECTION_PATH) 
    7582            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH, 
    76                                                proxyServer = self.proxyServer) 
     83                                                    proxyServer = self.proxyServer) 
    7784            self.assertTrue(feed.feed.has_key('links')) 
    7885        except Exception, e: 
     
    9198    def testCreateAtomFeedEntry(self): 
    9299        try: 
    93             self.tidyUp = True 
     100            self.feedClient.createAtomFeed(self.VALID_COLLECTION_PATH,  
     101                                          self.feedClient.TOPLEVEL_ATOM_FEED_TITLE) 
     102            self.createdFeeds.append(self.VALID_COLLECTION_PATH) 
    94103            atom = self.utils.createAtom(tc.xmlString) 
    95104            self.feedClient.createAtomFeedEntry(self.VALID_COLLECTION_PATH, 
     
    101110    def testCreateAtomFeedEntryWithIsDIFRecordKeyword(self): 
    102111        try: 
    103             self.tidyUp = True 
     112            self.feedClient.createAtomFeed(self.VALID_COLLECTION_PATH,  
     113                                          self.feedClient.TOPLEVEL_ATOM_FEED_TITLE) 
     114            self.createdFeeds.append(self.VALID_COLLECTION_PATH) 
    104115            atom = self.utils.createAtom(tc.xmlString) 
    105116            self.feedClient.createAtomFeedEntry(self.VALID_COLLECTION_PATH, 
     
    111122    def testCreateAtomFeedEntryCheckFeedSize(self): 
    112123        try: 
     124            self.feedClient.createAtomFeed(self.VALID_COLLECTION_PATH,  
     125                                          self.feedClient.TOPLEVEL_ATOM_FEED_TITLE) 
     126            self.createdFeeds.append(self.VALID_COLLECTION_PATH) 
    113127            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
    114128            self.assertTrue(feed.feed.has_key('links')) 
     
    143157 
    144158    def tearDown(self): 
    145         for path  in self.createdAtoms: 
     159        for path in self.createdFeeds: 
    146160            # delete the test file, in case it has been used in a test 
    147             self.utils.deleteDoc(path) 
     161            self.utils.deleteDoc(path + '/.feed.atom') 
     162            self.utils.ac.client.removeCollection(path + '/.feed.entry') 
    148163 
    149164if __name__ == '__main__': 
Note: See TracChangeset for help on using the changeset viewer.