tests.test_auth

Test the supported authentication methods

Module Contents

Functions

two_users(ginosession)

First one is normal, second is admin

check_response(resp, expect_type)

Check the response

test_jwt_jwt(tilauspalvelu_jwt_client)

Test JWT-check endpoint with JWT authenticated client

test_mtls_jwt(mtls_client)

Test JWT-check endpoint with mTLS authenticated client

test_mtls_mtls(mtls_client)

Test mTLS-check endpoint with mTLS authenticated client

test_jwt_mtls(tilauspalvelu_jwt_client)

Test mTLS-check endpoint with JWT authenticated client

test_jwt_both_permissive(tilauspalvelu_jwt_client)

Test JWT-or-mTLS -check endpoint with JWT authenticated client

test_jwt_both_notp(tilauspalvelu_jwt_client)

Test JWT-or-mTLS -check endpoint with JWT authenticated client

test_mtls_both(mtls_client)

Test JWT-or-mTLS -check endpoint with mTLS authenticated client

test_valid_user_mtls(unauth_client, two_users)

Test the valid user endpoint with valid and invalid CNs

test_valid_user_jwt(unauth_client, two_users)

Test the valid user endpoint with valid and invalid subs

test_valid_admin_mtls(unauth_client, two_users)

Test the valid user endpoint with admin and non-admin CNs

test_valid_admin_jwt(unauth_client, two_users)

Test the valid user endpoint with admin and non-admin subs

Attributes

LOGGER

LOGGER[source]
async two_users(ginosession)[source]

First one is normal, second is admin

Parameters:

ginosession (None)

Return type:

Tuple[rasenmaeher_api.db.Person, rasenmaeher_api.db.Person]

check_response(resp, expect_type)[source]

Check the response

Parameters:
  • resp (Any)

  • expect_type (str)

Return type:

Dict[str, Any]

async test_jwt_jwt(tilauspalvelu_jwt_client)[source]

Test JWT-check endpoint with JWT authenticated client

Parameters:

tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

Return type:

None

async test_mtls_jwt(mtls_client)[source]

Test JWT-check endpoint with mTLS authenticated client

Parameters:

mtls_client (async_asgi_testclient.TestClient)

Return type:

None

async test_mtls_mtls(mtls_client)[source]

Test mTLS-check endpoint with mTLS authenticated client

Parameters:

mtls_client (async_asgi_testclient.TestClient)

Return type:

None

async test_jwt_mtls(tilauspalvelu_jwt_client)[source]

Test mTLS-check endpoint with JWT authenticated client

Parameters:

tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

Return type:

None

async test_jwt_both_permissive(tilauspalvelu_jwt_client)[source]

Test JWT-or-mTLS -check endpoint with JWT authenticated client

Parameters:

tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

Return type:

None

async test_jwt_both_notp(tilauspalvelu_jwt_client)[source]

Test JWT-or-mTLS -check endpoint with JWT authenticated client

Parameters:

tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

Return type:

None

async test_mtls_both(mtls_client)[source]

Test JWT-or-mTLS -check endpoint with mTLS authenticated client

Parameters:

mtls_client (async_asgi_testclient.TestClient)

Return type:

None

async test_valid_user_mtls(unauth_client, two_users)[source]

Test the valid user endpoint with valid and invalid CNs

Parameters:
Return type:

None

async test_valid_user_jwt(unauth_client, two_users)[source]

Test the valid user endpoint with valid and invalid subs

Parameters:
Return type:

None

async test_valid_admin_mtls(unauth_client, two_users)[source]

Test the valid user endpoint with admin and non-admin CNs

Parameters:
Return type:

None

async test_valid_admin_jwt(unauth_client, two_users)[source]

Test the valid user endpoint with admin and non-admin subs

Parameters:
Return type:

None