t/README: add missing value for GIT_TEST_DEFAULT_REF_FORMAT
[git/gitster.git] / t / t5557-http-get.sh
blob76a4bbd16afb0871fb996bbb14d79a40e861321c
1 #!/bin/sh
3 test_description='test downloading a file by URL'
5 TEST_PASSES_SANITIZE_LEAK=true
7 . ./test-lib.sh
9 . "$TEST_DIRECTORY"/lib-httpd.sh
10 start_httpd
12 test_expect_success 'get by URL: 404' '
13 test_when_finished "rm -f file.temp" &&
14 url="$HTTPD_URL/none.txt" &&
15 cat >input <<-EOF &&
16 capabilities
17 get $url file1
18 EOF
20 test_must_fail git remote-http $url <input 2>err &&
21 test_path_is_missing file1 &&
22 grep "failed to download file at URL" err
25 test_expect_success 'get by URL: 200' '
26 echo data >"$HTTPD_DOCUMENT_ROOT_PATH/exists.txt" &&
28 url="$HTTPD_URL/exists.txt" &&
29 cat >input <<-EOF &&
30 capabilities
31 get $url file2
33 EOF
35 git remote-http $url <input &&
36 test_cmp "$HTTPD_DOCUMENT_ROOT_PATH/exists.txt" file2
39 test_done