SHA256
refactor: 移除 SMTP 相关代码,简化用户创建流程,更新文档
This commit is contained in:
@@ -5,8 +5,8 @@ from unittest.mock import MagicMock
|
||||
import pytest
|
||||
from pydantic import HttpUrl, SecretStr
|
||||
|
||||
from tjhlp.config import GiteaConfig, LabelDef, SmtpConfig
|
||||
from tjhlp.models import CredentialRecord, MemberRecord, MemberRole
|
||||
from tjhlp.config import GiteaConfig, LabelDef
|
||||
from tjhlp.models import MemberRecord, MemberRole
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
@@ -24,22 +24,10 @@ def gitea_config(sample_labels: list[LabelDef]) -> GiteaConfig:
|
||||
token=SecretStr("test-token-12345"),
|
||||
email_domain="tongji.edu.cn",
|
||||
default_org="tjhlp-test",
|
||||
password_length=12,
|
||||
labels=sample_labels,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def smtp_config() -> SmtpConfig:
|
||||
return SmtpConfig(
|
||||
host="smtp.test.com",
|
||||
port=465,
|
||||
user="[email protected]",
|
||||
password=SecretStr("smtp-pass"),
|
||||
from_addr="Test <[email protected]>",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def sample_members() -> list[MemberRecord]:
|
||||
return [
|
||||
@@ -49,28 +37,6 @@ def sample_members() -> list[MemberRecord]:
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def sample_credentials() -> list[CredentialRecord]:
|
||||
return [
|
||||
CredentialRecord(
|
||||
id="2659999",
|
||||
name="赵一伤",
|
||||
role=MemberRole.STUDENT,
|
||||
username="2659999",
|
||||
password="xK9#mP2$vL4w",
|
||||
email="[email protected]",
|
||||
),
|
||||
CredentialRecord(
|
||||
id="10001",
|
||||
name="李四催",
|
||||
role=MemberRole.TA,
|
||||
username="10001",
|
||||
password="aB3$cD5&eF7h",
|
||||
email="[email protected]",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def mock_gitea_client() -> MagicMock:
|
||||
"""创建一个 mock GiteaClient, 可在各命令测试中复用"""
|
||||
|
||||
Reference in New Issue
Block a user