Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    def tearDown(self):
        config.cleanup_system()
        sm = self.p_config
        sm.__init__('base')
        testing.tearDown()

        Session = sqlahelper.get_session()
        Session.expunge_all()
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    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>')
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestAppSharingForm, self).tearDown()
Ejemplo n.º 8
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestPasswordChangerDecl, self).tearDown()
Ejemplo n.º 9
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestAuthentication, self).tearDown()
Ejemplo n.º 10
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestSecurityInit, self).tearDown()
Ejemplo n.º 11
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestExceptions, self).tearDown()
Ejemplo n.º 12
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
Ejemplo n.º 13
0
    def tearDown(self):
        config.cleanup_system(self.__class__.__module__)

        self.stdout = self._stdout
        shutil.rmtree(self.dir)
Ejemplo n.º 14
0
 def setUp(self):
     config.cleanup_system()
     BaseTesting.setUp(self)
     self.dir = tempfile.mkdtemp()
Ejemplo n.º 15
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestContent, self).tearDown()
Ejemplo n.º 16
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestInstrospection, self).tearDown()
Ejemplo n.º 17
0
 def tearDown(self):
     config.cleanup_system()
Ejemplo n.º 18
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestManageModule, self).tearDown()
Ejemplo n.º 19
0
 def tearDown(self):
     self.stdout = self._stdout
     shutil.rmtree(self.dir)
     config.cleanup_system()
Ejemplo n.º 20
0
 def tearDown(self):
     config.cleanup_system()
     sm = self.p_config
     sm.__init__('base')
     testing.tearDown()
Ejemplo n.º 21
0
    def tearDown(self):
        ptah.checkPermission = self.orig_checkPermission

        config.cleanup_system(self.__class__.__module__)
        super(RestBase, self).tearDown()
Ejemplo n.º 22
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestACLsProps, self).tearDown()
Ejemplo n.º 23
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestTypeInfo, self).tearDown()
Ejemplo n.º 24
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestLibraryManagement, self).tearDown()
Ejemplo n.º 25
0
 def tearDown(self):
     config.shutdown()
     config.cleanup_system(self.__class__.__module__)
     sm = self.p_config
     sm.__init__('base')
     testing.tearDown()
Ejemplo n.º 26
0
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestApplicationFactoryCustom, self).tearDown()