Merge pull request #219 from cydu-cloud/askpass
Verify both username and password in the askpass_git test.
This commit is contained in:
commit
0e422616a4
|
|
@ -17,10 +17,12 @@ fi
|
||||||
# `git credential fill` requires the repo url match to consume the credentials stored by git-sync.
|
# `git credential fill` requires the repo url match to consume the credentials stored by git-sync.
|
||||||
# Askpass git only support repo started with "file://" which is used in test_e2e.sh.
|
# Askpass git only support repo started with "file://" which is used in test_e2e.sh.
|
||||||
REPO=$(echo "$@" | grep -o "file://[^ ]*")
|
REPO=$(echo "$@" | grep -o "file://[^ ]*")
|
||||||
PASSWD=$(echo "url=${REPO}" | git credential fill | grep -o "password=.*")
|
OUTPUT=$(echo "url=${REPO}" | git credential fill)
|
||||||
# Test case much match the magic password below.
|
USERNAME=$(echo ${OUTPUT} | grep -o "username=.*")
|
||||||
if [ "${PASSWD}" != "password=Lov3!k0os" ]; then
|
PASSWD=$(echo ${OUTPUT} | grep -o "password=.*")
|
||||||
echo "invalid password ${PASSWD}, try Lov3!k0os next time."
|
# Test case must match the magic username and password below.
|
||||||
|
if [ "${PASSWD}" != "password=Lov3!k0os" || "${USERNAME}" != "gitsync@example.com" ]; then
|
||||||
|
echo "invalid username/password pair: ${USERNAME}:${PASSWD}, try gitsync@example.com:Lov3!k0os next time."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -641,7 +641,7 @@ git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||||
# run with askpass_git but with wrong password
|
# run with askpass_git but with wrong password
|
||||||
GIT_SYNC \
|
GIT_SYNC \
|
||||||
--git=$ASKPASS_GIT \
|
--git=$ASKPASS_GIT \
|
||||||
--username="you@example.com" \
|
--username="gitsync@example.com" \
|
||||||
--password="I have no idea what the password is." \
|
--password="I have no idea what the password is." \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
|
@ -657,7 +657,7 @@ assert_file_absent "$ROOT"/link/file
|
||||||
# run with askpass_git with correct password
|
# run with askpass_git with correct password
|
||||||
GIT_SYNC \
|
GIT_SYNC \
|
||||||
--git=$ASKPASS_GIT \
|
--git=$ASKPASS_GIT \
|
||||||
--username="you@example.com" \
|
--username="gitsync@example.com" \
|
||||||
--password="Lov3!k0os" \
|
--password="Lov3!k0os" \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue