Changeset 1700 in products for quintagroup.canonicalpath
- Timestamp:
- Feb 10, 2010 7:42:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.canonicalpath/trunk/quintagroup/canonicalpath/tests.py
r1699 r1700 3 3 from zope.testing import doctestunit 4 4 from zope.component import testing 5 from zope.component import queryAdapter 5 6 from Testing import ZopeTestCase as ztc 6 7 7 8 from Products.Five import zcml 8 9 from Products.Five import fiveconfigure 10 from Products.CMFCore.utils import getToolByName 9 11 from Products.PloneTestCase import PloneTestCase as ptc 10 12 from Products.PloneTestCase.layer import PloneSite 11 ptc.setupPloneSite()12 13 13 import quintagroup.canonicalpath14 from quintagroup.canonicalpath.interfaces import ICanonicalPath 14 15 15 16 class TestCase(ptc.PloneTestCase): … … 17 18 @classmethod 18 19 def setUp(cls): 20 import quintagroup.canonicalpath 19 21 fiveconfigure.debug_mode = True 20 zcml.load_config('configure.zcml', 21 quintagroup.canonicalpath) 22 zcml.load_config('configure.zcml', quintagroup.canonicalpath) 22 23 fiveconfigure.debug_mode = False 23 24 24 @classmethod 25 def tearDown(cls): 26 pass 25 ptc.setupPloneSite() 27 26 27 class TestAdapter(TestCase): 28 29 def afterSetUp(self): 30 self.purl = getToolByName(self.portal, 'portal_url') 31 32 def testAdapter4Portal(self): 33 cpadapter = queryAdapter(self.portal, ICanonicalPath) 34 self.assertFalse(cpadapter is None, 35 "Can't get canonical path adapter for the plone site object") 36 37 38 portal_cp = '/'+'/'.join(self.purl.getRelativeContentPath(self.portal)) 39 adcp = cpadapter.canonical_path() 40 self.assertTrue(adcp == portal_cp, "Canonical path adapter return '%s' "\ 41 "for portal, must be: '%s'" % (adcp, portal_cp) ) 42 43 44 def testAdapter4AT(self): 45 self.loginAsPortalOwner() 46 self.portal.invokeFactory('Document', id='my_doc') 47 self.logout() 48 my_doc = self.portal['my_doc'] 49 50 cpadapter = queryAdapter(my_doc, ICanonicalPath) 51 self.assertFalse(cpadapter is None, 52 "Can't get canonical path adapter for the Document object") 53 54 mydoc_cp = '/'+'/'.join(self.purl.getRelativeContentPath(my_doc)) 55 adcp = cpadapter.canonical_path() 56 self.assertTrue(adcp == mydoc_cp, "Canonical path adapter return '%s' "\ 57 "for document, must be: '%s'" % (adcp, mydoc_cp) ) 28 58 29 59 def test_suite(): 30 60 return unittest.TestSuite([ 31 32 # Unit tests 33 #doctestunit.DocFileSuite( 34 # 'README.txt', package='quintagroup.canonicalpath', 35 # setUp=testing.setUp, tearDown=testing.tearDown), 36 37 #doctestunit.DocTestSuite( 38 # module='quintagroup.canonicalpath.mymodule', 39 # setUp=testing.setUp, tearDown=testing.tearDown), 40 41 42 # Integration tests that use PloneTestCase 43 #ztc.ZopeDocFileSuite( 44 # 'README.txt', package='quintagroup.canonicalpath', 45 # test_class=TestCase), 46 47 #ztc.FunctionalDocFileSuite( 48 # 'browser.txt', package='quintagroup.canonicalpath', 49 # test_class=TestCase), 50 61 unittest.makeSuite(TestAdapter), 51 62 ]) 52 63
Note: See TracChangeset
for help on using the changeset viewer.