diff --git a/swh/web/tests/auth/test_views.py b/swh/web/tests/auth/test_views.py --- a/swh/web/tests/auth/test_views.py +++ b/swh/web/tests/auth/test_views.py @@ -131,7 +131,7 @@ return decrypted_token -@pytest.mark.django_db(reset_sequences=True) +@pytest.mark.django_db(transaction=True, reset_sequences=True) def test_oidc_generate_bearer_token_authenticated_user_success(client, keycloak_oidc): """ Authenticated user should be able to generate a bearer token using OIDC @@ -150,7 +150,7 @@ check_http_get_response(client, url, status_code=403) -@pytest.mark.django_db(reset_sequences=True) +@pytest.mark.django_db(transaction=True, reset_sequences=True) def test_oidc_list_bearer_tokens(client, keycloak_oidc): """ User with correct credentials should be allowed to list his tokens. @@ -182,7 +182,7 @@ check_http_post_response(client, url, status_code=403) -@pytest.mark.django_db(reset_sequences=True) +@pytest.mark.django_db(transaction=True, reset_sequences=True) def test_oidc_get_bearer_token(client, keycloak_oidc): """ User with correct credentials should be allowed to display a token. @@ -204,7 +204,7 @@ assert response.content == token -@pytest.mark.django_db(reset_sequences=True) +@pytest.mark.django_db(transaction=True, reset_sequences=True) def test_oidc_get_bearer_token_expired_token(client, keycloak_oidc): """ User with correct credentials should be allowed to display a token. @@ -245,7 +245,7 @@ check_http_post_response(client, url, status_code=403) -@pytest.mark.django_db(reset_sequences=True) +@pytest.mark.django_db(transaction=True, reset_sequences=True) def test_oidc_revoke_bearer_tokens(client, keycloak_oidc): """ User with correct credentials should be allowed to revoke tokens. @@ -279,7 +279,7 @@ assert resp["location"] == login_url -@pytest.mark.django_db(reset_sequences=True) +@pytest.mark.django_db(transaction=True, reset_sequences=True) def test_oidc_profile_view(client, keycloak_oidc): """ Authenticated users should be able to request the profile page