mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-23 15:33:28 +00:00
tests: abuild-fetch: add test for curl invocation
This commit is contained in:
parent
911550dbe1
commit
38a62bd063
@ -2,7 +2,25 @@
|
|||||||
|
|
||||||
. $(atf_get_srcdir)/test_env.sh
|
. $(atf_get_srcdir)/test_env.sh
|
||||||
init_tests \
|
init_tests \
|
||||||
abuild_fetch_help
|
abuild_fetch_help \
|
||||||
|
abuild_fetch_curl_invocation
|
||||||
|
|
||||||
|
create_fake_curl() {
|
||||||
|
mkdir bin
|
||||||
|
# fake curl
|
||||||
|
cat > bin/curl <<-EOF
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "[\$\$] Fake curl invoked with: \$@"
|
||||||
|
if [ -n "\$FIFO" ]; then
|
||||||
|
echo "[\$\$] waiting for fifo \$FIFO"
|
||||||
|
cat "\$FIFO"
|
||||||
|
fi
|
||||||
|
exit \${CURL_EXITCODE:-0}
|
||||||
|
EOF
|
||||||
|
chmod +x bin/curl
|
||||||
|
PATH="$PWD/bin:$PATH"
|
||||||
|
}
|
||||||
|
|
||||||
abuild_fetch_help_body() {
|
abuild_fetch_help_body() {
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
@ -11,3 +29,11 @@ abuild_fetch_help_body() {
|
|||||||
abuild-fetch -h
|
abuild-fetch -h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abuild_fetch_curl_invocation_body() {
|
||||||
|
create_fake_curl
|
||||||
|
atf_check -s exit:0 \
|
||||||
|
-o match:"Fake curl invoked" \
|
||||||
|
-e empty \
|
||||||
|
abuild-fetch https://example.com/non-existing
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user