style: 项目重构

1.项目改名为kilostar(千星)
2.后端部分进行大规模重构
3.node功能进行大规模重新设计
This commit is contained in:
2026-05-11 15:29:16 +00:00
parent 2d8571dee3
commit ee9bbbf676
134 changed files with 2190 additions and 2503 deletions
+8 -8
View File
@@ -26,11 +26,11 @@ sys.modules["pydantic"] = mock_pydantic
sys.modules["sqlmodel"] = MagicMock()
sys.modules["passlib"] = MagicMock()
sys.modules["passlib.context"] = MagicMock()
sys.modules["pretor.core.database.table.user"] = MagicMock()
sys.modules["kilostar.core.database.table.user"] = MagicMock()
import pytest # noqa: E402
import jwt # noqa: E402
from pretor.utils.access import Accessor # noqa: E402
from kilostar.utils.access import Accessor # noqa: E402
def test_decode_token_success():
@@ -39,7 +39,7 @@ def test_decode_token_success():
payload = {"user_id": "123", "username": "testuser", "exp": 1234567890}
with patch("jwt.decode", return_value=payload) as mock_decode:
with patch("pretor.utils.access.TokenData") as mock_token_data_cls:
with patch("kilostar.utils.access.TokenData") as mock_token_data_cls:
mock_token_data_instance = MagicMock()
mock_token_data_cls.return_value = mock_token_data_instance
@@ -57,7 +57,7 @@ def test_decode_token_expired():
from fastapi import HTTPException
with patch("jwt.decode", side_effect=jwt.ExpiredSignatureError):
with patch("pretor.utils.access.HTTPException", HTTPException):
with patch("kilostar.utils.access.HTTPException", HTTPException):
with pytest.raises(HTTPException) as excinfo:
Accessor._decode_token(token)
@@ -72,7 +72,7 @@ def test_decode_token_invalid():
from fastapi import HTTPException
with patch("jwt.decode", side_effect=jwt.InvalidTokenError):
with patch("pretor.utils.access.HTTPException", HTTPException):
with patch("kilostar.utils.access.HTTPException", HTTPException):
with pytest.raises(HTTPException) as excinfo:
Accessor._decode_token(token)
@@ -88,9 +88,9 @@ def test_decode_token_validation_error():
from fastapi import HTTPException
with patch("jwt.decode", return_value=payload):
with patch("pretor.utils.access.TokenData", side_effect=MockValidationError):
with patch("pretor.utils.access.ValidationError", MockValidationError):
with patch("pretor.utils.access.HTTPException", HTTPException):
with patch("kilostar.utils.access.TokenData", side_effect=MockValidationError):
with patch("kilostar.utils.access.ValidationError", MockValidationError):
with patch("kilostar.utils.access.HTTPException", HTTPException):
with pytest.raises(HTTPException) as excinfo:
Accessor._decode_token(token)