]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5564-http-proxy.sh
Merge branch 'tb/make-indent-conditional-with-non-spaces'
[thirdparty/git.git] / t / t5564-http-proxy.sh
CommitLineData
29ae2c9e
JK
1#!/bin/sh
2
3test_description="test fetching through http proxy"
4
5. ./test-lib.sh
6. "$TEST_DIRECTORY"/lib-httpd.sh
7
8LIB_HTTPD_PROXY=1
9start_httpd
10
11test_expect_success 'setup repository' '
12 test_commit foo &&
13 git init --bare "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
14 git push --mirror "$HTTPD_DOCUMENT_ROOT_PATH/repo.git"
15'
16
17setup_askpass_helper
18
19# sanity check that our test setup is correctly using proxy
20test_expect_success 'proxy requires password' '
21 test_config_global http.proxy $HTTPD_DEST &&
22 test_must_fail git clone $HTTPD_URL/smart/repo.git 2>err &&
23 grep "error.*407" err
24'
25
26test_expect_success 'clone through proxy with auth' '
27 test_when_finished "rm -rf clone" &&
28 test_config_global http.proxy http://proxuser:proxpass@$HTTPD_DEST &&
29 GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone &&
30 grep -i "Proxy-Authorization: Basic <redacted>" trace
31'
32
33test_expect_success 'clone can prompt for proxy password' '
34 test_when_finished "rm -rf clone" &&
35 test_config_global http.proxy http://proxuser@$HTTPD_DEST &&
36 set_askpass nobody proxpass &&
37 GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone &&
38 expect_askpass pass proxuser
39'
40
41test_done