예제 #1
0
    def test_manage_pyramid_directive(self):
        from pyramid.config import Configurator

        config = Configurator(autocommit=True)
        config.include("ptah")

        def access_manager():
            """ """

        config.ptah_init_manage(
            "test-manage",
            access_manager=access_manager,
            managers=("manager",),
            manager_role="Manager",
            disable_modules=("module",),
            enable_modules=("module2",),
        )

        cfg = config.ptah_get_settings(ptah.CFG_ID_PTAH)

        self.assertEqual(cfg["manage"], "test-manage")
        self.assertEqual(cfg["managers"], ("manager",))
        self.assertEqual(cfg["manager_role"], "Manager")
        self.assertEqual(cfg["disable_modules"], ("module",))
        self.assertEqual(cfg["enable_modules"], ("module2",))
        self.assertIs(cfg["access_manager"], access_manager)

        iface = config.registry.getUtility(IRouteRequest, "ptah-manage")
        self.assertIsNotNone(iface)
예제 #2
0
파일: test_manage.py 프로젝트: sidloki/ptah
    def test_manage_pyramid_directive(self):
        from pyramid.config import Configurator

        config = Configurator(autocommit=True)
        config.include('ptah')

        def access_manager():
            """ """

        config.ptah_init_manage(
            'test-manage',
            access_manager=access_manager,
            managers = ('manager',),
            manager_role = 'Manager',
            disable_modules = ('module',),
            enable_modules = ('module2',))

        cfg = config.ptah_get_settings(ptah.CFG_ID_PTAH)

        self.assertEqual(cfg['manage'], 'test-manage')
        self.assertEqual(cfg['managers'], ('manager',))
        self.assertEqual(cfg['manager_role'], 'Manager')
        self.assertEqual(cfg['disable_modules'], ('module',))
        self.assertEqual(cfg['enable_modules'], ('module2',))
        self.assertIs(cfg['access_manager'], access_manager)

        iface = config.registry.getUtility(IRouteRequest, 'ptah-manage')
        self.assertIsNotNone(iface)
예제 #3
0
    def test_manage_pyramid_directive_default(self):
        from pyramid.config import Configurator
        from ptah.manage.manage import PtahAccessManager

        config = Configurator(autocommit=True)
        config.include("ptah")

        config.ptah_init_manage("test-manage")

        cfg = config.ptah_get_settings(ptah.CFG_ID_PTAH)
        self.assertIsInstance(cfg["access_manager"], PtahAccessManager)
예제 #4
0
파일: test_manage.py 프로젝트: sidloki/ptah
    def test_manage_pyramid_directive_default(self):
        from pyramid.config import Configurator
        from ptah.manage.manage import PtahAccessManager

        config = Configurator(autocommit=True)
        config.include('ptah')

        config.ptah_init_manage('test-manage')

        cfg = config.ptah_get_settings(ptah.CFG_ID_PTAH)
        self.assertIsInstance(cfg['access_manager'], PtahAccessManager)