mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 02:31:29 +00:00
Fix gerrit new-password URL
This change fixes gerrit new-password URL from <host>-review.googlesource.com/new-password to <host>.googlesource.com/new-password. Fixed: 1412557 Change-Id: I0c73e890fa9db5e2172d9a88cbc50703675e9f50 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4219808 Reviewed-by: Josip Sokcevic <sokcevic@chromium.org> Reviewed-by: Joanna Wang <jojwang@chromium.org> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
This commit is contained in:
committed by
LUCI CQ
parent
963e01c76c
commit
a02b4bf030
@@ -146,8 +146,11 @@ class CookiesAuthenticator(Authenticator):
|
||||
assert not host.startswith('http')
|
||||
# Assume *.googlesource.com pattern.
|
||||
parts = host.split('.')
|
||||
if not parts[0].endswith('-review'):
|
||||
parts[0] += '-review'
|
||||
|
||||
# remove -review suffix if present.
|
||||
if parts[0].endswith('-review'):
|
||||
parts[0] = parts[0][:-len('-review')]
|
||||
|
||||
return 'https://%s/new-password' % ('.'.join(parts))
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -105,20 +105,19 @@ class CookiesAuthenticatorTest(unittest.TestCase):
|
||||
|
||||
def testGetNewPasswordUrl(self):
|
||||
auth = gerrit_util.CookiesAuthenticator()
|
||||
self.assertEqual('https://chromium.googlesource.com/new-password',
|
||||
auth.get_new_password_url('chromium.googlesource.com'))
|
||||
self.assertEqual(
|
||||
'https://chromium-review.googlesource.com/new-password',
|
||||
auth.get_new_password_url('chromium.googlesource.com'))
|
||||
self.assertEqual(
|
||||
'https://chrome-internal-review.googlesource.com/new-password',
|
||||
'https://chrome-internal.googlesource.com/new-password',
|
||||
auth.get_new_password_url('chrome-internal-review.googlesource.com'))
|
||||
|
||||
def testGetNewPasswordMessage(self):
|
||||
auth = gerrit_util.CookiesAuthenticator()
|
||||
self.assertIn(
|
||||
'https://chromium-review.googlesource.com/new-password',
|
||||
'https://chromium.googlesource.com/new-password',
|
||||
auth.get_new_password_message('chromium-review.googlesource.com'))
|
||||
self.assertIn(
|
||||
'https://chrome-internal-review.googlesource.com/new-password',
|
||||
'https://chrome-internal.googlesource.com/new-password',
|
||||
auth.get_new_password_message('chrome-internal.googlesource.com'))
|
||||
|
||||
def testGetGitcookiesPath(self):
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
You can manually remove corresponding lines in your ~%(sep)s.gitcookies file and visit the following URLs with correct account to generate correct credential lines:
|
||||
|
||||
https://conflict-review.googlesource.com/new-password
|
||||
https://gpartial-review.googlesource.com/new-password
|
||||
https://partial-review.googlesource.com/new-password
|
||||
https://conflict.googlesource.com/new-password
|
||||
https://gpartial.googlesource.com/new-password
|
||||
https://partial.googlesource.com/new-password
|
||||
|
||||
@@ -2329,7 +2329,7 @@ class TestGitCl(unittest.TestCase):
|
||||
'These are read from ~%(sep)s.gitcookies '
|
||||
'(or legacy ~%(sep)s%(netrc)s)\n'
|
||||
'You can (re)generate your credentials by visiting '
|
||||
'https://chromium-review.googlesource.com/new-password\n' % {
|
||||
'https://chromium.googlesource.com/new-password\n' % {
|
||||
'sep': os.sep,
|
||||
'netrc': NETRC_FILENAME,
|
||||
}, sys.stderr.getvalue())
|
||||
|
||||
Reference in New Issue
Block a user