Skip to content

Commit

Permalink
Ajout d'un commentaire et utilisation de reverse()
Browse files Browse the repository at this point in the history
  • Loading branch information
Situphen committed Jan 13, 2024
1 parent c0510fe commit b8d50cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion zds/api/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from django.urls import reverse
from oauth2_provider.models import Application, AccessToken


# As of django-oauth-toolkit (oauth2_provider) 2.0.0, `Application.client_secret` values are hashed
# before being saved in the database. For the tests, we use the same method as django-oauth-toolkit tests
# which is to store the client_secret cleartext value in CLEARTEXT_SECRET.
# (See https://github.com/jazzband/django-oauth-toolkit/blob/fda64f97974aac78d4ac9c9f0f36e137dbe4fb8c/tests/test_client_credential.py#L26C58-L26C58)
CLEARTEXT_SECRET = "abcdefghijklmnopqrstuvwxyz1234567890"


Expand All @@ -13,7 +19,7 @@ def authenticate_oauth2_client(client, user, password):
oauth2_client.save()

client.post(
"/oauth2/token/",
reverse("oauth2_provider:token"),
{
"client_id": oauth2_client.client_id,
"client_secret": CLEARTEXT_SECRET,
Expand Down

0 comments on commit b8d50cd

Please sign in to comment.