##// END OF EJS Templates
tests: fixed test suite for celery adoption
tests: fixed test suite for celery adoption

File last commit:

r5607:39b20522 default
r5607:39b20522 default
Show More
function_scoped_baseapp.py
52 lines | 1.8 KiB | text/x-python | PythonLexer
/ rhodecode / tests / fixtures / function_scoped_baseapp.py
tests: fixed test suite for celery adoption
r5607 # 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='function')
def request_stub():
return plain_request_stub()
@pytest.fixture(scope='function')
def config_stub(request, request_stub):
return plain_config_stub(request, request_stub)
@pytest.fixture(scope='function')
def 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='function')
def app(request, config_stub, http_environ, baseapp):
app = CustomTestApp(baseapp, extra_environ=http_environ)
if request.cls:
# inject app into a class that uses this fixtures
request.cls.app = app
return app