本文整理汇总了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)
示例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)
示例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)
示例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))
示例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)
示例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'])
示例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)
示例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)
示例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'])
示例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.'])
示例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.'])
示例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])
示例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)
示例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')
示例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".'])