Changeset 5097 for ndgCommon/trunk


Ignore:
Timestamp:
11/03/09 17:42:51 (11 years ago)
Author:
cbyrom
Message:

Update and extend test suite.

Location:
ndgCommon/trunk/ndg/common/unittests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/unittests/clients/http/testgenerichttpclient.py

    r4990 r5097  
    3636    def testInvalidReadURL(self): 
    3737        self.assertRaises(IOError, self.client.readURL, tc.INVALID_URL) 
     38 
     39     
     40    def testReadURLWithInvalidPayload(self): 
     41        self.assertRaises(IOError, self.client.readURL, tc.VALID_URL, payload = "blah") 
     42     
     43    def testReadURLNullPayload(self, payload = ""): 
     44        page = self.client.readURL(tc.VALID_URL) 
     45        self.assertTrue(page.startswith('<html>')) 
  • ndgCommon/trunk/ndg/common/unittests/clients/xmldb/eXist/testfeedclient.py

    r5019 r5097  
    4444            self.fail("Should not have thrown an exception") 
    4545 
    46     def testCreateCorrectionsFeedEntry(self): 
     46 
     47    def testCreateGenericFeedEntry(self): 
    4748        try: 
    48             self.feedClient.createCorrectionsFeedEntry('some title info', 
    49                                                        'some body info') 
    50         except: 
     49            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
     50            self.assertTrue(feed.feed.has_key('links')) 
     51            entriesNo = len(feed.entries) 
     52            self.feedClient.createGenericFeedEntry('some title info', 
     53                                                   'some body info', 
     54                                                   self.VALID_COLLECTION_PATH) 
     55            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
     56            self.assertEquals(entriesNo + 1, len(feed.entries)) 
     57 
     58        except Exception, e: 
    5159            self.fail("Should not have thrown an exception") 
    5260 
     
    6573    def testGetAtomFeed(self): 
    6674        try: 
    67             feed = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH, 
     75            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH, 
    6876                                               proxyServer = self.proxyServer) 
    6977            self.assertTrue(feed.feed.has_key('links')) 
     
    7381    def testInvalidGetAtomFeed(self): 
    7482        try: 
    75             feed = self.feedClient.getAtomFeed(self.INVALID_PATH) 
     83            feed, xml = self.feedClient.getAtomFeed(self.INVALID_PATH) 
    7684            self.fail("Should have thrown an exception") 
    7785        except FeedClientError, fce: 
     
    103111    def testCreateAtomFeedEntryCheckFeedSize(self): 
    104112        try: 
    105             feed = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
     113            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
    106114            self.assertTrue(feed.feed.has_key('links')) 
    107115            entriesNo = len(feed.entries) 
     
    109117            self.feedClient.createAtomFeedEntry(self.VALID_COLLECTION_PATH, 
    110118                                                atom)  
    111             feed = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
     119            feed, xml = self.feedClient.getAtomFeed(self.VALID_COLLECTION_PATH) 
    112120            self.assertEquals(entriesNo + 1, len(feed.entries)) 
    113121        except Exception, e: 
  • ndgCommon/trunk/ndg/common/unittests/models/testcodetablerecord.py

    r5083 r5097  
    44@author C Byrom, Tessella Feb 2009 
    55''' 
    6 import unittest, datetime 
     6import unittest 
    77from xml.etree import cElementTree as ET 
    88from ndg.common.src.models.codetablerecord import CodeTableRecord 
  • ndgCommon/trunk/ndg/common/unittests/models/testcodetabletype.py

    r5083 r5097  
    44@author C Byrom, Tessella Feb 2009 
    55''' 
    6 import unittest, datetime 
     6import unittest 
    77from xml.etree import cElementTree as ET 
    88from ndg.common.src.models.codetabletype import CodeTableType 
  • ndgCommon/trunk/ndg/common/unittests/models/testmolesentity.py

    r4793 r5097  
    55Tessella 
    66''' 
    7 import unittest, datetime 
     7import unittest 
    88import ndg.common.src.models.MolesEntity as ME 
    99from ndg.common.src.models.Atom import Atom 
  • ndgCommon/trunk/ndg/common/unittests/models/testvocablist.py

    r5082 r5097  
    44@author C Byrom, Tessella Feb 2009 
    55''' 
    6 import unittest, datetime 
     6import unittest 
    77from xml.etree import cElementTree as ET 
    88from ndg.common.src.models.vocablist import VocabList 
  • ndgCommon/trunk/ndg/common/unittests/testconstants.py

    r5083 r5097  
    3939# - whilst the tests do clean up after themselves, it's probably best not to 
    4040# run tests using a production environment DB! 
    41 EXIST_DB = 'chinook.badc.rl.ac.uk' 
    42 #EXIST_DB = 'localhost' 
     41#EXIST_DB = 'bora.badc.rl.ac.uk' 
     42#EXIST_DB = 'chinook.badc.rl.ac.uk' 
     43EXIST_DB = 'localhost' 
    4344PG_DBCONFIG_FILE = TEST_DATA_DIR + 'pg.config' 
    4445EXIST_DBCONFIG_FILE = TEST_DATA_DIR + 'exist.config' 
Note: See TracChangeset for help on using the changeset viewer.