Merge branch 'jk/http-auth-tests-robustify'
authorJunio C Hamano <gitster@pobox.com>
Fri, 10 Jan 2014 18:33:18 +0000 (10:33 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Jan 2014 18:33:19 +0000 (10:33 -0800)
Using the same username and password during the tests would not
catch a potential breakage of sending one when we should be sending
the other.

* jk/http-auth-tests-robustify:
use distinct username/password for http auth tests

1  2 
t/lib-httpd.sh
diff --combined t/lib-httpd.sh
index c4707843c4ca5d91d34c86185b3b16bd37d27e36,d15fa0f045bca78b2d779882e89aa5f8c8f6aac2..bfdff2a8c93091c8e2db8e03a74eae5c5a53991c
@@@ -1,31 -1,4 +1,31 @@@
 -#!/bin/sh
 +# Shell library to run an HTTP server for use in tests.
 +# Ends the test early if httpd tests should not be run,
 +# for example because the user has not enabled them.
 +#
 +# Usage:
 +#
 +#     . ./test-lib.sh
 +#     . "$TEST_DIRECTORY"/lib-httpd.sh
 +#     start_httpd
 +#
 +#     test_expect_success '...' '
 +#             ...
 +#     '
 +#
 +#     test_expect_success ...
 +#
 +#     stop_httpd
 +#     test_done
 +#
 +# Can be configured using the following variables.
 +#
 +#    GIT_TEST_HTTPD              enable HTTPD tests
 +#    LIB_HTTPD_PATH              web server path
 +#    LIB_HTTPD_MODULE_PATH       web server modules path
 +#    LIB_HTTPD_PORT              listening port
 +#    LIB_HTTPD_DAV               enable DAV
 +#    LIB_HTTPD_SVN               enable SVN
 +#    LIB_HTTPD_SSL               enable SSL
  #
  # Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
  #
@@@ -129,7 -102,7 +129,7 @@@ prepare_httpd() 
        HTTPD_DEST=127.0.0.1:$LIB_HTTPD_PORT
        HTTPD_URL=$HTTPD_PROTO://$HTTPD_DEST
        HTTPD_URL_USER=$HTTPD_PROTO://user%40host@$HTTPD_DEST
-       HTTPD_URL_USER_PASS=$HTTPD_PROTO://user%40host:user%40host@$HTTPD_DEST
+       HTTPD_URL_USER_PASS=$HTTPD_PROTO://user%40host:pass%40host@$HTTPD_DEST
  
        if test -n "$LIB_HTTPD_DAV" -o -n "$LIB_HTTPD_SVN"
        then
@@@ -217,7 -190,15 +217,15 @@@ setup_askpass_helper() 
        test_expect_success 'setup askpass helper' '
                write_script "$TRASH_DIRECTORY/askpass" <<-\EOF &&
                echo >>"$TRASH_DIRECTORY/askpass-query" "askpass: $*" &&
-               cat "$TRASH_DIRECTORY/askpass-response"
+               case "$*" in
+               *Username*)
+                       what=user
+                       ;;
+               *Password*)
+                       what=pass
+                       ;;
+               esac &&
+               cat "$TRASH_DIRECTORY/askpass-$what"
                EOF
                GIT_ASKPASS="$TRASH_DIRECTORY/askpass" &&
                export GIT_ASKPASS &&
  
  set_askpass() {
        >"$TRASH_DIRECTORY/askpass-query" &&
-       echo "$*" >"$TRASH_DIRECTORY/askpass-response"
+       echo "$1" >"$TRASH_DIRECTORY/askpass-user" &&
+       echo "$2" >"$TRASH_DIRECTORY/askpass-pass"
  }
  
  expect_askpass() {