Changeset 1934 in products


Ignore:
Timestamp:
Mar 17, 2010 8:19:16 PM (14 years ago)
Author:
mylan
Message:

#177: Updated tests for delete property for ICanonicalPath, ICanonicalLink

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.canonicalpath/trunk/quintagroup/canonicalpath/tests.py

    r1929 r1934  
    145145                continue 
    146146            else: 
    147                 raise self.failureException, "InvalidValue not raised when '%s' wrong value try to set" % wrong 
     147                raise self.failureException, "InvalidValue not raised when " \ 
     148                      "'%s' wrong value try to set" % wrong 
    148149         
    149150    def testValidationGood(self): 
     
    153154 
    154155 
     156    def testDeleteProperty(self): 
     157        hasprop = self.portal.hasProperty 
     158        cpadapter = queryAdapter(self.portal, ICanonicalPath) 
     159        cpadapter.canonical_path = '/new_portal_canonical' 
     160        assert hasprop(PROPERTY_PATH) 
     161 
     162        del cpadapter.canonical_path 
     163        self.assertFalse(hasprop(PROPERTY_PATH), 
     164            "Not deleted Canonical path customization property for the portal") 
     165 
     166 
     167    def testDelCustomization(self): 
     168        cpadapter = queryAdapter(self.portal, ICanonicalPath) 
     169        cpadapter.canonical_path = '/new_portal_canonical' 
     170        assert cpadapter.canonical_path == '/new_portal_canonical' 
     171 
     172        del cpadapter.canonical_path 
     173        self.assertTrue(cpadapter.canonical_path == self.portal_cp, 
     174            "After deleted Canonical path customization property not set to " 
     175            "default value for the portal") 
     176 
     177 
    155178class TestDefaultCanonicalLinkAdapter(TestCase): 
    156  
    157179 
    158180    def afterSetUp(self): 
     
    235257 
    236258 
     259    def testDeleteProperty(self): 
     260        hasprop = self.portal.hasProperty 
     261        cladapter = queryAdapter(self.portal, ICanonicalLink) 
     262        cladapter.canonical_link = '/new_portal_canonical' 
     263        assert hasprop(PROPERTY_LINK) 
     264 
     265        del cladapter.canonical_link 
     266        self.assertFalse(hasprop(PROPERTY_LINK), 
     267            "Not deleted Canonical link customization property for the portal") 
     268 
     269 
     270    def test_DelCustomization(self): 
     271        cladapter = queryAdapter(self.portal, ICanonicalLink) 
     272        cladapter.canonical_link = '/new_portal_canonical' 
     273        assert cladapter.canonical_link == '/new_portal_canonical' 
     274 
     275        del cladapter.canonical_link 
     276        self.assertTrue(cladapter.canonical_link == self.purl(), 
     277            "After deleted Canonical link customization property not set to " 
     278            "default value for the portal") 
     279 
     280 
    237281def test_suite(): 
    238282    return unittest.TestSuite([ 
Note: See TracChangeset for help on using the changeset viewer.