4 TESTDIR
=$(readlink -f $(dirname $0)) 
   8 configarchitecture 
"i386" 
  10 buildsimplenativepackage 
'apt' 'all' '1.0' 'stable' 
  12 # setup http redirecting to https 
  13 getlabelfromsuite
() { echo 'Testcases'; } 
  14 setupaptarchive 
--no-update 
  15 changetohttpswebserver 
-o 'aptwebserver::support::http=false' 
  16 webserverconfig 
'aptwebserver::redirect::replace::/downgrademe/' "http://localhost:${APTHTTPPORT}/" 
  17 webserverconfig 
'aptwebserver::redirect::replace::/redirectme/' "https://localhost:${APTHTTPSPORT}/" 
  18 sed -i -e "s#:${APTHTTPSPORT}/#:${APTHTTPPORT}/redirectme#" -e 's# https:# http:#' rootdir
/etc
/apt
/sources.list.d
/* 
  20 testsuccess aptget update 
-o Debug
::Acquire
::http
=1 -o Debug
::Acquire
::https
=1 -o Debug
::pkgAcquire
::Worker
=1 
  22 msgtest 
'Test that the webserver does not answer' 'http requests' 
  23 downloadfile 
"http://localhost:${APTHTTPPORT}/pool/main/a/apt/apt_1.0/changelog" changelog 
>/dev
/null 
2>&1 && msgfail 
|| msgpass
 
  25 echo "Acquire::Changelogs::URI::Label::Testcases \"http://localhost:${APTHTTPPORT}/redirectme/pool/CHANGEPATH/changelog\";" > rootdir
/etc
/apt
/apt.conf.d
/changelog.conf
 
  26 testsuccessequal 
"'http://localhost:${APTHTTPPORT}/redirectme/pool/main/a/apt/apt_1.0/changelog' apt.changelog" aptget changelog apt 
--print-uris 
  29 testsuccess aptget changelog apt 
-d 
  30 testsuccess 
test -s apt.changelog
 
  33 testsuccess aptget download apt
 
  34 testsuccess 
test -s apt_1.0_all.deb
 
  38 testsuccess aptget 
install apt 
-y 
  39 testdpkginstalled 
'apt' 
  41 # install a slowed down file: otherwise its to fast to reproduce combining 
  42 NEWMETHODS
="$(readlink -f rootdir)/usr/lib/apt/methods" 
  43 OLDMETHODS
="$(readlink -f rootdir/usr/lib/apt/methods)" 
  47 IFS
="$(printf "\n\b")" 
  48 for METH 
in $(find "$OLDMETHODS" ! -type d); do 
  49         ln -s "$OLDMETHODS/$(basename "$METH")" "$NEWMETHODS" 
  52 rm "$NEWMETHODS/https" 
  55 testfailureequal 
"E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found. 
  56 N: Is the package apt-transport-https installed?" aptget download apt
 
  57 testfailure 
test -e apt_1.0_all.deb
 
  60 # revert to all methods 
  61 ln -s "$OLDMETHODS/https" "$NEWMETHODS" 
  63 # check that downgrades from https to http are not allowed 
  64 webserverconfig 
'aptwebserver::support::http' 'true' 
  65 sed -i -e "s#:${APTHTTPPORT}/redirectme#:${APTHTTPSPORT}/downgrademe#" -e 's# http:# https:#' rootdir
/etc
/apt
/sources.list.d
/* 
  66 testfailure aptget update 
--allow-insecure-repositories