reftable/reader: introduce refcounting
[git/gitster.git] / t / t5564-http-proxy.sh
blobbb35b87071d93dd5eacfeac67034f198dbf6a449
1 #!/bin/sh
3 test_description="test fetching through http proxy"
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-httpd.sh
9 LIB_HTTPD_PROXY=1
10 start_httpd
12 test_expect_success 'setup repository' '
13 test_commit foo &&
14 git init --bare "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
15 git push --mirror "$HTTPD_DOCUMENT_ROOT_PATH/repo.git"
18 setup_askpass_helper
20 # sanity check that our test setup is correctly using proxy
21 test_expect_success 'proxy requires password' '
22 test_config_global http.proxy $HTTPD_DEST &&
23 test_must_fail git clone $HTTPD_URL/smart/repo.git 2>err &&
24 grep "error.*407" err
27 test_expect_success 'clone through proxy with auth' '
28 test_when_finished "rm -rf clone" &&
29 test_config_global http.proxy http://proxuser:proxpass@$HTTPD_DEST &&
30 GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone &&
31 grep -i "Proxy-Authorization: Basic <redacted>" trace
34 test_expect_success 'clone can prompt for proxy password' '
35 test_when_finished "rm -rf clone" &&
36 test_config_global http.proxy http://proxuser@$HTTPD_DEST &&
37 set_askpass nobody proxpass &&
38 GIT_TRACE_CURL=$PWD/trace git clone $HTTPD_URL/smart/repo.git clone &&
39 expect_askpass pass proxuser
42 test_done