jail2ban/tests/conftest.py

35 lines
593 B
Python
Raw Normal View History

2022-03-10 11:22:04 +01:00
import pytest
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:20:49 +01: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()
@pytest.fixture()
def valid_credentials():
return base64.b64encode(b"test.example.com:testpassword").decode("utf-8")