Files
fastapi-users/tests/test_authentication_base.py
François Voron f2892aa378 #5 Improve test coverage (#6)
* Improve test coverage of BaseUserDatabase

* Improve unit test isolation

* Improve coverage of router and authentication
2019-10-15 07:54:53 +02:00

26 lines
853 B
Python

import pytest
from starlette.responses import Response
from fastapi_users.authentication import BaseAuthentication
@pytest.mark.asyncio
async def test_not_implemented_methods(user, mock_user_db):
response = Response()
base_authentication = BaseAuthentication()
with pytest.raises(NotImplementedError):
await base_authentication.get_login_response(user, response)
with pytest.raises(NotImplementedError):
await base_authentication.get_current_user(mock_user_db)
with pytest.raises(NotImplementedError):
await base_authentication.get_current_active_user(mock_user_db)
with pytest.raises(NotImplementedError):
await base_authentication.get_current_superuser(mock_user_db)
with pytest.raises(NotImplementedError):
await base_authentication._get_authentication_method(mock_user_db)