add hashsum support in apt-file download and add more tests
[ntk/apt.git] / test / integration / test-apt-https-no-redirect
CommitLineData
dc95fee1
MV
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture "i386"
9
10buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
11setupaptarchive --no-update
12
13changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/'
14
e43a426e 15DOWNLOG='download-testfile.log'
dc95fee1 16msgtest 'normal http download works'
e43a426e 17downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 > "$DOWNLOG" && msgpass || msgfail
dc95fee1
MV
18
19msgtest 'normal https download works'
e43a426e 20downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog > "$DOWNLOG" && msgpass || msgfail
dc95fee1
MV
21
22msgtest 'redirecting https to http does not work'
e43a426e
MV
23if ! downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 > "$DOWNLOG"; then
24 msgpass
25else
26 cat >&2 "$DOWNLOG"
27 msgfail
28fi
29
30msgtest 'https methods given proper error on redirect attempt'
31if grep -q 'Protocol http not supported or disabled in libcurl' "$DOWNLOG"; then
32 msgpass
33else
34 cat >&2 "$DOWNLOG"
35 msgfail
36fi
dc95fee1
MV
37
38