Enable OAuth2 by default.

ClientLogin will be supposedly turned off on Apr 20.

R=maruel@chromium.org
BUG=356813

Review URL: https://codereview.chromium.org/1095033002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294899 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
vadimsh@chromium.org 10 years ago
parent d6d15b8e29
commit 19f3fe60b2

4
.gitignore vendored

@ -46,7 +46,3 @@
/tests/subversion_config/servers
/tests/svn/
/tests/svnrepo/
# Ignore "flag file" used by auth.py.
# TODO(vadimsh): Remove this once OAuth2 is default.
/USE_OAUTH2

@ -111,7 +111,7 @@ def make_auth_config(
"""
default = lambda val, d: val if val is not None else d
return AuthConfig(
default(use_oauth2, _should_use_oauth2()),
default(use_oauth2, True),
default(save_cookies, True),
default(use_local_webserver, not _is_headless()),
default(webserver_port, 8090),
@ -481,14 +481,6 @@ class Authenticator(object):
## Private functions.
def _should_use_oauth2():
"""Default value for use_oauth2 config option.
Used to selectively enable OAuth2 by default.
"""
return os.path.exists(os.path.join(DEPOT_TOOLS_DIR, 'USE_OAUTH2'))
def _is_headless():
"""True if machine doesn't seem to have a display."""
return sys.platform == 'linux2' and not os.environ.get('DISPLAY')

@ -24,7 +24,7 @@ setup_gitsvn
git add test; git commit -q -m "branch work"
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
"$GIT_CL upload -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
# Switch back to master, delete the branch.
git checkout master

@ -21,7 +21,7 @@ setup_gitsvn
git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \
"$GIT_CL upload 2>&1 | grep -q 'You must configure'"
"$GIT_CL upload --no-oauth2 2>&1 | grep -q 'You must configure'"
git config rietveld.server localhost:10000
@ -32,7 +32,7 @@ setup_gitsvn
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
@ -46,7 +46,7 @@ setup_gitsvn
$URL/edit
test_expect_success "git-cl dcommits ok" \
"$GIT_CL dcommit -f"
"$GIT_CL dcommit -f --no-oauth2"
git checkout -q master
git svn -q rebase >/dev/null 2>&1

@ -96,7 +96,6 @@ class TestGitCl(TestCase):
self.mock(git_cl.upload, 'RealMain', self.fail)
self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock)
self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock)
self.mock(git_cl.auth, '_should_use_oauth2', lambda: False)
# It's important to reset settings to not have inter-tests interference.
git_cl.settings = None
@ -171,13 +170,13 @@ class TestGitCl(TestCase):
((['get_or_create_merge_base', 'master', 'master'],),
'fake_ancestor_sha'),
((['git', 'config', 'gerrit.host'],), ''),
((['git', 'config', 'branch.master.rietveldissue'],), ''),
] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
((['git', 'rev-parse', '--show-cdup'],), ''),
((['git', 'rev-parse', 'HEAD'],), '12345'),
((['git', 'diff', '--name-status', '--no-renames', '-r',
'fake_ancestor_sha...', '.'],),
'M\t.gitignore\n'),
((['git', 'config', 'branch.master.rietveldissue'],), ''),
((['git', 'config', 'branch.master.rietveldpatchset'],),
''),
((['git', 'log', '--pretty=format:%s%n%n%b',

@ -30,16 +30,16 @@ END
git add OWNERS PRESUBMIT.py ; git commit -q -m "add OWNERS"
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status has a suggested reviewer" \
"$GIT_CL_STATUS | grep -q 'R=ben@chromium.org'"
test_expect_failure "git-cl dcommit fails w/ missing LGTM" \
"$GIT_CL dcommit -f"
"$GIT_CL dcommit -f --no-oauth2"
test_expect_success "git-cl dcommit --tbr succeeds" \
"$GIT_CL dcommit --tbr -f | grep -q -- '--tbr was specified'"
"$GIT_CL dcommit --tbr -f --no-oauth2 | grep -q -- '--tbr was specified'"
)
SUCCESS=$?

@ -24,7 +24,7 @@ setup_gitsvn
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
@ -33,7 +33,7 @@ setup_gitsvn
git checkout -q -b test2 master
test_expect_success "$GIT_CL patch $ISSUE"
test_expect_success "$GIT_CL patch $ISSUE --no-oauth2"
)
SUCCESS=$?

@ -28,7 +28,7 @@ _EOF
TBR=foo"
test_expect_success "dcommitted code" \
"$GIT_CL dcommit -f --bypass-hooks -m 'dcommit'"
"$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'"
test_expect_success "post-cl-dcommit hook executed" \
"git symbolic-ref HEAD | grep -q COMMITTED"

@ -21,7 +21,7 @@ setup_gitgit
git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \
"$GIT_CL upload 2>&1 | grep -q 'You must configure'"
"$GIT_CL upload --no-oauth2 2>&1 | grep -q 'You must configure'"
git config rietveld.server localhost:10000
@ -31,7 +31,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
@ -48,7 +48,7 @@ setup_gitgit
"curl -s $($GIT_CL_STATUS --field=url) | grep 'URL:[[:space:]]*[^<]' | grep -q '@master'"
test_expect_success "git-cl land ok" \
"$GIT_CL land -f"
"$GIT_CL land -f --no-oauth2"
git checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1

@ -21,7 +21,7 @@ setup_gitgit
git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \
"$GIT_CL upload 2>&1 | grep -q 'You must configure'"
"$GIT_CL upload --no-oauth2 2>&1 | grep -q 'You must configure'"
git config rietveld.server localhost:10000
@ -31,7 +31,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload.
export EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload -m test master | \
"$GIT_CL upload --no-oauth2 -m test master | \
grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
@ -41,13 +41,13 @@ setup_gitgit
# Should contain 'branch work' x 2.
test_expect_success "git-cl status has the right description for the log" \
"$GIT_CL_STATUS --field desc | [ $( egrep -q '^branch work$' -c ) -eq 2 ]
test_expect_success "git-cl status has the right subject from message" \
"$GIT_CL_STATUS --field desc | \
[ $( egrep -q '^test$' --byte-offset) | grep '^0:' ]
test_expect_success "git-cl push ok" \
"$GIT_CL push -f"
"$GIT_CL push -f --no-oauth2"
git checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1

@ -24,7 +24,7 @@ setup_gitsvn
git commit -q -m "renamed"
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
"$GIT_CL upload -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
# Look at the uploaded patch and verify it is a rename patch.
echo "Rename test not fully implemented yet. :("

@ -34,7 +34,8 @@ setup_gitgit
# Try to upload the change to an unresolvable hostname; git-cl should fail.
export GIT_EDITOR=$(which true)
git config rietveld.server bogus.example.com:80
test_expect_failure "uploading to bogus server" "$GIT_CL upload 2>/dev/null"
test_expect_failure "uploading to bogus server" \
"$GIT_CL upload --no-oauth2 2>/dev/null"
# Check that the change's description was saved.
test_expect_success "description was backed up" \

@ -28,9 +28,9 @@ setup_gitsvn
git add test; git commit -q -m "branch work"
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
"$GIT_CL upload -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl dcommits ok" \
"$GIT_CL dcommit -f"
"$GIT_CL dcommit -f --no-oauth2"
)
SUCCESS=$?

@ -27,7 +27,7 @@ TBR=foo"
git_diff=`git diff HEAD^ | sed -n '/^@@/,$p' | xargs`
test_expect_success "dcommitted code" \
"$GIT_CL dcommit -f --bypass-hooks -m 'dcommit'"
"$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'"
cd ..

@ -24,7 +24,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload -m test | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test | grep -q 'Issue created'"
)
SUCCESS=$?

@ -23,7 +23,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload -m test | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test | grep -q 'Issue created'"
test_expect_failure "description shouldn't contain unrelated commits" \
"$GIT_CL_STATUS | grep -q 'second commit'"

Loading…
Cancel
Save