summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-05-06 00:28:32 -0400
committerMike Frysinger <vapier@google.com>2021-05-06 18:36:25 +0000
commit8e768eaaa722a99405f6542ac718880c8c22f060 (patch)
tree652e0b64c3b1ac810162acc4b9d35f4f265bb6a2 /tests
parent2f8fdbecde985e2a5ecf498d97d0d3ea9d1a6865 (diff)
downloadgit-repo-8e768eaaa722a99405f6542ac718880c8c22f060.tar.gz
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 <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_git_command.py9
1 files changed, 7 insertions, 2 deletions
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
29class SSHUnitTest(unittest.TestCase): 29class SSHUnitTest(unittest.TestCase):
30 """Tests the ssh functions.""" 30 """Tests the ssh functions."""
31 31
32 def test_ssh_version(self): 32 def test_parse_ssh_version(self):
33 """Check ssh_version() handling.""" 33 """Check parse_ssh_version() handling."""
34 ver = git_command._parse_ssh_version('Unknown\n') 34 ver = git_command._parse_ssh_version('Unknown\n')
35 self.assertEqual(ver, ()) 35 self.assertEqual(ver, ())
36 ver = git_command._parse_ssh_version('OpenSSH_1.0\n') 36 ver = git_command._parse_ssh_version('OpenSSH_1.0\n')
@@ -40,6 +40,11 @@ class SSHUnitTest(unittest.TestCase):
40 ver = git_command._parse_ssh_version('OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\n') 40 ver = git_command._parse_ssh_version('OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\n')
41 self.assertEqual(ver, (7, 6)) 41 self.assertEqual(ver, (7, 6))
42 42
43 def test_ssh_version(self):
44 """Check ssh_version() handling."""
45 with mock.patch('git_command._run_ssh_version', return_value='OpenSSH_1.2\n'):
46 self.assertEqual(git_command.ssh_version(), (1, 2))
47
43 def test_ssh_sock(self): 48 def test_ssh_sock(self):
44 """Check ssh_sock() function.""" 49 """Check ssh_sock() function."""
45 with mock.patch('tempfile.mkdtemp', return_value='/tmp/foo'): 50 with mock.patch('tempfile.mkdtemp', return_value='/tmp/foo'):