当前位置: 首页>>代码示例>>Python>>正文


Python BuildConfigurationsAdminPageProvider.render_admin_panel方法代码示例

本文整理汇总了Python中bitten.admin.BuildConfigurationsAdminPageProvider.render_admin_panel方法的典型用法代码示例。如果您正苦于以下问题:Python BuildConfigurationsAdminPageProvider.render_admin_panel方法的具体用法?Python BuildConfigurationsAdminPageProvider.render_admin_panel怎么用?Python BuildConfigurationsAdminPageProvider.render_admin_panel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bitten.admin.BuildConfigurationsAdminPageProvider的用法示例。


在下文中一共展示了BuildConfigurationsAdminPageProvider.render_admin_panel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_process_update_config

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_update_config(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        redirected_to = []
        def redirect(url):
            redirected_to.append(url)
            raise RequestDone
        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   abs_href=Href('http://example.org/'), redirect=redirect,
                   authname='joe', chrome={'warnings': [], 'notices': []},
                   href=Href('/'),
                   args={'save': '', 'name': 'foo', 'label': 'Foobar',
                         'description': 'Thanks for all the fish!'})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', 'foo')
            self.fail('Expected RequestDone')

        except RequestDone:
            self.assertEqual(['Configuration Saved.'], req.chrome['notices'])
            self.assertEqual('http://example.org/admin/bitten/configs/foo',
                             redirected_to[0])
            config = BuildConfig.fetch(self.env, name='foo')
            self.assertEqual('Foobar', config.label)
            self.assertEqual('Thanks for all the fish!', config.description)
开发者ID:lkraav,项目名称:trachacks,代码行数:29,代码来源:admin.py

示例2: test_process_update_platform_cancel

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_update_platform_cancel(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()
        platform = TargetPlatform(self.env, config='foo', name='any')
        platform.insert()

        redirected_to = []
        def redirect(url):
            redirected_to.append(url)
            raise RequestDone
        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   abs_href=Href('http://example.org/'), redirect=redirect,
                   authname='joe',
                   args={'cancel': '', 'edit': '', 'name': 'Changed',
                         'property_0': 'family', 'pattern_0': 'posix'})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs',
                                           'foo/%d' % platform.id)
            self.fail('Expected RequestDone')

        except RequestDone:
            self.assertEqual('http://example.org/admin/bitten/configs/foo',
                             redirected_to[0])
            platforms = list(TargetPlatform.select(self.env, config='foo'))
            self.assertEqual(1, len(platforms))
            self.assertEqual('any', platforms[0].name)
            self.assertEqual([], platforms[0].rules)
开发者ID:lkraav,项目名称:trachacks,代码行数:31,代码来源:admin.py

示例3: test_process_deactivate_config

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_deactivate_config(self):
        BuildConfig(self.env, name='foo', path='branches/foo',
                    active=True).insert()
        BuildConfig(self.env, name='bar', path='branches/bar',
                    active=True).insert()

        redirected_to = []
        def redirect(url):
            redirected_to.append(url)
            raise RequestDone
        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   abs_href=Href('http://example.org/'), redirect=redirect,
                   authname='joe',
                   args={'apply': ''})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', '')
            self.fail('Expected RequestDone')

        except RequestDone:
            self.assertEqual('http://example.org/admin/bitten/configs',
                             redirected_to[0])
            config = BuildConfig.fetch(self.env, name='foo')
            self.assertEqual(False, config.active)
            config = BuildConfig.fetch(self.env, name='bar')
            self.assertEqual(False, config.active)
开发者ID:lkraav,项目名称:trachacks,代码行数:29,代码来源:admin.py

示例4: test_process_remove_platforms

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_remove_platforms(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()
        platform = TargetPlatform(self.env, config='foo', name='any')
        platform.insert()

        redirected_to = []
        def redirect(url):
            redirected_to.append(url)
            raise RequestDone
        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   abs_href=Href('http://example.org/'), redirect=redirect,
                   authname='joe', chrome={'warnings': [], 'notices': []},
                   href=Href('/'),
                   args={'remove': '', 'sel': str(platform.id)})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', 'foo')
            self.fail('Expected RequestDone')

        except RequestDone:
            self.assertEquals(['Target Platform(s) Removed.'],
                               req.chrome['notices'])
            self.assertEqual('http://example.org/admin/bitten/configs/foo',
                             redirected_to[0])
            platforms = list(TargetPlatform.select(self.env, config='foo'))
            self.assertEqual(0, len(platforms))
