##// END OF EJS Templates
tests: use small buffer git tests
marcink -
r2454:498c2652 default
parent child Browse files
Show More
@@ -0,0 +1,77 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 """
22 Test suite for making push/pull operations, on specially modified INI files
23
24 .. important::
25
26 You must have git >= 1.8.5 for tests to work fine. With 68b939b git started
27 to redirect things to stderr instead of stdout.
28 """
29
30 import os
31 import pytest
32
33 from rhodecode.lib.vcs.backends.git.repository import GitRepository
34 from rhodecode.lib.vcs.nodes import FileNode
35 from rhodecode.tests import GIT_REPO
36 from rhodecode.tests.other.vcs_operations import Command
37 from .test_vcs_operations import _check_proper_clone, _check_proper_git_push
38
39
40 # override rc_web_server_config fixture with custom INI
41 @pytest.fixture(scope="module")
42 def rc_web_server_config(testini_factory):
43 """
44 Configuration file used for the fixture `rc_web_server`.
45 """
46 CUSTOM_PARAMS = [
47 {'handler_console': {'level': 'DEBUG'}},
48 ]
49 return testini_factory(CUSTOM_PARAMS)
50
51
52 def test_git_clone_with_small_push_buffer(backend_git, rc_web_server, tmpdir):
53 clone_url = rc_web_server.repo_clone_url(GIT_REPO)
54 cmd = Command('/tmp')
55 stdout, stderr = cmd.execute('git -c http.postBuffer=1024 clone', clone_url, tmpdir.strpath)
56 _check_proper_clone(stdout, stderr, 'git')
57 cmd.assert_returncode_success()
58
59
60 def test_git_push_with_small_push_buffer(backend_git, rc_web_server, tmpdir):
61 empty_repo = backend_git.create_repo()
62
63 clone_url = rc_web_server.repo_clone_url(empty_repo.repo_name)
64
65 cmd = Command(tmpdir.strpath)
66 cmd.execute('git clone', clone_url)
67
68 repo = GitRepository(os.path.join(tmpdir.strpath, empty_repo.repo_name))
69 repo.in_memory_commit.add(FileNode('readme.md', content='## Hello'))
70 repo.in_memory_commit.commit(
71 message='Commit on branch Master',
72 author='Automatic test',
73 branch='master')
74
75 repo_cmd = Command(repo.path)
76 stdout, stderr = repo_cmd.execute('git -c http.postBuffer=1024 push --verbose origin master')
77 _check_proper_git_push(stdout, stderr, branch='master')
General Comments 0
You need to be logged in to leave comments. Login now