tests: abuild-fetch: test curl failure

This commit is contained in:
Natanael Copa 2022-06-14 17:30:24 +02:00
parent 38a62bd063
commit d7d4eb7d60

View File

@ -3,7 +3,8 @@
. $(atf_get_srcdir)/test_env.sh
init_tests \
abuild_fetch_help \
abuild_fetch_curl_invocation
abuild_fetch_curl_invocation \
abuild_fetch_curl_failure
create_fake_curl() {
mkdir bin
@ -37,3 +38,15 @@ abuild_fetch_curl_invocation_body() {
abuild-fetch https://example.com/non-existing
}
abuild_fetch_curl_failure_body() {
create_fake_curl
# verify that fake curl works
CURL_EXITCODE=1 atf_check -s exit:$CURL_EXITCODE \
-o match:"Fake curl invoked" \
curl
CURL_EXITCODE=1 atf_check -s exit:$CURL_EXITCODE \
-o match:"Fake curl invoked" \
-e empty \
abuild-fetch https://example.com/non-existing
}