test_vcs_operations_integrations_trigger.py
68 lines
| 2.8 KiB
| text/x-python
|
PythonLexer
r4879 | ||||
r5088 | # Copyright (C) 2010-2023 RhodeCode GmbH | |||
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 | ||||
.. important:: | ||||
You must have git >= 1.8.5 for tests to work fine. With 68b939b git started | ||||
to redirect things to stderr instead of stdout. | ||||
""" | ||||
import pytest | ||||
r5087 | ||||
r4879 | ||||
from rhodecode.tests import GIT_REPO, HG_REPO | ||||
from rhodecode.tests.vcs_operations import Command, _add_files_and_push | ||||
r5087 | from rhodecode.tests.vcs_operations.conftest import check_httpbin_connection | |||
r4879 | ||||
connection_available = pytest.mark.skipif( | ||||
r5087 | not check_httpbin_connection(), reason="No outside internet connection available") | |||
r4879 | ||||
@pytest.mark.usefixtures("baseapp", "enable_webhook_push_integration") | ||||
class TestVCSOperationsOnCustomIniConfig(object): | ||||
def test_push_with_webhook_hg(self, rc_web_server, tmpdir): | ||||
clone_url = rc_web_server.repo_clone_url(HG_REPO) | ||||
r5087 | Command('/tmp').execute('hg clone', clone_url, tmpdir.strpath) | |||
r4879 | ||||
push_url = rc_web_server.repo_clone_url(HG_REPO) | ||||
_add_files_and_push('hg', tmpdir.strpath, clone_url=push_url) | ||||
rc_log = rc_web_server.get_rc_log() | ||||
assert 'ERROR' not in rc_log | ||||
assert "executing task TASK:<@task: rhodecode.integrations.types.webhook.post_to_webhook" in rc_log | ||||
assert "handling event repo-push with integration <rhodecode.integrations.types.webhook.WebhookIntegrationType" in rc_log | ||||
r5087 | def test_push_with_webhook_git(self, rc_web_server, tmpdir): | |||
r4879 | clone_url = rc_web_server.repo_clone_url(GIT_REPO) | |||
r5087 | Command('/tmp').execute('git clone', clone_url, tmpdir.strpath) | |||
r4879 | ||||
push_url = rc_web_server.repo_clone_url(GIT_REPO) | ||||
_add_files_and_push('git', tmpdir.strpath, clone_url=push_url) | ||||
rc_log = rc_web_server.get_rc_log() | ||||
assert 'ERROR' not in rc_log | ||||
assert "executing task TASK:<@task: rhodecode.integrations.types.webhook.post_to_webhook" in rc_log | ||||
assert "handling event repo-push with integration <rhodecode.integrations.types.webhook.WebhookIntegrationType" in rc_log | ||||