From 5291eafa412117b80ebbf645fc51559dd0b2caaf Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 5 May 2021 15:53:03 -0400 Subject: ssh: move all ssh logic to a common place We had ssh logic sprinkled between two git modules, and neither was quite the right home for it. This largely moves the logic as-is to its new home. We'll leave major refactoring to followup commits. Bug: https://crbug.com/gerrit/12389 Change-Id: I300a8f7dba74f2bd132232a5eb1e856a8490e0e9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305483 Reviewed-by: Chris Mcdonald Tested-by: Mike Frysinger --- tests/test_git_command.py | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'tests/test_git_command.py') diff --git a/tests/test_git_command.py b/tests/test_git_command.py index 76c092f4..93300a6f 100644 --- a/tests/test_git_command.py +++ b/tests/test_git_command.py @@ -26,38 +26,6 @@ import git_command import wrapper -class SSHUnitTest(unittest.TestCase): - """Tests the ssh functions.""" - - def test_parse_ssh_version(self): - """Check parse_ssh_version() handling.""" - ver = git_command._parse_ssh_version('Unknown\n') - self.assertEqual(ver, ()) - ver = git_command._parse_ssh_version('OpenSSH_1.0\n') - self.assertEqual(ver, (1, 0)) - ver = git_command._parse_ssh_version('OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13, OpenSSL 1.0.1f 6 Jan 2014\n') - self.assertEqual(ver, (6, 6, 1)) - ver = git_command._parse_ssh_version('OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\n') - self.assertEqual(ver, (7, 6)) - - def test_ssh_version(self): - """Check ssh_version() handling.""" - with mock.patch('git_command._run_ssh_version', return_value='OpenSSH_1.2\n'): - self.assertEqual(git_command.ssh_version(), (1, 2)) - - def test_ssh_sock(self): - """Check ssh_sock() function.""" - with mock.patch('tempfile.mkdtemp', return_value='/tmp/foo'): - # old ssh version uses port - with mock.patch('git_command.ssh_version', return_value=(6, 6)): - self.assertTrue(git_command.ssh_sock().endswith('%p')) - git_command._ssh_sock_path = None - # new ssh version uses hash - with mock.patch('git_command.ssh_version', return_value=(6, 7)): - self.assertTrue(git_command.ssh_sock().endswith('%C')) - git_command._ssh_sock_path = None - - class GitCallUnitTest(unittest.TestCase): """Tests the _GitCall class (via git_command.git).""" -- cgit v1.2.3-54-g00ecf