test+web: fix test suite and remove redundant privacy checkbox
All checks were successful
CI / test (push) Successful in 25s

This commit is contained in:
2026-03-08 12:16:21 +03:00
parent 79baadb522
commit fc7a9cc3a6
4 changed files with 7 additions and 19 deletions

View File

@@ -21,8 +21,11 @@ from app.main import app
@pytest.fixture(autouse=True)
async def reset_db() -> None:
await engine.dispose()
test_db_path = PROJECT_ROOT / "test.db"
if test_db_path.exists():
test_db_path.unlink()
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.drop_all)
await conn.run_sync(Base.metadata.create_all)
yield

View File

@@ -6,6 +6,7 @@ from app.auth.models import EmailVerificationToken
async def test_register_verify_login_and_me(client, db_session):
register_payload = {
"email": "alice@example.com",
"name": "Alice",
"username": "alice",
"password": "strongpass123",
}
@@ -46,6 +47,7 @@ async def test_register_verify_login_and_me(client, db_session):
async def test_refresh_token_rotation(client, db_session):
payload = {
"email": "bob@example.com",
"name": "Bob",
"username": "bob",
"password": "strongpass123",
}

View File

@@ -7,7 +7,7 @@ from app.chats.models import ChatType
async def _create_verified_user(client, db_session, email: str, username: str, password: str) -> dict:
await client.post(
"/api/v1/auth/register",
json={"email": email, "username": username, "password": password},
json={"email": email, "name": username, "username": username, "password": password},
)
token_row = await db_session.execute(select(EmailVerificationToken).order_by(EmailVerificationToken.id.desc()))
verify_token = token_row.scalar_one().token

View File

@@ -357,23 +357,6 @@ export function SettingsPanel({ open, onClose }: Props) {
{savingPrivacy ? "Saving..." : "Save privacy settings"}
</button>
</section>
<section className="rounded border border-slate-700/70 bg-slate-800/50 p-3">
<CheckboxOption
checked={allowPrivateMessages}
label="Who can send me messages? (Everybody)"
onChange={async (checked) => {
setAllowPrivateMessages(checked);
setSavingPrivacy(true);
try {
const updated = await updateMyProfile({ allow_private_messages: checked });
useAuthStore.setState({ me: updated as AuthUser });
} finally {
setSavingPrivacy(false);
}
}}
disabled={savingPrivacy}
/>
</section>
<section className="rounded border border-slate-700/70 bg-slate-800/50 p-3">
<div className="mb-2 flex items-center justify-between">
<p className="text-xs uppercase tracking-wide text-slate-400">Two-Factor Authentication</p>