##// END OF EJS Templates
deps: bumped jinja2==3.1.3 for security fix
deps: bumped jinja2==3.1.3 for security fix

File last commit:

r5608:6d33e504 default
r5627:4bd8cc5f default
Show More
test_vcs_operations_integrations_trigger.py
71 lines | 3.0 KiB | text/x-python | PythonLexer
/ rhodecode / tests / vcs_operations / test_vcs_operations_integrations_trigger.py
core: updated copyright to 2024
r5608 # Copyright (C) 2010-2024 RhodeCode GmbH
testing: added webhook tests and fixed tags adding
r4879 #
# 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/
"""
Test suite for making push/pull operations, on specially modified INI files
"""
import pytest
tests: fixed all tests for python3 BIG changes
r5087
testing: added webhook tests and fixed tags adding
r4879
from rhodecode.tests import GIT_REPO, HG_REPO
from rhodecode.tests.vcs_operations import Command, _add_files_and_push
tests: fixed all tests for python3 BIG changes
r5087 from rhodecode.tests.vcs_operations.conftest import check_httpbin_connection
testing: added webhook tests and fixed tags adding
r4879
connection_available = pytest.mark.skipif(
tests: fixed all tests for python3 BIG changes
r5087 not check_httpbin_connection(), reason="No outside internet connection available")
testing: added webhook tests and fixed tags adding
r4879
tests: fixed test suite for celery adoption
r5607 @pytest.mark.usefixtures(
"init_pyramid_app",
"repo_group_repos",
"disable_anonymous_user",
"disable_locking",
"enable_webhook_push_integration"
)
class TestVCSOperationsOnIntegrationsTrigger(object):
testing: added webhook tests and fixed tags adding
r4879
tests: fixed test suite for celery adoption
r5607 def test_push_with_webhook_hg(self, rcstack, tmpdir):
clone_url = rcstack.repo_clone_url(HG_REPO)
testing: added webhook tests and fixed tags adding
r4879
tests: fixed test suite for celery adoption
r5607 Command(tmpdir.strpath).execute('hg clone', clone_url, tmpdir.strpath)
testing: added webhook tests and fixed tags adding
r4879
tests: fixed test suite for celery adoption
r5607 push_url = rcstack.repo_clone_url(HG_REPO)
testing: added webhook tests and fixed tags adding
r4879 _add_files_and_push('hg', tmpdir.strpath, clone_url=push_url)
tests: fixed test suite for celery adoption
r5607 celery_log = open(rcstack.rcstack_data.celery_log).read()
assert 'ERROR' not in celery_log
assert "executing task TASK:<@task: rhodecode.integrations.types.webhook.post_to_webhook" in celery_log
assert "handling event repo-push with integration <rhodecode.integrations.types.webhook.WebhookIntegrationType" in celery_log
testing: added webhook tests and fixed tags adding
r4879
tests: fixed test suite for celery adoption
r5607 def test_push_with_webhook_git(self, rcstack, tmpdir):
clone_url = rcstack.repo_clone_url(GIT_REPO)
testing: added webhook tests and fixed tags adding
r4879
tests: fixed test suite for celery adoption
r5607 Command(tmpdir.strpath).execute('git clone', clone_url, tmpdir.strpath)
testing: added webhook tests and fixed tags adding
r4879
tests: fixed test suite for celery adoption
r5607 push_url = rcstack.repo_clone_url(GIT_REPO)
testing: added webhook tests and fixed tags adding
r4879 _add_files_and_push('git', tmpdir.strpath, clone_url=push_url)
tests: fixed test suite for celery adoption
r5607 celery_log = open(rcstack.rcstack_data.celery_log).read()
assert 'ERROR' not in celery_log
assert "executing task TASK:<@task: rhodecode.integrations.types.webhook.post_to_webhook" in celery_log
assert "handling event repo-push with integration <rhodecode.integrations.types.webhook.WebhookIntegrationType" in celery_log
@pytest.mark.xfail(reason='Lack of proper SVN support of cloning')
def test_push_with_webhook_svn(self, rcstack, tmpdir):
raise Exception('Not implemented')