test+web: fix test suite and remove redundant privacy checkbox
All checks were successful
CI / test (push) Successful in 25s
All checks were successful
CI / test (push) Successful in 25s
This commit is contained in:
@@ -21,8 +21,11 @@ from app.main import app
|
|||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
async def reset_db() -> None:
|
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:
|
async with engine.begin() as conn:
|
||||||
await conn.run_sync(Base.metadata.drop_all)
|
|
||||||
await conn.run_sync(Base.metadata.create_all)
|
await conn.run_sync(Base.metadata.create_all)
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from app.auth.models import EmailVerificationToken
|
|||||||
async def test_register_verify_login_and_me(client, db_session):
|
async def test_register_verify_login_and_me(client, db_session):
|
||||||
register_payload = {
|
register_payload = {
|
||||||
"email": "alice@example.com",
|
"email": "alice@example.com",
|
||||||
|
"name": "Alice",
|
||||||
"username": "alice",
|
"username": "alice",
|
||||||
"password": "strongpass123",
|
"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):
|
async def test_refresh_token_rotation(client, db_session):
|
||||||
payload = {
|
payload = {
|
||||||
"email": "bob@example.com",
|
"email": "bob@example.com",
|
||||||
|
"name": "Bob",
|
||||||
"username": "bob",
|
"username": "bob",
|
||||||
"password": "strongpass123",
|
"password": "strongpass123",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:
|
async def _create_verified_user(client, db_session, email: str, username: str, password: str) -> dict:
|
||||||
await client.post(
|
await client.post(
|
||||||
"/api/v1/auth/register",
|
"/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()))
|
token_row = await db_session.execute(select(EmailVerificationToken).order_by(EmailVerificationToken.id.desc()))
|
||||||
verify_token = token_row.scalar_one().token
|
verify_token = token_row.scalar_one().token
|
||||||
|
|||||||
@@ -357,23 +357,6 @@ export function SettingsPanel({ open, onClose }: Props) {
|
|||||||
{savingPrivacy ? "Saving..." : "Save privacy settings"}
|
{savingPrivacy ? "Saving..." : "Save privacy settings"}
|
||||||
</button>
|
</button>
|
||||||
</section>
|
</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">
|
<section className="rounded border border-slate-700/70 bg-slate-800/50 p-3">
|
||||||
<div className="mb-2 flex items-center justify-between">
|
<div className="mb-2 flex items-center justify-between">
|
||||||
<p className="text-xs uppercase tracking-wide text-slate-400">Two-Factor Authentication</p>
|
<p className="text-xs uppercase tracking-wide text-slate-400">Two-Factor Authentication</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user