##// END OF EJS Templates
feat(git/svn): remove filesystem modifications from git/svn calls. When sharding comes in place we can't do this....
feat(git/svn): remove filesystem modifications from git/svn calls. When sharding comes in place we can't do this. - This code was moved back to the vcsserver logic now

File last commit:

r5093:525812a8 default
r5216:07778025 default
Show More
test_ssh_wrapper.py
52 lines | 2.1 KiB | text/x-python | PythonLexer
copyrights: updated for 2023
r5088 # Copyright (C) 2016-2023 RhodeCode GmbH
ssh: embedded ssh support...
r2043 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
ssh-support: enabled full handling of all backends via SSH....
r2187
ssh: embedded ssh support...
r2043 import pytest
ssh-support: enabled full handling of all backends via SSH....
r2187 class TestSSHWrapper(object):
ssh: embedded ssh support...
r2043
ssh-support: enabled full handling of all backends via SSH....
r2187 def test_serve_raises_an_exception_when_vcs_is_not_recognized(self, ssh_wrapper):
with pytest.raises(Exception) as exc_info:
ssh_wrapper.serve(
vcs='microsoft-tfs', repo='test-repo', mode=None, user='test',
branch-permissions: enabled branch permissions checks for SSH backend.
r2982 permissions={}, branch_permissions={})
exceptions: use python3 compatible exception handling
r3104 assert str(exc_info.value) == 'Unrecognised VCS: microsoft-tfs'
ssh: embedded ssh support...
r2043
ssh-support: enabled full handling of all backends via SSH....
r2187 def test_parse_config(self, ssh_wrapper):
config = ssh_wrapper.parse_config(ssh_wrapper.ini_path)
assert config
ssh: embedded ssh support...
r2043
ssh-support: enabled full handling of all backends via SSH....
r2187 def test_get_connection_info(self, ssh_wrapper):
conn_info = ssh_wrapper.get_connection_info()
assert {'client_ip': '127.0.0.1',
'client_port': '22',
'server_ip': '10.0.0.1',
'server_port': '443'} == conn_info
ssh: embedded ssh support...
r2043
ssh-support: enabled full handling of all backends via SSH....
r2187 @pytest.mark.parametrize('command, vcs', [
('xxx', None),
('svnserve -t', 'svn'),
('hg -R repo serve --stdio', 'hg'),
('git-receive-pack \'repo.git\'', 'git'),
ssh: embedded ssh support...
r2043
ssh-support: enabled full handling of all backends via SSH....
r2187 ])
def test_get_repo_details(self, ssh_wrapper, command, vcs):
ssh_wrapper.command = command
vcs_type, repo_name, mode = ssh_wrapper.get_repo_details(mode='auto')
assert vcs_type == vcs