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:
2025-12-19 19:48:05 +08:00
parent 51b6de921b
commit f93cb3eedb
60 changed files with 8189 additions and 117 deletions

View File

@@ -2,11 +2,18 @@ from fastapi import APIRouter, Depends
from middleware.auth import SignRequired
from models.response import ResponseBase
download_router = APIRouter(
prefix="/download",
tags=["download"]
)
aria2_router = APIRouter(
prefix="/aria2",
tags=["aria2"]
)
download_router.include_router(aria2_router)
@aria2_router.post(
path='/url',
summary='创建URL下载任务',
@@ -18,7 +25,7 @@ def router_aria2_url() -> ResponseBase:
Create a URL download task endpoint.
Returns:
ResponseModel: A model containing the response data for the URL download task.
ResponseBase: A model containing the response data for the URL download task.
"""
pass
@@ -36,7 +43,7 @@ def router_aria2_torrent(id: str) -> ResponseBase:
id (str): The ID of the torrent to download.
Returns:
ResponseModel: A model containing the response data for the torrent download task.
ResponseBase: A model containing the response data for the torrent download task.
"""
pass
@@ -54,7 +61,7 @@ def router_aria2_select(gid: str) -> ResponseBase:
gid (str): The GID of the download task.
Returns:
ResponseModel: A model containing the response data for the re-selection of files.
ResponseBase: A model containing the response data for the re-selection of files.
"""
pass
@@ -72,7 +79,7 @@ def router_aria2_delete(gid: str) -> ResponseBase:
gid (str): The GID of the download task to delete.
Returns:
ResponseModel: A model containing the response data for the deletion of the download task.
ResponseBase: A model containing the response data for the deletion of the download task.
"""
pass
@@ -87,7 +94,7 @@ def router_aria2_downloading() -> ResponseBase:
Get currently downloading tasks endpoint.
Returns:
ResponseModel: A model containing the response data for currently downloading tasks.
ResponseBase: A model containing the response data for currently downloading tasks.
"""
pass
@@ -102,6 +109,6 @@ def router_aria2_finished() -> ResponseBase:
Get finished tasks endpoint.
Returns:
ResponseModel: A model containing the response data for finished tasks.
ResponseBase: A model containing the response data for finished tasks.
"""
pass