]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5557-http-get.sh
The third batch
[thirdparty/git.git] / t / t5557-http-get.sh
CommitLineData
b5624a44
DS
1#!/bin/sh
2
3test_description='test downloading a file by URL'
4
53a50892
DS
5TEST_PASSES_SANITIZE_LEAK=true
6
b5624a44
DS
7. ./test-lib.sh
8
9. "$TEST_DIRECTORY"/lib-httpd.sh
10start_httpd
11
12test_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
19
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
23'
24
25test_expect_success 'get by URL: 200' '
26 echo data >"$HTTPD_DOCUMENT_ROOT_PATH/exists.txt" &&
27
28 url="$HTTPD_URL/exists.txt" &&
29 cat >input <<-EOF &&
30 capabilities
31 get $url file2
32
33 EOF
34
35 git remote-http $url <input &&
36 test_cmp "$HTTPD_DOCUMENT_ROOT_PATH/exists.txt" file2
37'
38
39test_done