[PATCH 4/5] t0300: make alternate username tests more robust
- From
Jeff King <peff@peff.net>
- Date
- Sep 14, 2011, 19:18 UTC
- Message-ID
- <20110914191857.GD28267@sigill.intra.peff.net>
- In-Reply-To
- <20110914191704.GA23201@sigill.intra.peff.net>
One of the tests is to make sure that if we have a cached credential "user/pass", that we ignore it when asking for "--username=other", and instead get a new password. But since askpass returns only a single fake value, we couldn't differentiate between using the cached password and the new one.
Signed-off-by: Jeff King <peff@peff.net> --- t/t0300-credentials.sh | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh index 09d5b15..41ab8cc 100755 --- a/t/t0300-credentials.sh +++ b/t/t0300-credentials.sh @@ -53,7 +53,11 @@ test_expect_success 'setup helper scripts' ' #!/bin/sh echo >&2 askpass: $* what=`echo $1 | tr A-Z a-z | tr -cd a-z` - echo "askpass-$what" + if test -f "askpass-$what"; then + cat "askpass-$what" + else + echo "askpass-$what" + fi EOF chmod +x askpass && GIT_ASKPASS=askpass && @@ -226,9 +230,11 @@ test_expect_success 'credential-cache requires matching usernames' ' askpass: Username: askpass: Password: EOF + test_when_finished "rm -f askpass-password" && + echo other-password >askpass-password && check --unique=host --username=other cache <<-\EOF username=other - password=askpass-password + password=other-password -- askpass: Password: EOF
-- 1.7.6.252.ge9c18