mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-08-14 10:47:27 +08:00

* Use a generic Protocol model for User instead of Pydantic
* Remove UserDB Pydantic schema
* Harmonize schema variable naming to avoid confusions
* Revamp OAuth account model management
* Revamp AccessToken DB strategy to adopt generic model approach
* Make ID a generic instead of forcing UUIDs
* Improve generic typing
* Improve Strategy typing
* Tweak base DB typing
* Don't set Pydantic schemas on FastAPIUsers class: pass it directly on router creation
* Add IntegerIdMixin and export related classes
* Start to revamp doc for V10
* Revamp OAuth documentation
* Fix code highlights
* Write the 9.x.x ➡️ 10.x.x migration doc
* Fix pyproject.toml
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
import uuid
|
|
|
|
import pytest
|
|
|
|
from fastapi_users.db import BaseUserDatabase
|
|
from tests.conftest import IDType, OAuthAccountModel, UserModel
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
@pytest.mark.db
|
|
async def test_not_implemented_methods(
|
|
user: UserModel, oauth_account1: OAuthAccountModel
|
|
):
|
|
base_user_db = BaseUserDatabase[UserModel, IDType]()
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.get(uuid.uuid4())
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.get_by_email("lancelot@camelot.bt")
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.get_by_oauth_account("google", "user_oauth1")
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.create({})
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.update(user, {})
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.delete(user)
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.add_oauth_account(user, {})
|
|
|
|
with pytest.raises(NotImplementedError):
|
|
await base_user_db.update_oauth_account(user, oauth_account1, {})
|