Skip to content
Snippets Groups Projects
Commit f67c8bde authored by Juan Pedro Sánchez's avatar Juan Pedro Sánchez
Browse files

//WIP: create user exploration tests

parent b9585999
No related branches found
No related tags found
No related merge requests found
......@@ -186,7 +186,7 @@ KEYCLOAK = {
'username': env('KEYCLOAK_ADMIN_USER'),
'password': env('KEYCLOAK_ADMIN_PASSWORD'),
'realm_name': env('KEYCLOAK_REALM'),
'client_secret_key': env('KEYCLOAK_CLIENT_SECRET'),
'verify': env.bool("KEYCLOAK_ADMIN_VERIFY"),
},
'openid_client': {
'server_url': env('KEYCLOAK_SERVER_URL'),
......
[pytest]
DJANGO_CONFIGURATION = Test
DJANGO_SETTINGS_MODULE = demo.settings
addopts = --nomigrations --create-db --cov-report=html -vv
addopts = --nomigrations --create-db --cov-report=html -vv -s
python_files = test_*.py tests.py
filterwarnings =
ignore::DeprecationWarning
......@@ -12,4 +12,5 @@ environs==9.5.0
ipython
pytest==7.1.2
pytest-django==4.5.2
factory-boy==3.2.1
\ No newline at end of file
pytest-cov==3.0.0
factory-boy==3.2.1
from .fixtures import keycloak_admin, keycloak, user
\ No newline at end of file
from .fixtures import keycloak_admin, keycloak, user_id
\ No newline at end of file
......@@ -4,7 +4,7 @@ from keycloak import KeycloakAdmin, KeycloakOpenID
@pytest.fixture
def keycloak_admin(settings):
def keycloak_master_admin(settings):
admin = KeycloakAdmin(**settings.KEYCLOAK['admin'])
yield admin
......@@ -16,15 +16,16 @@ def keycloak(settings):
@pytest.fixture
def user(keycloak):
new_user = keycloak.create_user({
def user_id(keycloak_admin):
user_id = keycloak_admin.create_user({
'email': 'emma.goldman@ccee.coop',
'username': 'emma.goldman',
'enabled': True,
'firstName': 'Emma',
'lastName': 'Goldman'
})
return new_user
yield user_id
keycloak_admin.delete_user(user_id)
@pytest.fixture
......
def test_create_user_fixture(user):
assert user is not None
\ No newline at end of file
def test_create_user_fixture(user_id):
assert user_id is not None
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment