|
|
|
@ -607,21 +607,20 @@ class SSOAuthenticatorTest(unittest.TestCase):
|
|
|
|
def _input_dir(self) -> Path:
|
|
|
|
def _input_dir(self) -> Path:
|
|
|
|
return Path(__file__).with_suffix('.inputs') / self._testMethodName
|
|
|
|
return Path(__file__).with_suffix('.inputs') / self._testMethodName
|
|
|
|
|
|
|
|
|
|
|
|
def testCmdAssemblyFound(self):
|
|
|
|
@mock.patch('shutil.which', return_value='/fake/git-remote-sso')
|
|
|
|
mock.patch('shutil.which', return_value='/fake/git-remote-sso').start()
|
|
|
|
def testCmdAssemblyFound(self, _):
|
|
|
|
self.assertEqual(self.sso._resolve_sso_cmd(),
|
|
|
|
self.assertEqual(self.sso._resolve_sso_cmd(),
|
|
|
|
('/fake/git-remote-sso', '-print_config',
|
|
|
|
('/fake/git-remote-sso', '-print_config',
|
|
|
|
'sso://*.git.corp.google.com'))
|
|
|
|
'sso://*.git.corp.google.com'))
|
|
|
|
self.assertTrue(self.sso.is_applicable())
|
|
|
|
self.assertTrue(self.sso.is_applicable())
|
|
|
|
|
|
|
|
|
|
|
|
def testCmdAssemblyNotFound(self):
|
|
|
|
@mock.patch('shutil.which', return_value=None)
|
|
|
|
mock.patch('shutil.which', return_value=None).start()
|
|
|
|
def testCmdAssemblyNotFound(self, _):
|
|
|
|
self.assertEqual(self.sso._resolve_sso_cmd(), ())
|
|
|
|
self.assertEqual(self.sso._resolve_sso_cmd(), ())
|
|
|
|
self.assertFalse(self.sso.is_applicable())
|
|
|
|
self.assertFalse(self.sso.is_applicable())
|
|
|
|
|
|
|
|
|
|
|
|
def testCmdAssemblyCached(self):
|
|
|
|
@mock.patch('shutil.which', return_value='/fake/git-remote-sso')
|
|
|
|
which = mock.patch('shutil.which',
|
|
|
|
def testCmdAssemblyCached(self, which):
|
|
|
|
return_value='/fake/git-remote-sso').start()
|
|
|
|
|
|
|
|
self.sso._resolve_sso_cmd()
|
|
|
|
self.sso._resolve_sso_cmd()
|
|
|
|
self.sso._resolve_sso_cmd()
|
|
|
|
self.sso._resolve_sso_cmd()
|
|
|
|
self.assertEqual(which.called, 1)
|
|
|
|
self.assertEqual(which.called, 1)
|
|
|
|
|