- cat > apt-proxy-detect <<'EOF'
-#!/bin/sh -e
-exit 0
-EOF
- chmod 755 apt-proxy-detect
- echo "Acquire::http::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
- testsuccessequal "Using proxy '' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com
-
- # http auto detect proxy script
- cat > apt-proxy-detect <<'EOF'
-#!/bin/sh -e
-echo "http://some-proxy"
-EOF
- chmod 755 apt-proxy-detect
- echo "Acquire::http::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
-
+ setupproxydetect 'http' 'exit 0'
+ testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
+ setupproxydetect 'http' 'exit 1'
+ testfailureequal 'E: Sub-process ProxyAutoDetect returned an error code (1)' apthelper auto-detect-proxy http://example.com/
+ setupproxydetect 'http' 'echo'
+ testwarningequal "Using proxy '' for URL 'http://example.com/'
+W: ProxyAutoDetect command returned an empty line" apthelper auto-detect-proxy http://example.com/
+ setupproxydetect 'http' 'echo DIRECT'
+ testsuccessequal "Using proxy 'DIRECT' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
+
+ msgmsg 'apt-helper auto-detect-proxy' 'http proxy'
+ setupproxydetect 'http' 'echo "http://some-proxy"'