diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-05-10 10:23:28 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-05-10 10:23:29 -0700 |
| commit | 2ca91d1ee07f934fa7f57ba34c397b150eef023f (patch) | |
| tree | d71bd150edc85eedc736f64e896acad327874343 /t | |
| parent | c05615e1c5876bea3c35202771d3db83b3336437 (diff) | |
| parent | a5c76569e798ad3656afe6b67f37cbbb2e47f28c (diff) | |
| download | git-2ca91d1ee07f934fa7f57ba34c397b150eef023f.tar.xz | |
Merge branch 'mh/credential-oauth-refresh-token'
The credential subsystem learns to help OAuth framework.
* mh/credential-oauth-refresh-token:
credential: new attribute oauth_refresh_token
Diffstat (limited to 't')
| -rw-r--r-- | t/lib-credential.sh | 30 | ||||
| -rwxr-xr-x | t/t0300-credentials.sh | 18 | ||||
| -rwxr-xr-x | t/t0301-credential-cache.sh | 1 |
3 files changed, 49 insertions, 0 deletions
diff --git a/t/lib-credential.sh b/t/lib-credential.sh index d7d03c3cd9..f1ab92ba35 100644 --- a/t/lib-credential.sh +++ b/t/lib-credential.sh @@ -43,6 +43,7 @@ helper_test_clean() { reject $1 https example.com store-user reject $1 https example.com user1 reject $1 https example.com user2 + reject $1 https example.com user4 reject $1 http path.tld user reject $1 https timeout.tld user reject $1 https sso.tld @@ -327,6 +328,35 @@ helper_test_timeout() { ' } +helper_test_oauth_refresh_token() { + HELPER=$1 + + test_expect_success "helper ($HELPER) stores oauth_refresh_token" ' + check approve $HELPER <<-\EOF + protocol=https + host=example.com + username=user4 + password=pass + oauth_refresh_token=xyzzy + EOF + ' + + test_expect_success "helper ($HELPER) gets oauth_refresh_token" ' + check fill $HELPER <<-\EOF + protocol=https + host=example.com + username=user4 + -- + protocol=https + host=example.com + username=user4 + password=pass + oauth_refresh_token=xyzzy + -- + EOF + ' +} + write_script askpass <<\EOF echo >&2 askpass: $* what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z) diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh index b8612ede95..a4f5bba507 100755 --- a/t/t0300-credentials.sh +++ b/t/t0300-credentials.sh @@ -214,6 +214,24 @@ test_expect_success 'credential_approve stores password expiry' ' EOF ' +test_expect_success 'credential_approve stores oauth refresh token' ' + check approve useless <<-\EOF + protocol=http + host=example.com + username=foo + password=bar + oauth_refresh_token=xyzzy + -- + -- + useless: store + useless: protocol=http + useless: host=example.com + useless: username=foo + useless: password=bar + useless: oauth_refresh_token=xyzzy + EOF +' + test_expect_success 'do not bother storing password-less credential' ' check approve useless <<-\EOF protocol=http diff --git a/t/t0301-credential-cache.sh b/t/t0301-credential-cache.sh index 698b7159f0..c02a3b5969 100755 --- a/t/t0301-credential-cache.sh +++ b/t/t0301-credential-cache.sh @@ -29,6 +29,7 @@ test_atexit 'git credential-cache exit' # test that the daemon works with no special setup helper_test cache +helper_test_oauth_refresh_token cache test_expect_success 'socket defaults to ~/.cache/git/credential/socket' ' test_when_finished " |
