# Copyright (C) 2010-2024 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/

import pytest
from rhodecode.tests.utils import CustomTestApp
from rhodecode.tests.fixtures.fixture_utils import plain_http_environ, plain_config_stub, plain_request_stub


@pytest.fixture(scope='module')
def module_request_stub():
    return plain_request_stub()


@pytest.fixture(scope='module')
def module_config_stub(request, module_request_stub):
    return plain_config_stub(request, module_request_stub)


@pytest.fixture(scope='module')
def module_http_environ():
    """
    HTTP extra environ keys.

    Used by the test application and as well for setting up the pylons
    environment. In the case of the fixture "app" it should be possible
    to override this for a specific test case.
    """
    return plain_http_environ()


@pytest.fixture(scope='module')
def module_app(request, module_config_stub, module_http_environ, baseapp):
    app = CustomTestApp(baseapp, extra_environ=module_http_environ)
    return app