feature: adds tests if a new checkbox is shown for CE and EE

This commit is contained in:
ievgenii vdovenko 2025-06-25 17:16:34 +02:00
parent c591138dd0
commit fcec7f0bbc
2 changed files with 65 additions and 1 deletions

View file

@ -45,7 +45,7 @@ from rhodecode.tests import (
TEST_USER_ADMIN_LOGIN,
TEST_USER_REGULAR_LOGIN,
)
from rhodecode.tests.fixtures.fixture_utils import PRTestUtility, Backend
from rhodecode.tests.fixtures.fixture_utils import PRTestUtility, Backend, temporary_settings
from rhodecode.tests.routes import route_path
@ -855,6 +855,56 @@ class TestPullrequestsView(object):
)
assert response.status_int == 403
def test_new_pull_request_view_close_branch_before_merging_setting_present_for_ee(
self, backend, pr_util, xhr_header, baseapp
):
with temporary_settings(baseapp, **{"rhodecode.edition_id": "EE"}):
response = self.app.get(route_path("pullrequest_new", repo_name=backend.repo_name), status=200)
assert_response = response.assert_response()
assert_response.one_element_exists("#close_branch_before_merging")
def test_new_pull_request_view_close_branch_before_merging_setting_not_present_for_ce(
self, backend, pr_util, xhr_header, baseapp
):
response = self.app.get(route_path("pullrequest_new", repo_name=backend.repo_name), status=200)
assert_response = response.assert_response()
assert_response.no_element_exists("#close_branch_before_merging")
def test_show_pull_request_view_close_branch_before_merging_setting_present_for_ee(
self, backend, pr_util, xhr_header, baseapp
):
with temporary_settings(baseapp, **{"rhodecode.edition_id": "EE"}):
pull_request = pr_util.create_pull_request(mergeable=True, enable_notifications=False)
response = self.app.get(
route_path(
"pullrequest_show",
repo_name=pull_request.target_repo.scm_instance().name,
pull_request_id=pull_request.pull_request_id,
)
)
assert_response = response.assert_response()
assert_response.one_element_exists("#close_branch_before_merging")
def test_show_pull_request_view_close_branch_before_merging_setting_not_present_for_ce(
self, backend, pr_util, xhr_header, baseapp
):
pull_request = pr_util.create_pull_request(mergeable=True, enable_notifications=False)
response = self.app.get(
route_path(
"pullrequest_show",
repo_name=pull_request.target_repo.scm_instance().name,
pull_request_id=pull_request.pull_request_id,
)
)
assert_response = response.assert_response()
assert_response.no_element_exists("#close_branch_before_merging")
def test_create_pull_request_user_set_test_create_pull_request_to_true(self, backend, csrf_token):
commits = [
{"message": "ancestor"},