Files
devops/test.py
gitea fcd328ca2b
Some checks failed
Build and Deploy Demo App / test (push) Failing after 1m14s
Build and Deploy Demo App / build (push) Has been skipped
Build and Deploy Demo App / scan (push) Has been skipped
Build and Deploy Demo App / deploy (push) Has been skipped
Improved Application/DB
2025-11-26 11:03:01 +03:30

25 lines
665 B
Python

import pytest
from app import app, db
from models import Feature
@pytest.fixture
def client():
app.config['TESTING'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:' # In-memory DB for tests
with app.test_client() as client:
with app.app_context():
db.create_all()
yield client
db.drop_all()
def test_index(client):
response = client.get('/')
assert response.status_code == 200
assert b'Professional Demo Site' in response.data
def test_seed_db(client):
with app.app_context():
db.create_all()
Feature.seed_db()
assert Feature.query.count() == 3