]> git.saurik.com Git - apt.git/blame - test/integration/test-method-gpgv
The entire concept of PendingError() is flawed :/.
[apt.git] / test / integration / test-method-gpgv
CommitLineData
6dc85f53
DK
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'i386'
9
10cat > faked-apt-key <<EOF
11#!/bin/sh
12set -e
13echo "FFOO"
14find_gpgv_status_fd() {
15 while [ -n "\$1" ]; do
16 if [ "\$1" = '--status-fd' ]; then
17 shift
18 echo "\$1"
19 break
20 fi
21 shift
22 done
23}
24GPGSTATUSFD="\$(find_gpgv_status_fd "\$@")"
25cat >&\${GPGSTATUSFD} gpgv.output
26cat gpgv.output
27EOF
28chmod +x faked-apt-key
29
30testgpgv() {
31 echo "$3" > gpgv.output
32 msgtest "$1" "$2"
33 gpgvmethod >method.output 2>&1 || true
34 testsuccess --nomsg grep "$2" method.output
35}
36
37testrun() {
38 testgpgv 'Good signed with long keyid' 'Good: GOODSIG 5A90D141DBAC8DAE,' '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
39[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE'
40 testgpgv 'Good signed with fingerprint' 'Good: GOODSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE,' '[GNUPG:] GOODSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
41[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE'
42
43 testgpgv 'No Pubkey with long keyid' 'NoPubKey: NO_PUBKEY E8525D47528144E2,' '[GNUPG:] ERRSIG E8525D47528144E2 1 11 00 1472744666 9
44[GNUPG:] NO_PUBKEY E8525D47528144E2'
45 testgpgv 'No Pubkey with fingerprint' 'NoPubKey: NO_PUBKEY DE66AECA9151AFA1877EC31DE8525D47528144E2,' '[GNUPG:] ERRSIG DE66AECA9151AFA1877EC31DE8525D47528144E2 1 11 00 1472744666 9
46[GNUPG:] NO_PUBKEY DE66AECA9151AFA1877EC31DE8525D47528144E2'
47
48 testgpgv 'Expired key with long keyid' 'Worthless: EXPKEYSIG 4BC0A39C27CE74F9 Rex Expired <rex@example.org>,' '[GNUPG:] EXPKEYSIG 4BC0A39C27CE74F9 Rex Expired <rex@example.org>
49[GNUPG:] VALIDSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 2016-09-01 1472742629 0 4 0 1 11 00 891CC50E605796A0C6E733F74BC0A39C27CE74F9'
50 testgpgv 'Expired key with fingerprint' 'Worthless: EXPKEYSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 Rex Expired <rex@example.org>,' '[GNUPG:] EXPKEYSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 Rex Expired <rex@example.org>
51[GNUPG:] VALIDSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 2016-09-01 1472742629 0 4 0 1 11 00 891CC50E605796A0C6E733F74BC0A39C27CE74F9'
52}
53
54gpgvmethod() {
55 echo '601 Configuration
56Config-Item: Debug::Acquire::gpgv=1
57Config-Item: Dir::Bin::apt-key=./faked-apt-key
58
59600 URI Acquire
60URI: file:///dev/null
61Filename: /dev/zero
62' | runapt "${METHODSDIR}/gpgv"
63}
64testrun
65
66gpgvmethod() {
67 echo '601 Configuration
68Config-Item: Debug::Acquire::gpgv=1
69Config-Item: Dir::Bin::apt-key=./faked-apt-key
70
71600 URI Acquire
72URI: file:///dev/null
73Filename: /dev/zero
74Signed-By: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
75' | runapt "${METHODSDIR}/gpgv"
76}
77testrun