# HG changeset patch # User Mads Kiilerich # Date 1478790641 -3600 # Node ID 699f432b62fb4e8f78068ea1148be40d0247e22c # Parent 9bd331004a650008dae002934424821b70eed5ee tests: update pull request tests to actually test real pull request creation diff -r 9bd331004a65 -r 699f432b62fb kallithea/tests/functional/test_compare.py --- a/kallithea/tests/functional/test_compare.py Thu Nov 10 16:10:41 2016 +0100 +++ b/kallithea/tests/functional/test_compare.py Thu Nov 10 16:10:41 2016 +0100 @@ -467,7 +467,6 @@ self.r2_id = repo2.repo_id r2_name = repo2.repo_name - cs1 = fixture.commit_change(repo=r2_name, filename='file1-fork', content='file1-line1-from-fork', message='commit1-fork', vcs_type='hg', parent=repo2.scm_instance[-1], newfile=True) @@ -486,9 +485,9 @@ response = self.app.get(url('compare_url', repo_name=r2_name, org_ref_type="branch", - org_ref_name=rev1, + org_ref_name=rev2, other_ref_type="branch", - other_ref_name=rev2, + other_ref_name=rev1, other_repo=r1_name, merge='1',)) @@ -507,9 +506,9 @@ response = self.app.get(url('compare_url', repo_name=r2_name, org_ref_type="branch", - org_ref_name=rev1, + org_ref_name=rev2, other_ref_type="branch", - other_ref_name=rev2, + other_ref_name=rev1, other_repo=r1_name, merge='1', )) diff -r 9bd331004a65 -r 699f432b62fb kallithea/tests/functional/test_pullrequests.py --- a/kallithea/tests/functional/test_pullrequests.py Thu Nov 10 16:10:41 2016 +0100 +++ b/kallithea/tests/functional/test_pullrequests.py Thu Nov 10 16:10:41 2016 +0100 @@ -21,9 +21,9 @@ response = self.app.post(url(controller='pullrequests', action='create', repo_name=HG_REPO), {'org_repo': HG_REPO, - 'org_ref': 'branch:default:default', + 'org_ref': 'branch:stable:4f7e2131323e0749a740c0a56ab68ae9269c562a', 'other_repo': HG_REPO, - 'other_ref': 'branch:default:default', + 'other_ref': 'branch:default:96507bd11ecc815ebc6270fdf6db110928c09c1e', 'pullrequest_title': 'title', 'pullrequest_desc': 'description', '_authentication_token': self.authentication_token(), @@ -31,7 +31,47 @@ status=302) response = response.follow() assert response.status == '200 OK' - response.mustcontain('This pull request has already been merged to default.') + response.mustcontain('Successfully opened new pull request') + response.mustcontain('No additional changesets found for iterating on this pull request') + response.mustcontain('href="/vcs_test_hg/changeset/4f7e2131323e0749a740c0a56ab68ae9269c562a"') + + def test_available(self): + self.log_user() + response = self.app.post(url(controller='pullrequests', action='create', + repo_name=HG_REPO), + {'org_repo': HG_REPO, + 'org_ref': 'rev:94f45ed825a1:94f45ed825a113e61af7e141f44ca578374abef0', + 'other_repo': HG_REPO, + 'other_ref': 'branch:default:96507bd11ecc815ebc6270fdf6db110928c09c1e', + 'pullrequest_title': 'title', + 'pullrequest_desc': 'description', + '_authentication_token': self.authentication_token(), + }, + status=302) + response = response.follow() + assert response.status == '200 OK' + response.mustcontain(no='No additional changesets found for iterating on this pull request') + response.mustcontain('The following additional changes are available on stable:') + response.mustcontain('') + response.mustcontain('href="/vcs_test_hg/changeset/4f7e2131323e0749a740c0a56ab68ae9269c562a"') # as update + + def test_range(self): + self.log_user() + response = self.app.post(url(controller='pullrequests', action='create', + repo_name=HG_REPO), + {'org_repo': HG_REPO, + 'org_ref': 'branch:stable:4f7e2131323e0749a740c0a56ab68ae9269c562a', + 'other_repo': HG_REPO, + 'other_ref': 'rev:94f45ed825a1:94f45ed825a113e61af7e141f44ca578374abef0', + 'pullrequest_title': 'title', + 'pullrequest_desc': 'description', + '_authentication_token': self.authentication_token(), + }, + status=302) + response = response.follow() + assert response.status == '200 OK' + response.mustcontain('No additional changesets found for iterating on this pull request') + response.mustcontain('href="/vcs_test_hg/changeset/4f7e2131323e0749a740c0a56ab68ae9269c562a"') def test_update_reviewers(self): self.log_user() @@ -43,22 +83,22 @@ response = self.app.post(url(controller='pullrequests', action='create', repo_name=HG_REPO), {'org_repo': HG_REPO, - 'org_ref': 'branch:default:default', + 'org_ref': 'rev:94f45ed825a1:94f45ed825a113e61af7e141f44ca578374abef0', 'other_repo': HG_REPO, - 'other_ref': 'branch:default:default', + 'other_ref': 'branch:default:96507bd11ecc815ebc6270fdf6db110928c09c1e', 'pullrequest_title': 'title', 'pullrequest_desc': 'description', '_authentication_token': self.authentication_token(), }, status=302) pull_request1_id = re.search('/pull-request/(\d+)/', response.location).group(1) - assert response.location == 'http://localhost/%s/pull-request/%s/_/title' % (HG_REPO, pull_request1_id) + assert response.location == 'http://localhost/%s/pull-request/%s/_/stable' % (HG_REPO, pull_request1_id) # create new iteration response = self.app.post(url(controller='pullrequests', action='post', repo_name=HG_REPO, pull_request_id=pull_request1_id), { - 'updaterev': 'default', + 'updaterev': '4f7e2131323e0749a740c0a56ab68ae9269c562a', 'pullrequest_title': 'title', 'pullrequest_desc': 'description', 'owner': TEST_USER_ADMIN_LOGIN, @@ -68,7 +108,7 @@ status=302) pull_request2_id = re.search('/pull-request/(\d+)/', response.location).group(1) assert pull_request2_id != pull_request1_id - assert response.location == 'http://localhost/%s/pull-request/%s/_/title_v2' % (HG_REPO, pull_request2_id) + assert response.location == 'http://localhost/%s/pull-request/%s/_/stable' % (HG_REPO, pull_request2_id) response = response.follow() # verify reviewer was added response.mustcontain('' % regular_user.user_id) @@ -85,7 +125,7 @@ 'review_members': [regular_user2.user_id, admin_user.user_id], }, status=302) - assert response.location == 'http://localhost/%s/pull-request/%s/_/Title' % (HG_REPO, pull_request2_id) + assert response.location == 'http://localhost/%s/pull-request/%s/_/stable' % (HG_REPO, pull_request2_id) response = response.follow() # verify reviewers were added / removed response.mustcontain('Meanwhile, the following reviewers have been added: test_regular') @@ -102,9 +142,9 @@ repo_name=HG_REPO), { 'org_repo': HG_REPO, - 'org_ref': 'branch:default:default', + 'org_ref': 'rev:94f45ed825a1:94f45ed825a113e61af7e141f44ca578374abef0', 'other_repo': HG_REPO, - 'other_ref': 'branch:default:default', + 'other_ref': 'branch:default:96507bd11ecc815ebc6270fdf6db110928c09c1e', 'pullrequest_title': 'title', 'pullrequest_desc': 'description', '_authentication_token': self.authentication_token(), @@ -120,7 +160,7 @@ response = self.app.post(url(controller='pullrequests', action='post', repo_name=HG_REPO, pull_request_id=pull_request_id), { - 'updaterev': 'default', + 'updaterev': '4f7e2131323e0749a740c0a56ab68ae9269c562a', 'pullrequest_title': 'title', 'pullrequest_desc': 'description', 'owner': TEST_USER_ADMIN_LOGIN, @@ -138,9 +178,9 @@ repo_name=HG_REPO), { 'org_repo': HG_REPO, - 'org_ref': 'branch:default:default', + 'org_ref': 'branch:stable:4f7e2131323e0749a740c0a56ab68ae9269c562a', 'other_repo': HG_REPO, - 'other_ref': 'branch:default:default', + 'other_ref': 'branch:default:96507bd11ecc815ebc6270fdf6db110928c09c1e', 'pullrequest_title': 'title', 'pullrequest_desc': 'description', '_authentication_token': self.authentication_token(),