Changeset 2610 in products
- Timestamp:
- Jul 5, 2010 8:53:43 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.gauth/trunk/quintagroup/gauth/tests.py
r2609 r2610 4 4 #from zope.testing import doctestunit 5 5 #from zope.component import testing 6 from zope.component import queryUtility 7 from zope.component import getSiteManager 6 from zope.component import queryUtility, queryAdapter 7 from zope.component import getSiteManager, getGlobalSiteManager 8 8 from Testing import ZopeTestCase as ztc 9 9 … … 18 18 import quintagroup.gauth 19 19 from quintagroup.gauth.interfaces import IGAuthUtility 20 from quintagroup.gauth.browser.configlet import IGAuthConfigletSchema 20 21 21 22 class GauthLayer(PloneSite): … … 69 70 def testUtility(self): 70 71 lsm = getSiteManager(self.portal) 71 gauth = lsm.queryUtility(IGAuthUtility) 72 self.assert_(gauth is not None) 73 self.assert_(gauth.gconf is not None) 72 gsm = getGlobalSiteManager() 73 lgauth = lsm.queryUtility(IGAuthUtility) 74 ggauth = gsm.queryUtility(IGAuthUtility) 75 self.assertEqual(ggauth, None) 76 self.assertNotEqual(lgauth, None) 77 74 78 75 79 class TestConfiglet(FunctionalTestCase): … … 100 104 101 105 106 class TestUtility(FunctionalTestCase): 107 108 def afterSetUp(self): 109 self.loginAsPortalOwner() 110 self.addProduct("quintagroup.gauth") 111 sm = getSiteManager(self.portal) 112 self.gauthutil = sm.queryUtility(IGAuthUtility) 113 self.gauthconfiglet = queryAdapter(self.portal, IGAuthConfigletSchema) 114 115 def testEmail(self): 116 self.assertEqual(bool(self.gauthutil.email), False) 117 self.gauthconfiglet.gauth_email = "tester@test.com" 118 self.assertEqual(self.gauthutil.email, "tester@test.com") 119 120 def testPassword(self): 121 self.assertEqual(bool(self.gauthutil.password), False) 122 self.gauthconfiglet.gauth_pass = u"secret" 123 self.assertEqual(self.gauthutil.password, "secret") 124 125 102 126 def test_suite(): 103 127 from unittest import TestSuite, makeSuite … … 105 129 suite.addTest(makeSuite(TestInstall)) 106 130 suite.addTest(makeSuite(TestConfiglet)) 131 suite.addTest(makeSuite(TestUtility)) 107 132 return suite 108 133
Note: See TracChangeset
for help on using the changeset viewer.