tests.test_tokens

Test the token endpoints

Module Contents

Functions

get_code(client)

Get a code

test_get_code(tilauspalvelu_jwt_client)

Test that we can get a new code

test_get_code_422(tilauspalvelu_jwt_client)

Test that we get error if trying to give wrong input

use_code(client, code)

Use the code

test_use_code(tilauspalvelu_jwt_client, unauth_client)

Test that we can get a new code and use one with fresh session

test_use_code_twice(tilauspalvelu_jwt_client, ...)

Test that we can get a new code and re-using it fails

test_refresh_jwt(tilauspalvelu_jwt_client)

Test that the refresh endpoint works

Attributes

LOGGER

LOGGER[source]
async get_code(client)[source]

Get a code

Parameters:

client (async_asgi_testclient.TestClient)

Return type:

str

async test_get_code(tilauspalvelu_jwt_client)[source]

Test that we can get a new code

Parameters:

tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

Return type:

None

async test_get_code_422(tilauspalvelu_jwt_client)[source]

Test that we get error if trying to give wrong input

Parameters:

tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

Return type:

None

async use_code(client, code)[source]

Use the code

Parameters:
  • client (async_asgi_testclient.TestClient)

  • code (str)

Return type:

str

async test_use_code(tilauspalvelu_jwt_client, unauth_client)[source]

Test that we can get a new code and use one with fresh session

Parameters:
  • tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

  • unauth_client (async_asgi_testclient.TestClient)

Return type:

None

async test_use_code_twice(tilauspalvelu_jwt_client, unauth_client)[source]

Test that we can get a new code and re-using it fails

Parameters:
  • tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

  • unauth_client (async_asgi_testclient.TestClient)

Return type:

None

async test_refresh_jwt(tilauspalvelu_jwt_client)[source]

Test that the refresh endpoint works

Parameters:

tilauspalvelu_jwt_client (async_asgi_testclient.TestClient)

Return type:

None