"""Defines fixtures available to all tests."""
import logging

import pytest
from webtest import TestApp

from flaskapp.app import create_app


@pytest.fixture
def app():
    """Create application for the tests."""
    _app = create_app("flaskapp.settings.testing")
    _app.logger.setLevel(logging.CRITICAL)
    ctx = _app.test_request_context()
    ctx.push()
    yield _app
    ctx.pop()


@pytest.fixture
def testapp(app):
    """Create Webtest app."""
    return TestApp(app)
