def test_adapter_reinitialize(self): global testAdapter @config.adapter(IContext) @config.adapter(IContext2) @interface.implementer(IAdapter) def testAdapter(context): # pragma: no cover pass self._init_ptah() # reinstall config.cleanup_system() sm = config.registry sm.__init__('base') self._init_ptah(newReg=config.registry) adapters = sm.adapters.lookupAll((IContext,), IAdapter) self.assertTrue(len(adapters) == 1) self.assertTrue(adapters[0][1] is testAdapter) adapters = sm.adapters.lookupAll((IContext2,), IAdapter) self.assertTrue(len(adapters) == 1) self.assertTrue(adapters[0][1] is testAdapter)
def tearDown(self): config.cleanup_system() sm = self.p_config sm.__init__('base') testing.tearDown() Session = sqlahelper.get_session() Session.expunge_all()
def tearDown(self): config.cleanup_system(self.__class__.__module__) global TestClass, testAdapter, testHandler try: del TestClass except: pass try: del testAdapter except: pass try: del testHandler except: pass
def test_renderer_tmpl_with_layout(self): class Layout(view.Layout): def render(self, content): return '<html>%s</html>'%content view.register_layout('test', klass=Layout) self._init_ptah() def viewFactory(context, request): return None, {} # renderer layout is different r = Renderer(view.template('templates/test.pt'), '') res = r(Context(), self.request, viewFactory) self.assertEqual(res.body.strip(), '<div>My snippet</div>') # layout is 'test' config.cleanup_system() r = Renderer(view.template('templates/test.pt'), 'test') res = r(Context(), self.request, viewFactory) self.assertEqual(''.join(res.body.split()), '<html><div>Mysnippet</div></html>')
def test_subscriber_reinitialize(self): global testSubscriber events = [] @config.subscriber(IContext) def testSubscriber(*args): events.append(args) self._init_ptah() # reinstall config.cleanup_system() sm = config.registry sm.__init__('base') self._init_ptah() sm = config.registry sm.subscribers((Context(IContext),), None) self.assertTrue(len(events) == 1)
def test_adapts_reinitialize(self): global TestClass class TestClass(object): config.adapter(IContext) interface.implements(IAdapter) self._init_ptah() # reinstall config.cleanup_system() sm = config.registry sm.__init__('base') adapters = sm.adapters.lookupAll((IContext,), IAdapter) self.assertTrue(len(adapters) == 0) self._init_ptah() sm = config.registry adapters = sm.adapters.lookupAll((IContext,), IAdapter) self.assertTrue(len(adapters) == 1) self.assertTrue(adapters[0][1] is TestClass)
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestAppSharingForm, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestPasswordChangerDecl, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestAuthentication, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestSecurityInit, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestExceptions, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__)
def tearDown(self): config.cleanup_system(self.__class__.__module__) self.stdout = self._stdout shutil.rmtree(self.dir)
def setUp(self): config.cleanup_system() BaseTesting.setUp(self) self.dir = tempfile.mkdtemp()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestContent, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestInstrospection, self).tearDown()
def tearDown(self): config.cleanup_system()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestManageModule, self).tearDown()
def tearDown(self): self.stdout = self._stdout shutil.rmtree(self.dir) config.cleanup_system()
def tearDown(self): config.cleanup_system() sm = self.p_config sm.__init__('base') testing.tearDown()
def tearDown(self): ptah.checkPermission = self.orig_checkPermission config.cleanup_system(self.__class__.__module__) super(RestBase, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestACLsProps, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestTypeInfo, self).tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestLibraryManagement, self).tearDown()
def tearDown(self): config.shutdown() config.cleanup_system(self.__class__.__module__) sm = self.p_config sm.__init__('base') testing.tearDown()
def tearDown(self): config.cleanup_system(self.__class__.__module__) super(TestApplicationFactoryCustom, self).tearDown()