|
|
|
@ -736,19 +736,19 @@ class ShouldUseSSOTest(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
def testDisabled(self):
|
|
|
|
|
self.newauth.return_value = False
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('fake-host'))
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('/', 'fake-host'))
|
|
|
|
|
|
|
|
|
|
def testMissingCommand(self):
|
|
|
|
|
self.sso.return_value = 'fake-host'
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('fake-host'))
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('/', 'fake-host'))
|
|
|
|
|
|
|
|
|
|
@mock.patch('scm.GIT.GetConfig', return_value='firefly@google.com')
|
|
|
|
|
def testGoogle(self, _):
|
|
|
|
|
self.assertTrue(gerrit_util.ShouldUseSSO('fake-host'))
|
|
|
|
|
self.assertTrue(gerrit_util.ShouldUseSSO('/', 'fake-host'))
|
|
|
|
|
|
|
|
|
|
@mock.patch('scm.GIT.GetConfig', return_value='firefly@gmail.com')
|
|
|
|
|
def testGmail(self, _):
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('fake-host'))
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('/', 'fake-host'))
|
|
|
|
|
|
|
|
|
|
@mock.patch('gerrit_util.GetAccountEmails',
|
|
|
|
|
return_value=[{
|
|
|
|
@ -756,7 +756,7 @@ class ShouldUseSSOTest(unittest.TestCase):
|
|
|
|
|
}])
|
|
|
|
|
@mock.patch('scm.GIT.GetConfig', return_value='firefly@chromium.org')
|
|
|
|
|
def testLinkedChromium(self, _cfg, email):
|
|
|
|
|
self.assertTrue(gerrit_util.ShouldUseSSO('fake-host'))
|
|
|
|
|
self.assertTrue(gerrit_util.ShouldUseSSO('/', 'fake-host'))
|
|
|
|
|
email.assert_called_with('fake-host', 'self', authenticator=mock.ANY)
|
|
|
|
|
|
|
|
|
|
@mock.patch('gerrit_util.GetAccountEmails',
|
|
|
|
@ -765,7 +765,7 @@ class ShouldUseSSOTest(unittest.TestCase):
|
|
|
|
|
}])
|
|
|
|
|
@mock.patch('scm.GIT.GetConfig', return_value='firefly@chromium.org')
|
|
|
|
|
def testUnlinkedChromium(self, _cfg, email):
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('fake-host'))
|
|
|
|
|
self.assertFalse(gerrit_util.ShouldUseSSO('/', 'fake-host'))
|
|
|
|
|
email.assert_called_with('fake-host', 'self', authenticator=mock.ANY)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|