Exemple #1
0
    def test_unauthenticated_userid_doesnt_proxy_to_basic_auth_if_forwarded_user(
            self, pyramid_request, BasicAuthAuthenticationPolicy):
        pyramid_request.headers['X-Forwarded-User'] = '******'
        auth_policy = AuthClientPolicy()

        auth_policy.unauthenticated_userid(pyramid_request)

        assert BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.call_count == 0
Exemple #2
0
    def test_unauthenticated_userid_doesnt_proxy_to_basic_auth_if_forwarded_user(
        self, pyramid_request, BasicAuthAuthenticationPolicy
    ):
        pyramid_request.headers["X-Forwarded-User"] = "******"
        auth_policy = AuthClientPolicy()

        auth_policy.unauthenticated_userid(pyramid_request)

        assert (
            BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.call_count
            == 0
        )
Exemple #3
0
    def test_unauthenticated_userid_proxies_to_basic_auth_if_no_forwarded_user(
            self, pyramid_request, BasicAuthAuthenticationPolicy):
        auth_policy = AuthClientPolicy()
        unauth_id = auth_policy.unauthenticated_userid(pyramid_request)

        BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.assert_called_once_with(
            pyramid_request)
        assert unauth_id == BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.return_value
Exemple #4
0
    def test_unauthenticated_userid_proxies_to_basic_auth_if_no_forwarded_user(
        self, pyramid_request, BasicAuthAuthenticationPolicy
    ):
        auth_policy = AuthClientPolicy()
        unauth_id = auth_policy.unauthenticated_userid(pyramid_request)

        BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.assert_called_once_with(
            pyramid_request
        )
        assert (
            unauth_id
            == BasicAuthAuthenticationPolicy.return_value.unauthenticated_userid.return_value
        )