From: Jonathan McDowell Date: Sun, 10 Nov 2013 00:16:00 +0000 (-0800) Subject: Add tests for retrieving by sub key ID X-Git-Tag: onak-0.4.3~29 X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=438bd2cc9821da85d9f396b01bb14c8b770679c0;p=onak.git Add tests for retrieving by sub key ID 2 tests for retrieving a key by a short 32 bit key id of a subkey and the full 64 bit sub key id. --- diff --git a/t/all-080-get-subkey.t b/t/all-080-get-subkey.t new file mode 100755 index 0000000..ecccdf4 --- /dev/null +++ b/t/all-080-get-subkey.t @@ -0,0 +1,25 @@ +#!/bin/sh +# Check we can retrieve a key by keyid + +set -e + +# Backends should really support this, but the file one is as simple as +# possible, so doesn't. Skip the test for it. +if [ "$1" = "file" ]; then + exit 0 +fi + +cd t +../onak -b -c test.conf add < ../keys/noodles.key +if ! ../onak -c test.conf get 0x045281F1B9A66E35 2> /dev/null | \ + grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then + echo "* Did not correctly retrieve key by subkey id." + exit 1 +fi +if ! ../onak -c test.conf get 0xFF162FC5CF3FBAD1 2> /dev/null | \ + grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then + echo "* Did not correctly retrieve key by subkey id." + exit 1 +fi + +exit 0 diff --git a/t/all-090-get-subkey-short.t b/t/all-090-get-subkey-short.t new file mode 100755 index 0000000..891a566 --- /dev/null +++ b/t/all-090-get-subkey-short.t @@ -0,0 +1,25 @@ +#!/bin/sh +# Check we can retrieve a key by keyid + +set -e + +# Backends should really support this, but the file one is as simple as +# possible, so doesn't. Skip the test for it. +if [ "$1" = "file" ]; then + exit 0 +fi + +cd t +../onak -b -c test.conf add < ../keys/noodles.key +if ! ../onak -c test.conf get 0xB9A66E35 2> /dev/null | \ + grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then + echo "* Did not correctly retrieve key by subkey id." + exit 1 +fi +if ! ../onak -c test.conf get 0xCF3FBAD1 2> /dev/null | \ + grep -q -- '-----BEGIN PGP PUBLIC KEY BLOCK-----'; then + echo "* Did not correctly retrieve key by subkey id." + exit 1 +fi + +exit 0