Add a test for ping in OIDC auth
This commit is contained in:
parent
c1ce84822d
commit
c2a56ae828
1 changed files with 8 additions and 0 deletions
|
@ -1,9 +1,11 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from contextlib import contextmanager
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
from data.database import model
|
from data.database import model
|
||||||
from data.users.federated import DISABLED_MESSAGE
|
from data.users.federated import DISABLED_MESSAGE
|
||||||
|
from data.users.oidc import OIDCInternalAuth
|
||||||
from test.test_ldap import mock_ldap
|
from test.test_ldap import mock_ldap
|
||||||
from test.test_keystone_auth import fake_keystone
|
from test.test_keystone_auth import fake_keystone
|
||||||
from test.test_external_jwt_authn import fake_jwt
|
from test.test_external_jwt_authn import fake_jwt
|
||||||
|
@ -36,12 +38,18 @@ def test_auth_createuser(auth_system_builder, user1, user2, config, app):
|
||||||
assert new_user is None
|
assert new_user is None
|
||||||
assert err == DISABLED_MESSAGE
|
assert err == DISABLED_MESSAGE
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def fake_oidc(app_config):
|
||||||
|
yield OIDCInternalAuth(app_config, 'someoidc', False)
|
||||||
|
|
||||||
@pytest.mark.parametrize('auth_system_builder,auth_kwargs', [
|
@pytest.mark.parametrize('auth_system_builder,auth_kwargs', [
|
||||||
(mock_ldap, {}),
|
(mock_ldap, {}),
|
||||||
(fake_keystone, {'version': 3}),
|
(fake_keystone, {'version': 3}),
|
||||||
(fake_keystone, {'version': 2}),
|
(fake_keystone, {'version': 2}),
|
||||||
(fake_jwt, {}),
|
(fake_jwt, {}),
|
||||||
|
(fake_oidc, {'app_config': {
|
||||||
|
'SOMEOIDC_LOGIN_CONFIG': {},
|
||||||
|
}}),
|
||||||
])
|
])
|
||||||
def test_ping(auth_system_builder, auth_kwargs, app):
|
def test_ping(auth_system_builder, auth_kwargs, app):
|
||||||
with auth_system_builder(**auth_kwargs) as auth:
|
with auth_system_builder(**auth_kwargs) as auth:
|
||||||
|
|
Reference in a new issue