##// END OF EJS Templates
tests: move vcs_operations into its own module.
marcink -
r2456:db312489 default
parent child Browse files
Show More
@@ -0,0 +1,244 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2017 RhodeCode GmbH
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
21 import os
22
23 import pytest
24
25 from rhodecode.lib.vcs.backends.git.repository import GitRepository
26 from rhodecode.lib.vcs.backends.hg.repository import MercurialRepository
27 from rhodecode.lib.vcs.nodes import FileNode
28 from rhodecode.model.meta import Session
29
30 from rhodecode.tests.vcs_operations import (
31 Command, _check_proper_clone, _check_proper_git_push, _check_proper_hg_push)
32
33
34 @pytest.mark.usefixtures("disable_locking")
35 class TestVCSOperationsSpecial(object):
36
37 def test_git_sets_default_branch_if_not_master(
38 self, backend_git, tmpdir, rc_web_server):
39 empty_repo = backend_git.create_repo()
40 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
41
42 cmd = Command(tmpdir.strpath)
43 cmd.execute('git clone', clone_url)
44
45 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
46 repo.in_memory_commit.add(FileNode('file', content=''))
47 repo.in_memory_commit.commit(
48 message='Commit on branch test',
49 author='Automatic test',
50 branch='test')
51
52 repo_cmd = Command(repo.path)
53 stdout, stderr = repo_cmd.execute('git push --verbose origin test')
54 _check_proper_git_push(
55 stdout, stderr, branch='test', should_set_default_branch=True)
56
57 stdout, stderr = cmd.execute(
58 'git clone', clone_url, empty_repo.repo_name + '-clone')
59 _check_proper_clone(stdout, stderr, 'git')
60
61 # Doing an explicit commit in order to get latest user logs on MySQL
62 Session().commit()
63
64 # def test_git_fetches_from_remote_repository_with_annotated_tags(
65 # self, backend_git, rc_web_server):
66 # # Note: This is a test specific to the git backend. It checks the
67 # # integration of fetching from a remote repository which contains
68 # # annotated tags.
69 #
70 # # Dulwich shows this specific behavior only when
71 # # operating against a remote repository.
72 # source_repo = backend_git['annotated-tag']
73 # target_vcs_repo = backend_git.create_repo().scm_instance()
74 # target_vcs_repo.fetch(rc_web_server.repo_clone_url(source_repo.repo_name))
75
76 def test_git_push_shows_pull_request_refs(self, backend_git, rc_web_server, tmpdir):
77 """
78 test if remote info about refs is visible
79 """
80 empty_repo = backend_git.create_repo()
81
82 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
83
84 cmd = Command(tmpdir.strpath)
85 cmd.execute('git clone', clone_url)
86
87 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
88 repo.in_memory_commit.add(FileNode('readme.md', content='## Hello'))
89 repo.in_memory_commit.commit(
90 message='Commit on branch Master',
91 author='Automatic test',
92 branch='master')
93
94 repo_cmd = Command(repo.path)
95 stdout, stderr = repo_cmd.execute('git push --verbose origin master')
96 _check_proper_git_push(stdout, stderr, branch='master')
97
98 ref = '{}/{}/pull-request/new?branch=master'.format(
99 rc_web_server.host_url(), empty_repo.repo_name)
100 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stderr
101 assert 'remote: RhodeCode: push completed' in stderr
102
103 # push on the same branch
104 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
105 repo.in_memory_commit.add(FileNode('setup.py', content='print\n'))
106 repo.in_memory_commit.commit(
107 message='Commit2 on branch Master',
108 author='Automatic test2',
109 branch='master')
110
111 repo_cmd = Command(repo.path)
112 stdout, stderr = repo_cmd.execute('git push --verbose origin master')
113 _check_proper_git_push(stdout, stderr, branch='master')
114
115 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stderr
116 assert 'remote: RhodeCode: push completed' in stderr
117
118 # new Branch
119 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
120 repo.in_memory_commit.add(FileNode('feature1.py', content='## Hello world'))
121 repo.in_memory_commit.commit(
122 message='Commit on branch feature',
123 author='Automatic test',
124 branch='feature')
125
126 repo_cmd = Command(repo.path)
127 stdout, stderr = repo_cmd.execute('git push --verbose origin feature')
128 _check_proper_git_push(stdout, stderr, branch='feature')
129
130 ref = '{}/{}/pull-request/new?branch=feature'.format(
131 rc_web_server.host_url(), empty_repo.repo_name)
132 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stderr
133 assert 'remote: RhodeCode: push completed' in stderr
134
135 def test_hg_push_shows_pull_request_refs(self, backend_hg, rc_web_server, tmpdir):
136 empty_repo = backend_hg.create_repo()
137
138 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
139
140 cmd = Command(tmpdir.strpath)
141 cmd.execute('hg clone', clone_url)
142
143 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
144 repo.in_memory_commit.add(FileNode(u'readme.md', content=u'## Hello'))
145 repo.in_memory_commit.commit(
146 message=u'Commit on branch default',
147 author=u'Automatic test',
148 branch='default')
149
150 repo_cmd = Command(repo.path)
151 repo_cmd.execute('hg checkout default')
152
153 stdout, stderr = repo_cmd.execute('hg push --verbose', clone_url)
154 _check_proper_hg_push(stdout, stderr, branch='default')
155
156 ref = '{}/{}/pull-request/new?branch=default'.format(
157 rc_web_server.host_url(), empty_repo.repo_name)
158 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
159 assert 'remote: RhodeCode: push completed' in stdout
160
161 # push on the same branch
162 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
163 repo.in_memory_commit.add(FileNode(u'setup.py', content=u'print\n'))
164 repo.in_memory_commit.commit(
165 message=u'Commit2 on branch default',
166 author=u'Automatic test2',
167 branch=u'default')
168
169 repo_cmd = Command(repo.path)
170 repo_cmd.execute('hg checkout default')
171
172 stdout, stderr = repo_cmd.execute('hg push --verbose', clone_url)
173 _check_proper_hg_push(stdout, stderr, branch='default')
174
175 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
176 assert 'remote: RhodeCode: push completed' in stdout
177
178 # new Branch
179 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
180 repo.in_memory_commit.add(FileNode(u'feature1.py', content=u'## Hello world'))
181 repo.in_memory_commit.commit(
182 message=u'Commit on branch feature',
183 author=u'Automatic test',
184 branch=u'feature')
185
186 repo_cmd = Command(repo.path)
187 repo_cmd.execute('hg checkout feature')
188
189 stdout, stderr = repo_cmd.execute('hg push --new-branch --verbose', clone_url)
190 _check_proper_hg_push(stdout, stderr, branch='feature')
191
192 ref = '{}/{}/pull-request/new?branch=feature'.format(
193 rc_web_server.host_url(), empty_repo.repo_name)
194 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
195 assert 'remote: RhodeCode: push completed' in stdout
196
197 def test_hg_push_shows_pull_request_refs_book(self, backend_hg, rc_web_server, tmpdir):
198 empty_repo = backend_hg.create_repo()
199
200 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
201
202 cmd = Command(tmpdir.strpath)
203 cmd.execute('hg clone', clone_url)
204
205 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
206 repo.in_memory_commit.add(FileNode(u'readme.md', content=u'## Hello'))
207 repo.in_memory_commit.commit(
208 message=u'Commit on branch default',
209 author=u'Automatic test',
210 branch='default')
211
212 repo_cmd = Command(repo.path)
213 repo_cmd.execute('hg checkout default')
214
215 stdout, stderr = repo_cmd.execute('hg push --verbose', clone_url)
216 _check_proper_hg_push(stdout, stderr, branch='default')
217
218 ref = '{}/{}/pull-request/new?branch=default'.format(
219 rc_web_server.host_url(), empty_repo.repo_name)
220 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
221 assert 'remote: RhodeCode: push completed' in stdout
222
223 # add bookmark
224 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
225 repo.in_memory_commit.add(FileNode(u'setup.py', content=u'print\n'))
226 repo.in_memory_commit.commit(
227 message=u'Commit2 on branch default',
228 author=u'Automatic test2',
229 branch=u'default')
230
231 repo_cmd = Command(repo.path)
232 repo_cmd.execute('hg checkout default')
233 repo_cmd.execute('hg bookmark feature2')
234 stdout, stderr = repo_cmd.execute('hg push -B feature2 --verbose', clone_url)
235 _check_proper_hg_push(stdout, stderr, branch='default')
236
237 ref = '{}/{}/pull-request/new?branch=default'.format(
238 rc_web_server.host_url(), empty_repo.repo_name)
239 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
240 ref = '{}/{}/pull-request/new?bookmark=feature2'.format(
241 rc_web_server.host_url(), empty_repo.repo_name)
242 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
243 assert 'remote: RhodeCode: push completed' in stdout
244 assert 'exporting bookmark feature2' in stdout
@@ -20,23 +20,21 b''
20 20
21 21 import os
22 22 import json
23 import time
23 24 import platform
24 25 import socket
25 26 import tempfile
27 import subprocess32
26 28
27 import subprocess32
28 import time
29 29 from urllib2 import urlopen, URLError
30 30
31 31 import configobj
32 32 import pytest
33 33
34 import pyramid.paster
35 34
36 35 from rhodecode.lib.pyramid_utils import get_app_config
37 36 from rhodecode.tests.fixture import TestINI
38 import rhodecode
39 from rhodecode.tests.other.vcs_operations.conftest import get_host_url, get_port
37 from rhodecode.tests.vcs_operations.conftest import get_host_url, get_port
40 38
41 39 VCSSERVER_LOG = os.path.join(tempfile.gettempdir(), 'rc-vcsserver.log')
42 40
@@ -31,6 +31,11 b' from rhodecode.tests import get_new_dir'
31 31 from rhodecode.tests.utils import check_skip_backends, check_xfail_backends
32 32
33 33
34 @pytest.fixture(scope="session")
35 def vcs_server_config_override():
36 return ({'server:main': {'workers': 1}},)
37
38
34 39 @pytest.fixture()
35 40 def vcs_repository_support(
36 41 request, backend_alias, baseapp, _vcs_repo_container):
1 NO CONTENT: file renamed from rhodecode/tests/other/vcs_operations/__init__.py to rhodecode/tests/vcs_operations/__init__.py
@@ -141,6 +141,11 b' def repos(request, baseapp):'
141 141 fixture.destroy_repo_group(repo_group_id)
142 142
143 143
144 @pytest.fixture(scope="session")
145 def vcs_server_config_override():
146 return ({'server:main': {'workers': 2}},)
147
148
144 149 @pytest.fixture(scope="module")
145 150 def rc_web_server_config(testini_factory):
146 151 """
@@ -30,7 +30,7 b' Test suite for making push/pull operatio'
30 30 import pytest
31 31
32 32 from rhodecode.tests import (GIT_REPO, HG_REPO)
33 from rhodecode.tests.other.vcs_operations import Command
33 from rhodecode.tests.vcs_operations import Command
34 34
35 35
36 36 # override rc_web_server_config fixture with custom INI
@@ -30,7 +30,7 b' Test suite for making push/pull operatio'
30 30 import pytest
31 31
32 32 from rhodecode.tests import (GIT_REPO, HG_REPO)
33 from rhodecode.tests.other.vcs_operations import Command
33 from rhodecode.tests.vcs_operations import Command
34 34
35 35
36 36 # override rc_web_server_config fixture with custom INI
@@ -30,7 +30,7 b' Test suite for making push/pull operatio'
30 30 import pytest
31 31
32 32 from rhodecode.tests import (GIT_REPO, HG_REPO)
33 from rhodecode.tests.other.vcs_operations import Command
33 from rhodecode.tests.vcs_operations import Command
34 34
35 35
36 36 # override rc_web_server_config fixture with custom INI
@@ -33,7 +33,7 b' import pytest'
33 33 from rhodecode.lib.vcs.backends.git.repository import GitRepository
34 34 from rhodecode.lib.vcs.nodes import FileNode
35 35 from rhodecode.tests import GIT_REPO
36 from rhodecode.tests.other.vcs_operations import Command
36 from rhodecode.tests.vcs_operations import Command
37 37 from .test_vcs_operations import _check_proper_clone, _check_proper_git_push
38 38
39 39
@@ -28,14 +28,10 b' Test suite for making push/pull operatio'
28 28 """
29 29
30 30
31 import os
32 31 import time
33 32
34 33 import pytest
35 34
36 from rhodecode.lib.vcs.backends.git.repository import GitRepository
37 from rhodecode.lib.vcs.backends.hg.repository import MercurialRepository
38 from rhodecode.lib.vcs.nodes import FileNode
39 35 from rhodecode.model.auth_token import AuthTokenModel
40 36 from rhodecode.model.db import Repository, UserIpMap, CacheKey
41 37 from rhodecode.model.meta import Session
@@ -43,15 +39,9 b' from rhodecode.model.repo import RepoMod'
43 39 from rhodecode.model.user import UserModel
44 40 from rhodecode.tests import (GIT_REPO, HG_REPO, TEST_USER_ADMIN_LOGIN)
45 41
46 from rhodecode.tests.other.vcs_operations import (
42 from rhodecode.tests.vcs_operations import (
47 43 Command, _check_proper_clone, _check_proper_git_push,
48 _check_proper_hg_push, _add_files_and_push,
49 HG_REPO_WITH_GROUP, GIT_REPO_WITH_GROUP)
50
51
52 @pytest.fixture(scope="session")
53 def vcs_server_config_override():
54 return ({'server:main': {'workers': 2}},)
44 _add_files_and_push, HG_REPO_WITH_GROUP, GIT_REPO_WITH_GROUP)
55 45
56 46
57 47 @pytest.mark.usefixtures("disable_locking", "disable_anonymous_user")
@@ -468,215 +458,3 b' class TestVCSOperations(object):'
468 458 'hg clone', clone_url, tmpdir.strpath)
469 459 assert 'abort: authorization failed' in stderr
470 460
471
472 @pytest.mark.usefixtures("disable_locking")
473 class TestVCSOperationsSpecial(object):
474
475 def test_git_sets_default_branch_if_not_master(
476 self, backend_git, tmpdir, rc_web_server):
477 empty_repo = backend_git.create_repo()
478 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
479
480 cmd = Command(tmpdir.strpath)
481 cmd.execute('git clone', clone_url)
482
483 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
484 repo.in_memory_commit.add(FileNode('file', content=''))
485 repo.in_memory_commit.commit(
486 message='Commit on branch test',
487 author='Automatic test',
488 branch='test')
489
490 repo_cmd = Command(repo.path)
491 stdout, stderr = repo_cmd.execute('git push --verbose origin test')
492 _check_proper_git_push(
493 stdout, stderr, branch='test', should_set_default_branch=True)
494
495 stdout, stderr = cmd.execute(
496 'git clone', clone_url, empty_repo.repo_name + '-clone')
497 _check_proper_clone(stdout, stderr, 'git')
498
499 # Doing an explicit commit in order to get latest user logs on MySQL
500 Session().commit()
501
502 def test_git_fetches_from_remote_repository_with_annotated_tags(
503 self, backend_git, rc_web_server):
504 # Note: This is a test specific to the git backend. It checks the
505 # integration of fetching from a remote repository which contains
506 # annotated tags.
507
508 # Dulwich shows this specific behavior only when
509 # operating against a remote repository.
510 source_repo = backend_git['annotated-tag']
511 target_vcs_repo = backend_git.create_repo().scm_instance()
512 target_vcs_repo.fetch(rc_web_server.repo_clone_url(source_repo.repo_name))
513
514 def test_git_push_shows_pull_request_refs(self, backend_git, rc_web_server, tmpdir):
515 """
516 test if remote info about refs is visible
517 """
518 empty_repo = backend_git.create_repo()
519
520 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
521
522 cmd = Command(tmpdir.strpath)
523 cmd.execute('git clone', clone_url)
524
525 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
526 repo.in_memory_commit.add(FileNode('readme.md', content='## Hello'))
527 repo.in_memory_commit.commit(
528 message='Commit on branch Master',
529 author='Automatic test',
530 branch='master')
531
532 repo_cmd = Command(repo.path)
533 stdout, stderr = repo_cmd.execute('git push --verbose origin master')
534 _check_proper_git_push(stdout, stderr, branch='master')
535
536 ref = '{}/{}/pull-request/new?branch=master'.format(
537 rc_web_server.host_url(), empty_repo.repo_name)
538 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stderr
539 assert 'remote: RhodeCode: push completed' in stderr
540
541 # push on the same branch
542 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
543 repo.in_memory_commit.add(FileNode('setup.py', content='print\n'))
544 repo.in_memory_commit.commit(
545 message='Commit2 on branch Master',
546 author='Automatic test2',
547 branch='master')
548
549 repo_cmd = Command(repo.path)
550 stdout, stderr = repo_cmd.execute('git push --verbose origin master')
551 _check_proper_git_push(stdout, stderr, branch='master')
552
553 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stderr
554 assert 'remote: RhodeCode: push completed' in stderr
555
556 # new Branch
557 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
558 repo.in_memory_commit.add(FileNode('feature1.py', content='## Hello world'))
559 repo.in_memory_commit.commit(
560 message='Commit on branch feature',
561 author='Automatic test',
562 branch='feature')
563
564 repo_cmd = Command(repo.path)
565 stdout, stderr = repo_cmd.execute('git push --verbose origin feature')
566 _check_proper_git_push(stdout, stderr, branch='feature')
567
568 ref = '{}/{}/pull-request/new?branch=feature'.format(
569 rc_web_server.host_url(), empty_repo.repo_name)
570 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stderr
571 assert 'remote: RhodeCode: push completed' in stderr
572
573 def test_hg_push_shows_pull_request_refs(self, backend_hg, rc_web_server, tmpdir):
574 empty_repo = backend_hg.create_repo()
575
576 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
577
578 cmd = Command(tmpdir.strpath)
579 cmd.execute('hg clone', clone_url)
580
581 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
582 repo.in_memory_commit.add(FileNode(u'readme.md', content=u'## Hello'))
583 repo.in_memory_commit.commit(
584 message=u'Commit on branch default',
585 author=u'Automatic test',
586 branch='default')
587
588 repo_cmd = Command(repo.path)
589 repo_cmd.execute('hg checkout default')
590
591 stdout, stderr = repo_cmd.execute('hg push --verbose', clone_url)
592 _check_proper_hg_push(stdout, stderr, branch='default')
593
594 ref = '{}/{}/pull-request/new?branch=default'.format(
595 rc_web_server.host_url(), empty_repo.repo_name)
596 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
597 assert 'remote: RhodeCode: push completed' in stdout
598
599 # push on the same branch
600 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
601 repo.in_memory_commit.add(FileNode(u'setup.py', content=u'print\n'))
602 repo.in_memory_commit.commit(
603 message=u'Commit2 on branch default',
604 author=u'Automatic test2',
605 branch=u'default')
606
607 repo_cmd = Command(repo.path)
608 repo_cmd.execute('hg checkout default')
609
610 stdout, stderr = repo_cmd.execute('hg push --verbose', clone_url)
611 _check_proper_hg_push(stdout, stderr, branch='default')
612
613 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
614 assert 'remote: RhodeCode: push completed' in stdout
615
616 # new Branch
617 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
618 repo.in_memory_commit.add(FileNode(u'feature1.py', content=u'## Hello world'))
619 repo.in_memory_commit.commit(
620 message=u'Commit on branch feature',
621 author=u'Automatic test',
622 branch=u'feature')
623
624 repo_cmd = Command(repo.path)
625 repo_cmd.execute('hg checkout feature')
626
627 stdout, stderr = repo_cmd.execute('hg push --new-branch --verbose', clone_url)
628 _check_proper_hg_push(stdout, stderr, branch='feature')
629
630 ref = '{}/{}/pull-request/new?branch=feature'.format(
631 rc_web_server.host_url(), empty_repo.repo_name)
632 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
633 assert 'remote: RhodeCode: push completed' in stdout
634
635 def test_hg_push_shows_pull_request_refs_book(self, backend_hg, rc_web_server, tmpdir):
636 empty_repo = backend_hg.create_repo()
637
638 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
639
640 cmd = Command(tmpdir.strpath)
641 cmd.execute('hg clone', clone_url)
642
643 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
644 repo.in_memory_commit.add(FileNode(u'readme.md', content=u'## Hello'))
645 repo.in_memory_commit.commit(
646 message=u'Commit on branch default',
647 author=u'Automatic test',
648 branch='default')
649
650 repo_cmd = Command(repo.path)
651 repo_cmd.execute('hg checkout default')
652
653 stdout, stderr = repo_cmd.execute('hg push --verbose', clone_url)
654 _check_proper_hg_push(stdout, stderr, branch='default')
655
656 ref = '{}/{}/pull-request/new?branch=default'.format(
657 rc_web_server.host_url(), empty_repo.repo_name)
658 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
659 assert 'remote: RhodeCode: push completed' in stdout
660
661 # add bookmark
662 repo = MercurialRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
663 repo.in_memory_commit.add(FileNode(u'setup.py', content=u'print\n'))
664 repo.in_memory_commit.commit(
665 message=u'Commit2 on branch default',
666 author=u'Automatic test2',
667 branch=u'default')
668
669 repo_cmd = Command(repo.path)
670 repo_cmd.execute('hg checkout default')
671 repo_cmd.execute('hg bookmark feature2')
672 stdout, stderr = repo_cmd.execute('hg push -B feature2 --verbose', clone_url)
673 _check_proper_hg_push(stdout, stderr, branch='default')
674
675 ref = '{}/{}/pull-request/new?branch=default'.format(
676 rc_web_server.host_url(), empty_repo.repo_name)
677 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
678 ref = '{}/{}/pull-request/new?bookmark=feature2'.format(
679 rc_web_server.host_url(), empty_repo.repo_name)
680 assert 'remote: RhodeCode: open pull request link: {}'.format(ref) in stdout
681 assert 'remote: RhodeCode: push completed' in stdout
682 assert 'exporting bookmark feature2' in stdout
@@ -37,7 +37,7 b' from rhodecode.model.repo import RepoMod'
37 37 from rhodecode.tests import (
38 38 GIT_REPO, HG_REPO, TEST_USER_ADMIN_LOGIN, TEST_USER_REGULAR_LOGIN,
39 39 TEST_USER_REGULAR_PASS)
40 from rhodecode.tests.other.vcs_operations import (
40 from rhodecode.tests.vcs_operations import (
41 41 Command, _check_proper_clone, _check_proper_git_push, _add_files_and_push)
42 42
43 43
@@ -37,7 +37,7 b' from rhodecode.model.repo import RepoMod'
37 37 from rhodecode.tests import (
38 38 GIT_REPO, HG_REPO, TEST_USER_ADMIN_LOGIN, TEST_USER_REGULAR_LOGIN,
39 39 TEST_USER_REGULAR_PASS)
40 from rhodecode.tests.other.vcs_operations import Command, _add_files_and_push
40 from rhodecode.tests.vcs_operations import Command, _add_files_and_push
41 41
42 42
43 43 # override rc_web_server_config fixture with custom INI
@@ -36,7 +36,7 b' from rhodecode.model.integration import '
36 36 from rhodecode.model.meta import Session
37 37
38 38 from rhodecode.tests import GIT_REPO, HG_REPO
39 from rhodecode.tests.other.vcs_operations import Command, _add_files_and_push
39 from rhodecode.tests.vcs_operations import Command, _add_files_and_push
40 40 from rhodecode.integrations.types.webhook import WebhookIntegrationType
41 41
42 42
@@ -91,11 +91,6 b' def enable_webhook_push_integration(requ'
91 91 Session().commit()
92 92
93 93
94 @pytest.fixture(scope="session")
95 def vcs_server_config_override():
96 return ({'server:main': {'workers': 2}},)
97
98
99 94 @pytest.mark.usefixtures(
100 95 "disable_locking", "disable_anonymous_user",
101 96 "enable_webhook_push_integration")
General Comments 0
You need to be logged in to leave comments. Login now