mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-02-02 12:41:51 +00:00
tests: abuild-fetch: test wget fallback
This commit is contained in:
parent
684cd989e6
commit
0c40d8aca7
@ -5,7 +5,8 @@ init_tests \
|
||||
abuild_fetch_help \
|
||||
abuild_fetch_curl_invocation \
|
||||
abuild_fetch_curl_failure \
|
||||
abuild_fetch_curl_insecure
|
||||
abuild_fetch_curl_insecure \
|
||||
abuild_fetch_wget_fallback
|
||||
|
||||
create_fake_curl() {
|
||||
mkdir bin
|
||||
@ -24,6 +25,17 @@ create_fake_curl() {
|
||||
PATH="$PWD/bin:$PATH"
|
||||
}
|
||||
|
||||
create_fake_wget() {
|
||||
mkdir -p bin
|
||||
cat > bin/wget <<-EOF
|
||||
#!/bin/sh
|
||||
|
||||
echo "Fake wget invoked with: \$@"
|
||||
exit \${WGET_EXITCODE:-0}
|
||||
EOF
|
||||
chmod +x bin/wget
|
||||
}
|
||||
|
||||
abuild_fetch_help_body() {
|
||||
atf_check -s exit:0 \
|
||||
-o not-empty \
|
||||
@ -59,3 +71,11 @@ abuild_fetch_curl_insecure_body() {
|
||||
abuild-fetch http://example.com/non-existing
|
||||
}
|
||||
|
||||
abuild_fetch_wget_fallback_body() {
|
||||
create_fake_wget
|
||||
PATH="$PWD/bin:$(atf_get_srcdir)/.." atf_check -s exit:0 \
|
||||
-o match:"Fake wget invoked" \
|
||||
-e empty \
|
||||
abuild-fetch https://example.com/non-existing
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user