开发者ID:lkraav,项目名称:trachacks,代码行数:30,代码来源:admin.py

示例5: test_process_add_config_no_name

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_add_config_no_name(self):
        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   chrome={'warnings': []}, href=Href('/'),
                   authname='joe', args={'add': ''})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', '')
            self.fail('Expected TracError')

        except TracError, e:
            self.assertEqual('Missing required field "name".', e.message)
            self.assertEqual('Add Configuration', e.title)
开发者ID:lkraav,项目名称:trachacks,代码行数:15,代码来源:admin.py

示例6: test_process_update_config_non_wellformed_recipe

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_update_config_non_wellformed_recipe(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   authname='joe', chrome={'warnings': []}, href=Href('/'),
                   args={'save': '', 'name': 'foo', 'recipe': 'not_xml'})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        provider.render_admin_panel(req, 'bitten', 'configs', 'foo')

        self.failUnless(req.chrome['warnings'], "No warnings?")
        self.assertEquals(['Failure parsing recipe: syntax error: line 1, ' \
                        'column 0.'], req.chrome['warnings'])
开发者ID:lkraav,项目名称:trachacks,代码行数:16,代码来源:admin.py

示例7: test_process_remove_config_bad_selection

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_remove_config_bad_selection(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   args={'remove': '', 'sel': 'baz'})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', '')
            self.fail('Expected TracError')

        except TracError, e:
            self.assertEqual("Configuration 'baz' not found", e.message)
开发者ID:lkraav,项目名称:trachacks,代码行数:16,代码来源:admin.py

示例8: test_process_add_config_invalid_name

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_add_config_invalid_name(self):
        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   chrome={'warnings': []}, href=Href('/'), authname='joe',
                   args={'add': '', 'name': 'no spaces allowed'})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', '')
            self.fail('Expected TracError')

        except TracError, e:
            self.assertEqual('The field "name" may only contain letters, '
                             'digits, periods, or dashes.', e.message)
            self.assertEqual('Add Configuration', e.title)
开发者ID:lkraav,项目名称:trachacks,代码行数:16,代码来源:admin.py

示例9: test_process_update_config_no_name

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_update_config_no_name(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   args={'save': '', 'name': ''}, authname='joe',
                   chrome={'warnings':[]}, href=Href('/'))

        provider = BuildConfigurationsAdminPageProvider(self.env)
        provider.render_admin_panel(req, 'bitten', 'configs', 'foo')

        self.failUnless(req.chrome['warnings'], "No warnings?")
        self.assertEquals(['Missing required field "name".'],
                            req.chrome['warnings'])
开发者ID:lkraav,项目名称:trachacks,代码行数:16,代码来源:admin.py

示例10: test_process_update_config_invalid_recipe

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_update_config_invalid_recipe(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   authname='joe', chrome={'warnings': []}, href=Href('/'),
                   args={'save': '', 'name': 'foo',
                         'recipe': '<build><step /></build>'})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        provider.render_admin_panel(req, 'bitten', 'configs', 'foo')
        
        self.failUnless(req.chrome['warnings'], "No warnings?")
        self.assertEquals(req.chrome['warnings'],
                    ['Invalid Recipe: Steps must have an "id" attribute.'])
开发者ID:lkraav,项目名称:trachacks,代码行数:17,代码来源:admin.py

示例11: test_process_update_config_invalid_name

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_update_config_invalid_name(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   args={'save': '', 'name': 'no spaces allowed'},
                   authname='joe', chrome={'warnings': []},
                   href=Href('/'))

        provider = BuildConfigurationsAdminPageProvider(self.env)
        provider.render_admin_panel(req, 'bitten', 'configs', 'foo')

        self.failUnless(req.chrome['warnings'], "No warnings?")
        self.assertEquals(req.chrome['warnings'], ['The field "name" may ' \
                        'only contain letters, digits, periods, or dashes.'])
