]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
fix test/integration/test-apt-key-net-update
[apt.git] / test / integration / test-bug-617690-allow-unauthenticated-makes-all-untrusted
CommitLineData
6c34ccca
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'i386'
8
9buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable'
10
11setupaptarchive --no-update
12
13testfileexists() {
14 msgtest 'Test for existance of file' "$1"
15 test -e "$1" && msgpass || msgfail
16 rm -f "$1"
17}
18
19testfilemissing() {
20 msgtest 'Test for non-existance of file' "$1"
21 test -e "$1" && msgfail || msgpass
22 rm -f "$1"
23}
24
25testrun() {
26 rm -rf rootdir/var/lib/apt
27 testsuccess aptget update
28
d57f6084
DK
29 if [ "$1" = 'trusted' ]; then
30 testsuccess aptget download cool
31 testfileexists 'cool_1.0_i386.deb'
32
33 testsuccess aptget download cool --allow-unauthenticated
34 testfileexists 'cool_1.0_i386.deb'
35 else
36 testfailure aptget download cool
37 testfilemissing 'cool_1.0_i386.deb'
38
39 testsuccess aptget download cool --allow-unauthenticated
40 testfileexists 'cool_1.0_i386.deb'
41 fi
6c34ccca
DK
42
43 mv aptarchive/pool/cool_1.0_i386.deb aptarchive/pool/cool_1.0_i386.deb.bak
44 echo 'this is not a good package' > aptarchive/pool/cool_1.0_i386.deb
d57f6084 45 testfailure aptget download cool
6c34ccca
DK
46 testfilemissing cool_1.0_i386.deb
47
d57f6084 48 testfailure aptget download cool --allow-unauthenticated # unauthenticated doesn't mean unchecked
6c34ccca
DK
49 testfilemissing cool_1.0_i386.deb
50
51 rm -f aptarchive/pool/cool_1.0_i386.deb
52 mv aptarchive/pool/cool_1.0_i386.deb.bak aptarchive/pool/cool_1.0_i386.deb
53 testsuccess aptget download cool --allow-unauthenticated
54 testfileexists 'cool_1.0_i386.deb'
55}
56
d57f6084 57testrun 'trusted'
6c34ccca
DK
58
59find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
d57f6084
DK
60testrun 'untrusted'
61
62changetowebserver
63testrun 'untrusted'