##// END OF EJS Templates
tests: Add test to check the link to the shadow repo of a PR.
Martin Bornhold -
r1047:f58888bc default
parent child Browse files
Show More
@@ -912,6 +912,35 b' class TestPullrequestsController:'
912 response.mustcontain(
912 response.mustcontain(
913 "<script>alert('Hi!')</script>")
913 "<script>alert('Hi!')</script>")
914
914
915 @pytest.mark.parametrize('mergeable', [True, False])
916 def test_shadow_repository_link(
917 self, mergeable, pr_util, http_host_stub):
918 """
919 Check that the pull request summary page displays a link to the shadow
920 repository if the pull request is mergeable. If it is not mergeable
921 the link should not be displayed.
922 """
923 pull_request = pr_util.create_pull_request(
924 mergeable=mergeable, enable_notifications=False)
925 target_repo = pull_request.target_repo.scm_instance()
926 pr_id = pull_request.pull_request_id
927 shadow_url = '{host}/{repo}/pull-request/{pr_id}/repository'.format(
928 host=http_host_stub, repo=target_repo.name, pr_id=pr_id)
929
930 response = self.app.get(url(
931 controller='pullrequests', action='show',
932 repo_name=target_repo.name,
933 pull_request_id=str(pr_id)))
934
935 assertr = AssertResponse(response)
936 if mergeable:
937 assertr.element_value_contains(
938 'div.pr-mergeinfo input', shadow_url)
939 assertr.element_value_contains(
940 'div.pr-mergeinfo input', 'pr-merge')
941 else:
942 assertr.no_element_exists('div.pr-mergeinfo')
943
915
944
916 def assert_pull_request_status(pull_request, expected_status):
945 def assert_pull_request_status(pull_request, expected_status):
917 status = ChangesetStatusModel().calculated_review_status(
946 status = ChangesetStatusModel().calculated_review_status(
General Comments 0
You need to be logged in to leave comments. Login now