开发者ID:lkraav,项目名称:trachacks,代码行数:17,代码来源:admin.py

示例12: test_process_view_configs

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_view_configs(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()
        BuildConfig(self.env, name='bar', label='Bar', path='branches/bar',
                    min_rev='123', max_rev='456').insert()

        req = Mock(method='GET', chrome={}, href=Href('/'),
                   perm=PermissionCache(self.env, 'joe'))

        provider = BuildConfigurationsAdminPageProvider(self.env)
        template_name, data = provider.render_admin_panel(
            req, 'bitten', 'configs', ''
        )

        self.assertEqual('bitten_admin_configs.html', template_name)
        assert 'configs' in data
        configs = data['configs']
        self.assertEqual(2, len(configs))
        self.assertEqual({
            'name': 'bar', 'href': '/admin/bitten/configs/bar',
            'label': 'Bar', 'min_rev': '123', 'max_rev': '456',
            'path': 'branches/bar', 'active': False, 'recipe': False
        }, configs[0])
        self.assertEqual({
            'name': 'foo', 'href': '/admin/bitten/configs/foo',
            'label': 'Foo', 'min_rev': None, 'max_rev': None,
            'path': 'branches/foo', 'active': True, 'recipe': False
        }, configs[1])
开发者ID:lkraav,项目名称:trachacks,代码行数:30,代码来源:admin.py

示例13: test_new_config_submit_with_invalid_path

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_new_config_submit_with_invalid_path(self):
        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   authname='joe',
                   args={'add': '', 'name': 'foo', 'path': 'invalid/path'})

        def get_node(path, rev=None):
            raise TracError('No such node')
        self.repos.get_node = get_node

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', '')
            self.fail('Expected TracError')

        except TracError, e:
            self.failUnless('Invalid Repository Path' in e.message)
开发者ID:lkraav,项目名称:trachacks,代码行数:18,代码来源:admin.py

示例14: test_process_new_platform_no_name

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_new_platform_no_name(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        data = {}
        req = Mock(method='POST', chrome={}, hdf=data, href=Href('/'),
                   perm=PermissionCache(self.env, 'joe'),
                   args={'new': '', 'platform_name': ''})

        provider = BuildConfigurationsAdminPageProvider(self.env)
        try:
            provider.render_admin_panel(req, 'bitten', 'configs', 'foo')
            self.fail("No TracError?")
        except Exception, e:
            self.assertEquals(e.message, 'Missing required field "name"')
            self.assertEquals(e.title, 'Missing field')
开发者ID:lkraav,项目名称:trachacks,代码行数:18,代码来源:admin.py

示例15: test_process_update_config_invalid_path

# 需要导入模块: from bitten.admin import BuildConfigurationsAdminPageProvider [as 别名]
# 或者: from bitten.admin.BuildConfigurationsAdminPageProvider import render_admin_panel [as 别名]
    def test_process_update_config_invalid_path(self):
        BuildConfig(self.env, name='foo', label='Foo', path='branches/foo',
                    active=True).insert()

        req = Mock(method='POST', perm=PermissionCache(self.env, 'joe'),
                   authname='joe', chrome={'warnings': []}, href=Href('/'),
                   args={'save': '', 'name': 'foo', 'path': 'invalid/path'})

        def get_node(path, rev=None):
            raise TracError('No such node')
        self.repos.get_node = get_node

        provider = BuildConfigurationsAdminPageProvider(self.env)
        provider.render_admin_panel(req, 'bitten', 'configs', 'foo')
        
        self.failUnless(req.chrome['warnings'], "No warnings?")
        self.assertEquals(req.chrome['warnings'],
                            ['Invalid Repository Path "invalid/path".'])
开发者ID:lkraav,项目名称:trachacks,代码行数:20,代码来源:admin.py


注:本文中的bitten.admin.BuildConfigurationsAdminPageProvider.render_admin_panel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。