mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-15 19:30:47 +08:00

* Revamp authentication to allow multiple backends * Make router generate a login route for each backend * Apply black * Remove unused imports * Complete docstrings * Update documentation * WIP add cookie auth * Complete cookie auth unit tests * Add documentation for cookie auth * Fix cookie backend default name * Don't make cookie return a Response
28 lines
757 B
Python
28 lines
757 B
Python
import pytest
|
|
from starlette.responses import Response
|
|
|
|
from fastapi_users.authentication import BaseAuthentication
|
|
|
|
|
|
@pytest.fixture
|
|
def base_authentication():
|
|
return BaseAuthentication()
|
|
|
|
|
|
@pytest.mark.authentication
|
|
class TestAuthenticate:
|
|
@pytest.mark.asyncio
|
|
async def test_not_implemented(
|
|
self, base_authentication, mock_user_db, request_builder
|
|
):
|
|
request = request_builder({})
|
|
with pytest.raises(NotImplementedError):
|
|
await base_authentication(request, mock_user_db)
|
|
|
|
|
|
@pytest.mark.authentication
|
|
@pytest.mark.asyncio
|
|
async def test_get_login_response(base_authentication, user):
|
|
with pytest.raises(NotImplementedError):
|
|
await base_authentication.get_login_response(user, Response())
|