You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
936 B
Python

1 year ago
import pytest
from flask_login.test_client import FlaskLoginClient
1 year ago
from htmx_contact import create_app
from htmx_contact.config import ContactSettings
from htmx_contact.models import User
1 year ago
@pytest.fixture()
def test_config():
return ContactSettings(SECRET_KEY=b"secrettestingvalue")
@pytest.fixture()
def test_user():
return User(id=1, primary_email="test", password="password", username="test")
@pytest.fixture()
def app(test_config):
app = create_app(config=test_config)
app.test_client_class = FlaskLoginClient
app.config.update(
{
"TESTING": True,
}
)
# other setup can go here
yield app
# clean up / reset resources here
@pytest.fixture()
def anynomous_client(app):
1 year ago
return app.test_client()
@pytest.fixture()
def client(app, test_user):
return app.test_client(user=test_user)
1 year ago
@pytest.fixture()
def runner(app):
return app.test_cli_runner()