[git_cl] Fix ShouldUseSSO tests

They weren't testing what they were supposed to be testing and just
happened to pass.

Bug: b/351071334
Change-Id: I2cdd4fe3dc4b09509c73042e81c78949da5f9ac0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723254
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
changes/54/5723254/6
Allen Li 1 year ago committed by LUCI CQ
parent 6b2428d47d
commit 9a92cd9b69

@ -734,13 +734,15 @@ class ShouldUseSSOTest(unittest.TestCase):
self.sso.stop()
self.newauth.stop()
def testDisabled(self):
self.newauth.return_value = False
self.assertFalse(gerrit_util.ShouldUseSSO('fake-host', ''))
@mock.patch('newauth.Enabled', return_value=False)
def testDisabled(self, _):
self.assertFalse(
gerrit_util.ShouldUseSSO('fake-host', 'firefly@google.com'))
def testMissingCommand(self):
self.sso.return_value = 'fake-host'
self.assertFalse(gerrit_util.ShouldUseSSO('fake-host', ''))
@mock.patch('gerrit_util.ssoHelper.find_cmd', return_value='')
def testMissingCommand(self, _):
self.assertFalse(
gerrit_util.ShouldUseSSO('fake-host', 'firefly@google.com'))
def testGoogle(self):
self.assertTrue(

Loading…
Cancel
Save