[tests] add JWTMw test for query without tokens (must return Unauth user)
This commit is contained in:
parent
c7e29e399b
commit
3c6713b5e2
|
@ -112,7 +112,19 @@ def test_JWTUser():
|
||||||
assert user.is_authenticated == True
|
assert user.is_authenticated == True
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_JWTAuthenticationBackend(token_builder):
|
async def test_JWTAuthenticationBackend_NoToken(token_builder):
|
||||||
|
backend = JWTAuthenticationBackend()
|
||||||
|
assert backend.secret_key == SECRET
|
||||||
|
|
||||||
|
req = Request()
|
||||||
|
|
||||||
|
credentials, user = await backend.authenticate(req)
|
||||||
|
assert isinstance(user, UnauthenticatedUser)
|
||||||
|
assert isinstance(credentials, AuthCredentials)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_JWTAuthenticationBackend_Token(token_builder):
|
||||||
backend = JWTAuthenticationBackend()
|
backend = JWTAuthenticationBackend()
|
||||||
assert backend.secret_key == SECRET
|
assert backend.secret_key == SECRET
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue