Add first info to landing page

This commit is contained in:
2025-10-23 12:35:52 +02:00
parent f6e69b1521
commit 81929cca21
11 changed files with 186 additions and 57 deletions

View File

@@ -1,35 +1,16 @@
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from allmende_payment_system.models import Account, Base, User
from allmende_payment_system.models import Account, User
# Create an in-memory SQLite database
@pytest.fixture
def in_memory_db():
engine = create_engine("sqlite:///:memory:")
Base.metadata.create_all(bind=engine) # Create tables
TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
# Provide a session and the engine
db = TestingSessionLocal()
try:
yield db
finally:
db.close()
def test_user_model(in_memory_db):
def test_user_model(test_db):
user = User(username="test", display_name="Test User")
in_memory_db.add(user)
in_memory_db.commit()
test_db.add(user)
test_db.commit()
assert user.id is not None
account = Account(name="Test Account")
account.users.append(user)
in_memory_db.add(account)
in_memory_db.commit()
test_db.add(account)
test_db.commit()
assert len(user.accounts) == 1