Changeset 2928 in products


Ignore:
Timestamp:
Oct 26, 2010 2:34:03 PM (13 years ago)
Author:
mylan
Message:

#233: Update tests for catching errors on keywords calculation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/tests/testUsageKeywords.py

    r2900 r2928  
    123123        self.assertTrue(self.seo.external_keywords_test) 
    124124        # 1. Information about problem must present in check view 
    125         self.assertTrue("Problem with page retrieval" in self.chckView()) 
     125        msg = self.chckView() 
     126        rematch = re.match( 
     127            ".*Problem with page retrieval.*error_log/showEntry\?id=", 
     128             msg, re.S) 
     129        self.assertTrue(rematch, "Return message has incomplete information " 
     130            "about problem with page retrieval: %s" % msg) 
    126131        # 2. Opened urllib file descriptor should not be closed because 
    127132        #    it even not returned to the view 
     
    138143                return self.orig_urlopen(*args, **kwargs) 
    139144        def patch_read(*args, **kwargs): 
    140             raise IOError() 
     145            raise Exception("General exception") 
    141146        # Patch urllib2.urlopen to emulate external url retrieval 
    142147        self.patchURLLib(fnc=patch_urlopen) 
     
    145150        self.seo._updateProperty("external_keywords_test", True) 
    146151        self.assertTrue(self.seo.external_keywords_test) 
    147         # 1. Information about problem must present in check view 
    148         self.assertTrue("Problem with page retrieval" in self.chckView()) 
     152        # 1. General exception must be raised. 
     153        self.assertRaises(Exception, self.chckView) 
    149154        # 2. Opened urllib file descriptor must be closed 
    150155        self.assertTrue(self.urlfd.closed, "Opened file descriptor was not closed.") 
Note: See TracChangeset for help on using the changeset viewer.