aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpg/t-keylist.c
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2023-02-08 12:46:17 +0000
committerIngo Klöcker <[email protected]>2023-02-08 12:46:17 +0000
commitfcefc78f749a8f39cc587636647b24f8fa48efad (patch)
tree7aff21c5303e0629f7afa5d7d6283875c66ec707 /tests/gpg/t-keylist.c
parenttests: Make t-edit-sign idempotent (diff)
downloadgpgme-fcefc78f749a8f39cc587636647b24f8fa48efad.tar.gz
gpgme-fcefc78f749a8f39cc587636647b24f8fa48efad.zip
tests: Extend tests with an ultimately trusted key
* tests/gpg/Makefile.am (gpg-sample.stamp, pubring-stamp): Unify usage of tabs. (pubring-stamp): Import owner trust values. * tests/gpg/ownertrust.txt: New. * tests/gpg/t-decrypt-verify.c, tests/gpg/t-verify.c: Update expected values for signature summary and validity. * tests/gpg/t-keylist-secret-sig.c, tests/gpg/t-keylist-sig.c, tests/gpg/t-keylist.c: Update expected values of owner trust and uid validity. -- This change marks the "Alpha Test" test key as ultimately trusted which makes it possible to check for correct values derived from this, i.e. key owner trust, user id validity, signature summary and signature validity. GnuPG-bug-id: 6342
Diffstat (limited to 'tests/gpg/t-keylist.c')
-rw-r--r--tests/gpg/t-keylist.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/gpg/t-keylist.c b/tests/gpg/t-keylist.c
index 3b4fea18..fc9fc1b7 100644
--- a/tests/gpg/t-keylist.c
+++ b/tests/gpg/t-keylist.c
@@ -43,8 +43,10 @@ struct key_info_s
const char *name;
const char *comment;
const char *email;
+ gpgme_validity_t validity;
} uid[3];
int n_subkeys;
+ gpgme_validity_t owner_trust;
void (*misc_check)(struct key_info_s *keyinfo, gpgme_key_t key);
};
@@ -56,9 +58,12 @@ static void check_whisky (struct key_info_s *keyinfo, gpgme_key_t key);
struct key_info_s keys[] =
{
{ "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8",
- { { "Alfa Test", "demo key", "[email protected]" },
- { "Alpha Test", "demo key", "[email protected]" },
- { "Alice", "demo key", NULL } }, 1 },
+ { { "Alfa Test", "demo key", "[email protected]",
+ GPGME_VALIDITY_ULTIMATE },
+ { "Alpha Test", "demo key", "[email protected]",
+ GPGME_VALIDITY_ULTIMATE },
+ { "Alice", "demo key", NULL, GPGME_VALIDITY_ULTIMATE } }, 1,
+ GPGME_VALIDITY_ULTIMATE },
{ "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F",
{ { "Bob", "demo key", NULL },
{ "Bravo Test", "demo key", "[email protected]" } }, 1 },
@@ -107,7 +112,7 @@ struct key_info_s keys[] =
{ { "Victor Test", "demo key", "[email protected]" } }, 1 },
{ "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6",
{ { "Whisky Test", "demo key", "[email protected]" } }, 3,
- check_whisky },
+ GPGME_VALIDITY_UNKNOWN, check_whisky },
{ "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE",
{ { "XRay Test", "demo key", "[email protected]" } }, 1 },
{ "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD",
@@ -219,10 +224,10 @@ main (int argc, char **argv)
key->chain_id);
exit (1);
}
- if (key->owner_trust != GPGME_VALIDITY_UNKNOWN)
+ if (key->owner_trust != keys[i].owner_trust)
{
- fprintf (stderr, "Key has unexpected owner trust: %i\n",
- key->owner_trust);
+ fprintf (stderr, "Key `%s' has unexpected owner trust: %i\n",
+ keys[i].uid[0].name, key->owner_trust);
exit (1);
}
@@ -426,10 +431,10 @@ main (int argc, char **argv)
fprintf (stderr, "First user ID unexpectedly invalid\n");
exit (1);
}
- if (key->uids && key->uids->validity != GPGME_VALIDITY_UNKNOWN)
+ if (key->uids && key->uids->validity != keys[i].uid[0].validity)
{
- fprintf (stderr, "First user ID has unexpectedly validity: %i\n",
- key->uids->validity);
+ fprintf (stderr, "First user ID `%s' has unexpectedly validity: %i\n",
+ key->uids->name, key->uids->validity);
exit (1);
}
if (key->uids && key->uids->signatures)
@@ -469,7 +474,7 @@ main (int argc, char **argv)
exit (1);
}
if (key->uids && key->uids->next
- && key->uids->next->validity != GPGME_VALIDITY_UNKNOWN)
+ && key->uids->next->validity != keys[i].uid[1].validity)
{
fprintf (stderr, "Second user ID has unexpectedly validity: %i\n",
key->uids->next->validity);
@@ -514,7 +519,7 @@ main (int argc, char **argv)
exit (1);
}
if (key->uids && key->uids->next && key->uids->next->next
- && key->uids->next->next->validity != GPGME_VALIDITY_UNKNOWN)
+ && key->uids->next->next->validity != keys[i].uid[2].validity)
{
fprintf (stderr, "Third user ID has unexpectedly validity: %i\n",
key->uids->next->next->validity);