コード例 #1
0
ファイル: policy_test.py プロジェクト: wisdom-garden/h
    def test_authenticated_userid_does_not_proxy_if_no_forwarded_user(
            self, pyramid_request, BasicAuthAuthenticationPolicy):
        auth_policy = AuthClientPolicy()
        auth_policy.authenticated_userid(pyramid_request)

        assert BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.call_count == 0
        assert BasicAuthAuthenticationPolicy.return_value.callback.call_count == 0
コード例 #2
0
ファイル: policy_test.py プロジェクト: hypothesis/h
    def test_authenticated_userid_does_not_proxy_if_no_forwarded_user(
        self, pyramid_request, BasicAuthAuthenticationPolicy
    ):
        auth_policy = AuthClientPolicy()
        auth_policy.authenticated_userid(pyramid_request)

        assert (
            BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.call_count
            == 0
        )
        assert BasicAuthAuthenticationPolicy.return_value.callback.call_count == 0
コード例 #3
0
ファイル: policy_test.py プロジェクト: wisdom-garden/h
    def test_authenticated_userid_proxies_to_basic_auth_policy_if_forwarded_user(
            self, pyramid_request, BasicAuthAuthenticationPolicy):
        pyramid_request.headers['X-Forwarded-User'] = '******'
        auth_policy = AuthClientPolicy()
        auth_policy.authenticated_userid(pyramid_request)

        BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.assert_called_once_with(
            pyramid_request)
        BasicAuthAuthenticationPolicy.return_value.callback.assert_called_once_with(
            BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.
            return_value, pyramid_request)
コード例 #4
0
ファイル: policy_test.py プロジェクト: hypothesis/h
    def test_authenticated_userid_proxies_to_basic_auth_policy_if_forwarded_user(
        self, pyramid_request, BasicAuthAuthenticationPolicy
    ):
        pyramid_request.headers["X-Forwarded-User"] = "******"
        auth_policy = AuthClientPolicy()
        auth_policy.authenticated_userid(pyramid_request)

        BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.assert_called_once_with(
            pyramid_request
        )
        BasicAuthAuthenticationPolicy.return_value.callback.assert_called_once_with(
            BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.return_value,
            pyramid_request,
        )
コード例 #5
0
ファイル: policy_test.py プロジェクト: fuelpress/i.fuel.press
    def test_authenticated_userid_returns_None_if_callback_not_OK(
            self, check, pyramid_request):
        check.return_value = None
        policy = AuthClientPolicy(check=check)

        pyramid_request.headers["X-Forwarded-User"] = "******"

        userid = policy.authenticated_userid(pyramid_request)

        assert userid is None
コード例 #6
0
ファイル: policy_test.py プロジェクト: hypothesis/h
    def test_authenticated_userid_returns_None_if_callback_not_OK(
        self, check, pyramid_request
    ):
        check.return_value = None
        policy = AuthClientPolicy(check=check)

        pyramid_request.headers["X-Forwarded-User"] = "******"

        userid = policy.authenticated_userid(pyramid_request)

        assert userid is None