summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_git_command.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_git_command.py b/tests/test_git_command.py
index c2d3f1df..2c22b250 100644
--- a/tests/test_git_command.py
+++ b/tests/test_git_command.py
@@ -30,6 +30,33 @@ import git_command
30import wrapper 30import wrapper
31 31
32 32
33class SSHUnitTest(unittest.TestCase):
34 """Tests the ssh functions."""
35
36 def test_ssh_version(self):
37 """Check ssh_version() handling."""
38 ver = git_command._parse_ssh_version('Unknown\n')
39 self.assertEqual(ver, ())
40 ver = git_command._parse_ssh_version('OpenSSH_1.0\n')
41 self.assertEqual(ver, (1, 0))
42 ver = git_command._parse_ssh_version('OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13, OpenSSL 1.0.1f 6 Jan 2014\n')
43 self.assertEqual(ver, (6, 6, 1))
44 ver = git_command._parse_ssh_version('OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\n')
45 self.assertEqual(ver, (7, 6))
46
47 def test_ssh_sock(self):
48 """Check ssh_sock() function."""
49 with mock.patch('tempfile.mkdtemp', return_value='/tmp/foo'):
50 # old ssh version uses port
51 with mock.patch('git_command.ssh_version', return_value=(6, 6)):
52 self.assertTrue(git_command.ssh_sock().endswith('%p'))
53 git_command._ssh_sock_path = None
54 # new ssh version uses hash
55 with mock.patch('git_command.ssh_version', return_value=(6, 7)):
56 self.assertTrue(git_command.ssh_sock().endswith('%C'))
57 git_command._ssh_sock_path = None
58
59
33class GitCallUnitTest(unittest.TestCase): 60class GitCallUnitTest(unittest.TestCase):
34 """Tests the _GitCall class (via git_command.git).""" 61 """Tests the _GitCall class (via git_command.git)."""
35 62