def test_resource_delete_editor(self):
'''Normally organization admins can delete resources
Our plugin prevents this by blocking delete organization.
Ensure the delete button is not displayed (as only resource delete
is checked for showing this)
'''
user = factories.User()
owner_org = factories.Organization(
users=[{'name': user['id'], 'capacity': 'admin'}]
)
dataset = factories.Dataset(owner_org=owner_org['id'])
resource = factories.Resource(package_id=dataset['id'])
with assert_raises(logic.NotAuthorized) as e:
logic.check_access('resource_delete', {'user': user['name']}, {'id': resource['id']})
assert_equal(e.exception.message, 'User %s not authorized to delete resource %s' % (user['name'], resource['id']))
test_example_iauthfunctions.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录