bump project

This commit is contained in:
2026-05-01 21:24:21 +03:30
parent dc4b1a1400
commit 139b3e26da
83 changed files with 2455 additions and 18349 deletions

49
tests/conftest.py Normal file
View File

@@ -0,0 +1,49 @@
from __future__ import annotations
import pytest
from app import create_app
from app.extensions import db
from app.models import Account, Role
@pytest.fixture()
def app():
app = create_app(
"testing",
{
"SECRET_KEY": "test-secret",
"SQLALCHEMY_DATABASE_URI": "sqlite:///:memory:",
},
)
with app.app_context():
db.create_all()
yield app
db.session.remove()
db.drop_all()
@pytest.fixture()
def client(app):
return app.test_client()
def create_account(username: str = "admin", role: str = Role.ADMIN.value) -> Account:
account = Account(
username=username,
email=f"{username}@example.com",
full_name=username.title(),
role=role,
)
account.set_password("Password12345")
db.session.add(account)
db.session.commit()
return account
def login(client, username: str = "admin", password: str = "Password12345"):
return client.post(
"/auth/login",
data={"username": username, "password": password},
follow_redirects=True,
)