jail2ban/tests/conftest.py

35 lines
593 B
Python
Raw Permalink Normal View History

2022-03-10 11:22:04 +01:00
import pytest
2022-03-14 15:41:45 +00:00
import base64
2022-03-10 11:22:04 +01:00
from jail2ban import create_app
@pytest.fixture()
def app():
app = create_app()
app.config.update({
"TESTING": True,
"SECRET_KEY": 'Testing',
2022-03-14 15:41:45 +00:00
"AUTHFILE": '../tests/users-test.txt'
2022-03-10 11:22:04 +01:00
})
# other setup can go here
yield app
# clean up / reset resources here
@pytest.fixture()
def client(app):
return app.test_client()
@pytest.fixture()
def runner(app):
return app.test_cli_runner()
2022-03-14 15:41:45 +00:00
@pytest.fixture()
def valid_credentials():
return base64.b64encode(b"test.example.com:testpassword").decode("utf-8")