mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 08:39:16 +02:00
Fixed #54: Now use pytest everywhere \o/
This commit is contained in:
parent
a7758395ee
commit
099cdfa99c
65 changed files with 1466 additions and 1467 deletions
21
api/tests/test_jwt_querystring.py
Normal file
21
api/tests/test_jwt_querystring.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from django.urls import reverse
|
||||
from rest_framework_jwt.settings import api_settings
|
||||
|
||||
jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
|
||||
jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER
|
||||
|
||||
|
||||
def test_can_authenticate_using_token_param_in_url(factories, settings, client):
|
||||
user = factories['users.User']()
|
||||
settings.API_AUTHENTICATION_REQUIRED = True
|
||||
url = reverse('api:v1:tracks-list')
|
||||
response = client.get(url)
|
||||
|
||||
assert response.status_code == 401
|
||||
|
||||
payload = jwt_payload_handler(user)
|
||||
token = jwt_encode_handler(payload)
|
||||
response = client.get(url, data={
|
||||
'jwt': token
|
||||
})
|
||||
assert response.status_code == 200
|
Loading…
Add table
Add a link
Reference in a new issue