Commit 8b704f5f authored by Natanael Copa's avatar Natanael Copa
Browse files

tests: make fake wget to error on missing/or empty url

parent c51ebcb7
Pipeline #126435 passed with stage
in 23 seconds
......@@ -63,8 +63,13 @@ while true; do
shift
done
if [ $# -eq 0 ]; then
usage "1" >&2
fi
for url; do
case "$url" in
"") msg "bad address"; exit 1;;
*fail*) msg "bad address"; exit 1;;
*404*) msg "wget: server returned error: HTTP/1.1 404 Not Found"; exit 1;;
esac
......
......@@ -9,7 +9,9 @@ init_tests \
fake_wget_outfile \
fake_wget_stdout \
fake_wget_fail \
fake_wget_404
fake_wget_404 \
fake_wget_missing_url \
fake_wget_empty_url
fake_wget_usage_body() {
test_usage wget
......@@ -73,3 +75,17 @@ fake_wget_404_body() {
wget https://example.com/404
}
fake_wget_missing_url_body() {
init_env
atf_check -s exit:1 \
-e match:"usage:" \
wget -q -O -
}
fake_wget_empty_url_body() {
init_env
atf_check -s exit:1 \
-e match:"bad address" \
wget ""
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment