コード例 #1
0
ファイル: test_directives.py プロジェクト: blaflamme/ptah
    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)
コード例 #2
0
ファイル: base.py プロジェクト: blaflamme/ptah
    def tearDown(self):
        config.cleanup_system()
        sm = self.p_config
        sm.__init__('base')
        testing.tearDown()

        Session = sqlahelper.get_session()
        Session.expunge_all()
コード例 #3
0
ファイル: test_directives.py プロジェクト: blaflamme/ptah
    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
コード例 #4
0
ファイル: test_renderers.py プロジェクト: mcdonc/ptah
    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>')
コード例 #5
0
ファイル: test_directives.py プロジェクト: blaflamme/ptah
    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)
コード例 #6
0
ファイル: test_directives.py プロジェクト: blaflamme/ptah
    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)
コード例 #7
0
ファイル: test_apps.py プロジェクト: WouterVH/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestAppSharingForm, self).tearDown()
コード例 #8
0
ファイル: test_password.py プロジェクト: mcdonc/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestPasswordChangerDecl, self).tearDown()
コード例 #9
0
ファイル: test_auth.py プロジェクト: WouterVH/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestAuthentication, self).tearDown()
コード例 #10
0
ファイル: test_srvinit.py プロジェクト: blaflamme/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestSecurityInit, self).tearDown()
コード例 #11
0
ファイル: test_exc.py プロジェクト: blaflamme/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestExceptions, self).tearDown()
コード例 #12
0
ファイル: test_command.py プロジェクト: blaflamme/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
コード例 #13
0
ファイル: test_commands.py プロジェクト: WouterVH/ptah
    def tearDown(self):
        config.cleanup_system(self.__class__.__module__)

        self.stdout = self._stdout
        shutil.rmtree(self.dir)
コード例 #14
0
ファイル: test_settings.py プロジェクト: blaflamme/ptah
 def setUp(self):
     config.cleanup_system()
     BaseTesting.setUp(self)
     self.dir = tempfile.mkdtemp()
コード例 #15
0
ファイル: test_content.py プロジェクト: WouterVH/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestContent, self).tearDown()
コード例 #16
0
ファイル: test_manage.py プロジェクト: blaflamme/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestInstrospection, self).tearDown()
コード例 #17
0
ファイル: test_tmpl.py プロジェクト: blaflamme/ptah
 def tearDown(self):
     config.cleanup_system()
コード例 #18
0
ファイル: test_manage.py プロジェクト: blaflamme/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestManageModule, self).tearDown()
コード例 #19
0
ファイル: test_commands.py プロジェクト: mcdonc/ptah
 def tearDown(self):
     self.stdout = self._stdout
     shutil.rmtree(self.dir)
     config.cleanup_system()
コード例 #20
0
ファイル: base.py プロジェクト: ptahproject/devel
 def tearDown(self):
     config.cleanup_system()
     sm = self.p_config
     sm.__init__('base')
     testing.tearDown()
コード例 #21
0
ファイル: test_rest.py プロジェクト: mcdonc/ptah
    def tearDown(self):
        ptah.checkPermission = self.orig_checkPermission

        config.cleanup_system(self.__class__.__module__)
        super(RestBase, self).tearDown()
コード例 #22
0
ファイル: test_security.py プロジェクト: blaflamme/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestACLsProps, self).tearDown()
コード例 #23
0
ファイル: test_tinfo.py プロジェクト: WouterVH/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestTypeInfo, self).tearDown()
コード例 #24
0
ファイル: test_library.py プロジェクト: WouterVH/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestLibraryManagement, self).tearDown()
コード例 #25
0
ファイル: base.py プロジェクト: WouterVH/ptah
 def tearDown(self):
     config.shutdown()
     config.cleanup_system(self.__class__.__module__)
     sm = self.p_config
     sm.__init__('base')
     testing.tearDown()
コード例 #26
0
ファイル: test_application.py プロジェクト: mcdonc/ptah
 def tearDown(self):
     config.cleanup_system(self.__class__.__module__)
     super(TestApplicationFactoryCustom, self).tearDown()