當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。