mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 19:29:15 +02:00
Blacked the code
This commit is contained in:
parent
b6fc0051fa
commit
62ca3bd736
279 changed files with 8861 additions and 9527 deletions
|
@ -8,30 +8,24 @@ jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
|
|||
jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER
|
||||
|
||||
|
||||
@pytest.mark.parametrize('query_string', [
|
||||
b'token=wrong',
|
||||
b'',
|
||||
])
|
||||
@pytest.mark.parametrize("query_string", [b"token=wrong", b""])
|
||||
def test_header_anonymous(query_string, factories):
|
||||
def callback(scope):
|
||||
assert scope['user'].is_anonymous
|
||||
assert scope["user"].is_anonymous
|
||||
|
||||
scope = {
|
||||
'query_string': query_string
|
||||
}
|
||||
scope = {"query_string": query_string}
|
||||
consumer = TokenAuthMiddleware(callback)
|
||||
consumer(scope)
|
||||
|
||||
|
||||
def test_header_correct_token(factories):
|
||||
user = factories['users.User']()
|
||||
user = factories["users.User"]()
|
||||
payload = jwt_payload_handler(user)
|
||||
token = jwt_encode_handler(payload)
|
||||
def callback(scope):
|
||||
assert scope['user'] == user
|
||||
|
||||
scope = {
|
||||
'query_string': 'token={}'.format(token).encode('utf-8')
|
||||
}
|
||||
def callback(scope):
|
||||
assert scope["user"] == user
|
||||
|
||||
scope = {"query_string": "token={}".format(token).encode("utf-8")}
|
||||
consumer = TokenAuthMiddleware(callback)
|
||||
consumer(scope)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue