mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-11-04 22:56:56 +08:00
* Added login endpoint docs
* make format
* Changed login route into multiple examples.
* Added reset password router docs
* Updated /{id} routes for user
* Updated /me routes
* Fixed user already exists response description
* Updated the /register route
* Updated verify routes
* Updated oauth2 endpoints.
* Applied `make format`
* Renamed Authentication methods for getting their openapi schemas
- `get_login_responses_success` -> `get_openapi_login_responses_success`
- `get_logout_responses_success` -> `get_openapi_logout_responses_success`
* Fixed flake8 errors
* Not using `Final` to keep python37 compatibility
Co-authored-by: François Voron <fvoron@gmail.com>
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
import pytest
|
|
from fastapi 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, user_manager):
|
|
with pytest.raises(NotImplementedError):
|
|
await base_authentication(None, user_manager)
|
|
|
|
|
|
@pytest.mark.authentication
|
|
@pytest.mark.asyncio
|
|
async def test_get_login_response(base_authentication, user, user_manager):
|
|
with pytest.raises(NotImplementedError):
|
|
await base_authentication.get_login_response(user, Response(), user_manager)
|
|
|
|
|
|
@pytest.mark.authentication
|
|
@pytest.mark.asyncio
|
|
async def test_get_logout_response(base_authentication, user, user_manager):
|
|
with pytest.raises(NotImplementedError):
|
|
await base_authentication.get_logout_response(user, Response(), user_manager)
|
|
|
|
|
|
@pytest.mark.authentication
|
|
def test_get_login_response_success(base_authentication, user, user_manager):
|
|
with pytest.raises(NotImplementedError):
|
|
base_authentication.get_openapi_login_responses_success()
|
|
|
|
|
|
@pytest.mark.authentication
|
|
def test_get_logout_response_success(base_authentication, user, user_manager):
|
|
with pytest.raises(NotImplementedError):
|
|
base_authentication.get_openapi_logout_responses_success()
|