コード例 #1
0
ファイル: controller_tests.py プロジェクト: virtusize/nap
def test_base_controller_authorize_no_role():
    bc = BaseController()
    model = 'something'
    bc.guard = Guard()
    ctx = Context()
    ctx.identity = Identity([])
    bc.authorize(ctx, 'read', model)
コード例 #2
0
ファイル: controller_tests.py プロジェクト: virtusize/nap
def test_base_controller_authorize_successful():
    bc = BaseController()
    model = SomeModel()
    bc.guard = Guard()
    bc.model = SomeModel
    ctx = Context()
    role = Role()
    role.grant('read', SomeModel)
    ctx.identity = Identity([role])
    bc.authorize(ctx, 'read', model)
コード例 #3
0
ファイル: controller_tests.py プロジェクト: virtusize/nap
def test_base_controller_authorize_no_ctx():
    bc = BaseController()
    model = 'something'
    bc.guard = Guard()
    ctx = None
    bc.authorize(ctx, 'read', model)