Add unit tests for models and services
- Implemented unit tests for Object model including folder and file creation, properties, and path retrieval. - Added unit tests for Setting model covering creation, unique constraints, and type enumeration. - Created unit tests for User model focusing on user creation, uniqueness, and group relationships. - Developed unit tests for Login service to validate login functionality, including 2FA and token generation. - Added utility tests for JWT creation and verification, ensuring token integrity and expiration handling. - Implemented password utility tests for password generation, hashing, and TOTP verification.
This commit is contained in:
@@ -15,7 +15,7 @@ from .user_authn import AuthnResponse, UserAuthn
|
||||
from .color import ThemeResponse
|
||||
|
||||
from .download import Download
|
||||
from .group import Group, GroupBase, GroupOptionsBase, GroupResponse
|
||||
from .group import Group, GroupBase, GroupOptions, GroupOptionsBase, GroupResponse
|
||||
from .node import Node
|
||||
from .object import (
|
||||
DirectoryCreateRequest,
|
||||
@@ -29,7 +29,7 @@ from .object import (
|
||||
PolicyResponse,
|
||||
)
|
||||
from .order import Order
|
||||
from .policy import Policy
|
||||
from .policy import Policy, PolicyType
|
||||
from .redeem import Redeem
|
||||
from .report import Report
|
||||
from .setting import Setting, SettingsType, SiteConfigResponse
|
||||
|
||||
@@ -197,6 +197,7 @@ class UUIDTableBase(TableBase):
|
||||
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
||||
"""override"""
|
||||
|
||||
@classmethod
|
||||
@override
|
||||
async def get_exist_one(cls: Type[T], session: AsyncSession, id: uuid.UUID, load: Union[Relationship, None] = None) -> T:
|
||||
return super().get_exist_one(session, id, load) # type: ignore
|
||||
async def get_exist_one(cls: type[T], session: AsyncSession, id: uuid.UUID, load: Union[Relationship, None] = None) -> T:
|
||||
return await super().get_exist_one(session, id, load) # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user