def test_powerview_add_resource_nonexisting_resource_id(self):
'''Calling powerview_add_resource with nonexisting resource id raises
ValidationError.'''
sysadmin = Sysadmin()
powerview = factories.PowerView()
with nosetools.assert_raises(ValidationError) as cm:
toolkit.get_action('powerview_add_resource')(
context={'user': sysadmin['name']},
data_dict={'id': powerview['id'],
'resource_id': 'non-existing-id'}
)
error_dict = cm.exception.error_dict['resource_id']
nosetools.assert_true("Not found: Resource"
in error_dict,
"Expected string not in exception message.")
评论列表
文章目录