Пример #1
0
    def test_effective_principals_when_theres_no_lti_user(
            self, pyramid_request, _helpers):
        pyramid_request.lti_user = None
        policy = LTIAuthenticationPolicy()

        principals = policy.effective_principals(pyramid_request)

        _helpers.authenticated_userid.assert_not_called()
        assert principals == [security.Everyone]
Пример #2
0
    def test_effective_principals_when_theres_an_lti_user(
            self, pyramid_request, _helpers):
        policy = LTIAuthenticationPolicy()

        principals = policy.effective_principals(pyramid_request)

        _helpers.authenticated_userid.assert_called_once_with(
            pyramid_request.lti_user)
        assert principals == [
            security.Everyone,
            security.Authenticated,
            _helpers.authenticated_userid.return_value,
            "lti_user",
        ]