[web/auth] stop playing games with locals()
We only want to know if any retriever found something.
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.fromlogilab.common.testlibimportunittest_main,TestCasefromos.pathimportjoinfromcubicwebimportCW_SOFTWARE_ROOTasBASEfromcubicweb.appobjectimportAppObjectfromcubicweb.cwvregimportCWRegistryStore,UnknownPropertyfromcubicweb.devtoolsimportTestServerConfigurationfromcubicweb.devtools.testlibimportCubicWebTCfromcubicweb.viewimportEntityAdapterfromcubes.card.entitiesimportCardclassYesSchema:def__contains__(self,something):returnTrueWEBVIEWSDIR=join(BASE,'web','views')classVRegistryTC(TestCase):defsetUp(self):config=TestServerConfiguration('data')self.vreg=CWRegistryStore(config)config.bootstrap_cubes()self.vreg.schema=config.load_schema()deftest_load_interface_based_vojects(self):self.vreg.init_registration([WEBVIEWSDIR])self.vreg.load_file(join(BASE,'entities','__init__.py'),'cubicweb.entities.__init__')self.vreg.load_file(join(WEBVIEWSDIR,'idownloadable.py'),'cubicweb.web.views.idownloadable')self.vreg.load_file(join(WEBVIEWSDIR,'primary.py'),'cubicweb.web.views.primary')self.assertEqual(len(self.vreg['views']['primary']),2)self.vreg.initialization_completed()self.assertEqual(len(self.vreg['views']['primary']),1)deftest_load_subinterface_based_appobjects(self):self.vreg.register_objects([join(BASE,'web','views','idownloadable.py')])# check downloadlink was kickedself.assertFalse(self.vreg['views'].get('downloadlink'))# we've to emulate register_objects to add custom MyCard objectspath=[join(BASE,'entities','__init__.py'),join(BASE,'entities','adapters.py'),join(BASE,'web','views','idownloadable.py')]filemods=self.vreg.init_registration(path,None)forfilepath,modnameinfilemods:self.vreg.load_file(filepath,modname)classCardIDownloadableAdapter(EntityAdapter):__regid__='IDownloadable'self.vreg._loadedmods[__name__]={}self.vreg.register(CardIDownloadableAdapter)self.vreg.initialization_completed()# check progressbar isn't kickedself.assertEqual(len(self.vreg['views']['downloadlink']),1)deftest_properties(self):self.vreg.reset()self.assertNotIn('system.version.cubicweb',self.vreg['propertydefs'])self.assertTrue(self.vreg.property_info('system.version.cubicweb'))self.assertRaises(UnknownProperty,self.vreg.property_info,'a.non.existent.key')classCWVregTC(CubicWebTC):deftest_property_default_overriding(self):# see data/views.pyfromcubicweb.web.views.xmlrssimportRSSIconBoxself.assertEqual(self.vreg.property_info(RSSIconBox._cwpropkey('visible'))['default'],True)if__name__=='__main__':unittest_main()