Beispiel #1
0
    def test_introspect_route_introspect(self):
        from ptah import config
        from ptah.manage.intr_renderers import RouteDirective

        ptah.view.register_route('test-introspect', '/test/introspect')
        data = config.scan(self.__class__.__module__, set())

        actions = []
        for action in data:
            if action.discriminator[0] == 'ptah.view:route':
                actions.append(action)

        ti = RouteDirective(self.request)
        res = ti.renderActions(*actions)

        self.assertIn('test-introspect: /test/introspect', res)
Beispiel #2
0
    def _test_introspect_subscriber_introspect(self):
        from ptah import config
        from ptah.manage.introspect import SubscriberDirective

        @ptah.subscriber(TestEvent)
        def eventHandler1(ev):
            """ """

        @ptah.subscriber(None, TestEvent)
        def eventHandler2(context, ev):
            """ """

        data = config.scan(self.__class__.__module__, set())

        actions = []
        for action in data:
            if action.discriminator[0] == 'ptah.config:subscriber':
                actions.append(action)

        ti = SubscriberDirective(self.request)
        res = ti.renderActions(*actions)

        self.assertIn('ptah.manage.tests.test_introspect.eventHandler1', res)
        self.assertIn('ptah.manage.tests.test_introspect.eventHandler2', res)