From 8e768eaaa722a99405f6542ac718880c8c22f060 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 6 May 2021 00:28:32 -0400 Subject: git_command: switch version caches to functools Simplifies the code a bit to use the stdlib cache helper. Change-Id: I778e90100ce748a71cc3a5a5d67dda403334315e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305482 Reviewed-by: Raman Tenneti Tested-by: Mike Frysinger --- tests/test_git_command.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/test_git_command.py') diff --git a/tests/test_git_command.py b/tests/test_git_command.py index 912a9dbe..76c092f4 100644 --- a/tests/test_git_command.py +++ b/tests/test_git_command.py @@ -29,8 +29,8 @@ import wrapper class SSHUnitTest(unittest.TestCase): """Tests the ssh functions.""" - def test_ssh_version(self): - """Check ssh_version() handling.""" + 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') @@ -40,6 +40,11 @@ class SSHUnitTest(unittest.TestCase): 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'): -- cgit v1.2.3-54-g00ecf