]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-bug-617690-allow-unauthenticated-makes-all-untrusted
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / integration / test-bug-617690-allow-unauthenticated-makes-all-untrusted
... / ...
CommitLineData
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 existence 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
28 if [ "$1" = 'trusted' ]; then
29 testsuccess aptget update
30
31 testsuccess aptget download cool
32 testfileexists 'cool_1.0_i386.deb'
33
34 testsuccess aptget download cool --allow-unauthenticated
35 testfileexists 'cool_1.0_i386.deb'
36 else
37 testsuccess aptget update --allow-insecure-repositories
38
39 testfailure aptget download cool
40 testfilemissing 'cool_1.0_i386.deb'
41
42 testsuccess aptget download cool --allow-unauthenticated
43 testfileexists 'cool_1.0_i386.deb'
44 fi
45
46 mv aptarchive/pool/cool_1.0_i386.deb aptarchive/pool/cool_1.0_i386.deb.bak
47 echo 'this is not a good package' > aptarchive/pool/cool_1.0_i386.deb
48 testfailure aptget download cool
49 testfilemissing cool_1.0_i386.deb
50
51 testfailure aptget download cool --allow-unauthenticated # unauthenticated doesn't mean unchecked
52 testfilemissing cool_1.0_i386.deb
53
54 rm -f aptarchive/pool/cool_1.0_i386.deb
55 mv aptarchive/pool/cool_1.0_i386.deb.bak aptarchive/pool/cool_1.0_i386.deb
56 testsuccess aptget download cool --allow-unauthenticated
57 testfileexists 'cool_1.0_i386.deb'
58}
59
60testrun 'trusted'
61
62find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
63testrun 'untrusted'
64
65changetowebserver
66testrun 'untrusted'