summaryrefslogtreecommitdiff
path: root/t/lib-httpd.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-09-12 14:08:05 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-09-12 14:08:05 -0700
commit3503e9ab32c7a478d0d985171c50a901a2695162 (patch)
tree3fdddd11cc1cfe64e0d69c0ebcc92eac8dc77ced /t/lib-httpd.sh
parentFurther merging down for 1.7.12.1 (diff)
parentMerge branch 'jc/apply-binary-p0' into maint-1.7.11 (diff)
downloadtgif-3503e9ab32c7a478d0d985171c50a901a2695162.tar.xz
Merge branch 'maint-1.7.11' into maint
Diffstat (limited to 't/lib-httpd.sh')
-rw-r--r--t/lib-httpd.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index d773542680..02f442bfad 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -167,3 +167,42 @@ test_http_push_nonff() {
test_i18ngrep "Updates were rejected because" output
'
}
+
+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"
+ EOF
+ GIT_ASKPASS="$TRASH_DIRECTORY/askpass" &&
+ export GIT_ASKPASS &&
+ export TRASH_DIRECTORY
+ '
+}
+
+set_askpass() {
+ >"$TRASH_DIRECTORY/askpass-query" &&
+ echo "$*" >"$TRASH_DIRECTORY/askpass-response"
+}
+
+expect_askpass() {
+ dest=$HTTPD_DEST
+ {
+ case "$1" in
+ none)
+ ;;
+ pass)
+ echo "askpass: Password for 'http://$2@$dest': "
+ ;;
+ both)
+ echo "askpass: Username for 'http://$dest': "
+ echo "askpass: Password for 'http://$2@$dest': "
+ ;;
+ *)
+ false
+ ;;
+ esac
+ } >"$TRASH_DIRECTORY/askpass-expect" &&
+ test_cmp "$TRASH_DIRECTORY/askpass-expect" \
+ "$TRASH_DIRECTORY/askpass-query"
+}