mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-11-03 05:27:06 +08:00
* Fix #36: fix token url in auto doc * Define OAuth scheme in authentication base with default /users/login tokenUrl * Allow to override it through contructor argument of auth class * Fix test coverage of BaseAuthentication
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
from fastapi.security import OAuth2PasswordBearer
|
||||
from starlette.responses import Response
|
||||
|
||||
from fastapi_users.authentication import BaseAuthentication
|
||||
@ -6,9 +7,12 @@ from fastapi_users.authentication import BaseAuthentication
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.authentication
|
||||
async def test_not_implemented_methods(user, mock_user_db):
|
||||
@pytest.mark.parametrize(
|
||||
"constructor_kwargs", [{}, {"scheme": OAuth2PasswordBearer(tokenUrl="/foo")}]
|
||||
)
|
||||
async def test_not_implemented_methods(constructor_kwargs, user, mock_user_db):
|
||||
response = Response()
|
||||
base_authentication = BaseAuthentication()
|
||||
base_authentication = BaseAuthentication(**constructor_kwargs)
|
||||
|
||||
with pytest.raises(NotImplementedError):
|
||||
await base_authentication.get_login_response(user, response)
|
||||
|
||||
Reference in New Issue
Block a user