mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
git-cl-test: rename auth parameter to creds
This avoids a import name clash in future CLs. Bug: 451651615 Change-Id: Ie35cbe58f36ec98b33c48a70e61a2678a9ce52db Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7104382 Auto-Submit: Jiewei Qian <qjw@chromium.org> Reviewed-by: Allen Li <ayatane@chromium.org> Commit-Queue: Scott Lee <ddoman@chromium.org> Reviewed-by: Scott Lee <ddoman@chromium.org>
This commit is contained in:
@@ -2446,7 +2446,7 @@ class TestGitCl(unittest.TestCase):
|
|||||||
patcher.start()
|
patcher.start()
|
||||||
self.addCleanup(patcher.stop)
|
self.addCleanup(patcher.stop)
|
||||||
|
|
||||||
def _setup_mock_for_cookies_authenticator(self, auth):
|
def _setup_mock_for_cookies_authenticator(self, creds):
|
||||||
"""Sets up mocks for CookiesAuthenticator, and returns a git_cl.Changelist() for testing."""
|
"""Sets up mocks for CookiesAuthenticator, and returns a git_cl.Changelist() for testing."""
|
||||||
|
|
||||||
self._add_patch_with_cleanup(
|
self._add_patch_with_cleanup(
|
||||||
@@ -2454,7 +2454,7 @@ class TestGitCl(unittest.TestCase):
|
|||||||
lambda prompt: self._mocked_call('ask_for_data', prompt))
|
lambda prompt: self._mocked_call('ask_for_data', prompt))
|
||||||
|
|
||||||
cookies_authenticator_factory = CookiesAuthenticatorMockFactory(
|
cookies_authenticator_factory = CookiesAuthenticatorMockFactory(
|
||||||
hosts_with_creds=auth)
|
hosts_with_creds=creds)
|
||||||
|
|
||||||
self._add_patch_with_cleanup('git_cl.gerrit_util.CookiesAuthenticator',
|
self._add_patch_with_cleanup('git_cl.gerrit_util.CookiesAuthenticator',
|
||||||
cookies_authenticator_factory)
|
cookies_authenticator_factory)
|
||||||
@@ -2473,7 +2473,7 @@ class TestGitCl(unittest.TestCase):
|
|||||||
'https://chromium.googlesource.com/my/repo')
|
'https://chromium.googlesource.com/my/repo')
|
||||||
|
|
||||||
cl = self._setup_mock_for_cookies_authenticator(
|
cl = self._setup_mock_for_cookies_authenticator(
|
||||||
auth={
|
creds={
|
||||||
'chromium.googlesource.com': ('git-same.example.com', 'secret'),
|
'chromium.googlesource.com': ('git-same.example.com', 'secret'),
|
||||||
'chromium-review.googlesource.com': ('git-same.example.com',
|
'chromium-review.googlesource.com': ('git-same.example.com',
|
||||||
'secret'),
|
'secret'),
|
||||||
@@ -2485,13 +2485,13 @@ class TestGitCl(unittest.TestCase):
|
|||||||
'https://chromium.googlesource.com/my/repo')
|
'https://chromium.googlesource.com/my/repo')
|
||||||
scm.GIT.SetConfig('', 'gerrit.skip-ensure-authenticated', 'true')
|
scm.GIT.SetConfig('', 'gerrit.skip-ensure-authenticated', 'true')
|
||||||
|
|
||||||
cl = self._setup_mock_for_cookies_authenticator(auth={})
|
cl = self._setup_mock_for_cookies_authenticator(creds={})
|
||||||
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
||||||
|
|
||||||
def test_gerrit_ensure_authenticated_sso(self):
|
def test_gerrit_ensure_authenticated_sso(self):
|
||||||
scm.GIT.SetConfig('', 'remote.origin.url', 'sso://repo')
|
scm.GIT.SetConfig('', 'remote.origin.url', 'sso://repo')
|
||||||
|
|
||||||
cl = self._setup_mock_for_cookies_authenticator(auth={})
|
cl = self._setup_mock_for_cookies_authenticator(creds={})
|
||||||
cl.lookedup_issue = True
|
cl.lookedup_issue = True
|
||||||
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
||||||
|
|
||||||
@@ -2500,7 +2500,7 @@ class TestGitCl(unittest.TestCase):
|
|||||||
'https://chromium.googlesource.com/my/repo')
|
'https://chromium.googlesource.com/my/repo')
|
||||||
|
|
||||||
cl = self._setup_mock_for_cookies_authenticator(
|
cl = self._setup_mock_for_cookies_authenticator(
|
||||||
auth={
|
creds={
|
||||||
'chromium.googlesource.com': ('', 'secret'),
|
'chromium.googlesource.com': ('', 'secret'),
|
||||||
'chromium-review.googlesource.com': ('', 'secret'),
|
'chromium-review.googlesource.com': ('', 'secret'),
|
||||||
})
|
})
|
||||||
@@ -2529,7 +2529,7 @@ class TestGitCl(unittest.TestCase):
|
|||||||
mock.patch('logging.warning',
|
mock.patch('logging.warning',
|
||||||
lambda *a: self._mocked_call('logging.warning', *a)).start()
|
lambda *a: self._mocked_call('logging.warning', *a)).start()
|
||||||
|
|
||||||
cl = self._setup_mock_for_cookies_authenticator(auth={})
|
cl = self._setup_mock_for_cookies_authenticator(creds={})
|
||||||
cl.lookedup_issue = True
|
cl.lookedup_issue = True
|
||||||
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
||||||
|
|
||||||
@@ -2548,7 +2548,7 @@ class TestGitCl(unittest.TestCase):
|
|||||||
mock.patch('logging.error',
|
mock.patch('logging.error',
|
||||||
lambda *a: self._mocked_call('logging.error', *a)).start()
|
lambda *a: self._mocked_call('logging.error', *a)).start()
|
||||||
|
|
||||||
cl = self._setup_mock_for_cookies_authenticator(auth={})
|
cl = self._setup_mock_for_cookies_authenticator(creds={})
|
||||||
cl.lookedup_issue = True
|
cl.lookedup_issue = True
|
||||||
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
self.assertIsNone(cl.EnsureAuthenticated(force=False))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user