From 0be6fec1e2f456d3a8e94cf1dd93475982d5e58d Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 27 May 2003 05:07:19 +0000 Subject: 2003-05-27 Marcus Brinkmann * gpg/Makefile.am (TESTS): Order t-keylist and t-keylist-sig after t-import. * gpg/t-edit.c (edit_fnc): Work around gpg 1.2.2 bug by resetting primary uid after setting expiration date. * gpg/t-keylist.c: Change order of user IDs. * gpg/t-keylist-sig.c: Likewise. * gpg/t-import.c: Add support for gpg in CVS. --- tests/gpg/t-import.c | 76 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 17 deletions(-) (limited to 'tests/gpg/t-import.c') diff --git a/tests/gpg/t-import.c b/tests/gpg/t-import.c index 3f500a2f..bea6a0d9 100644 --- a/tests/gpg/t-import.c +++ b/tests/gpg/t-import.c @@ -105,7 +105,10 @@ check_result (gpgme_import_result_t result, char *fpr, int secret) result->new_sub_keys); exit (1); } - if (result->new_signatures != 0) + if ((secret + && ((result->secret_imported == 0 && result->new_signatures != 0) + || (result->secret_imported == 1 && result->new_signatures != 1))) + || (!secret && result->new_signatures != 0)) { fprintf (stderr, "Unexpected number of new signatures %i\n", result->new_signatures); @@ -146,10 +149,22 @@ check_result (gpgme_import_result_t result, char *fpr, int secret) result->not_imported); exit (1); } - if (!result->imports || result->imports->next) + if (secret) { - fprintf (stderr, "Unexpected number of status reports\n"); - exit (1); + if (!result->imports + || (result->imports->next && result->imports->next->next)) + { + fprintf (stderr, "Unexpected number of status reports\n"); + exit (1); + } + } + else + { + if (!result->imports || result->imports->next) + { + fprintf (stderr, "Unexpected number of status reports\n"); + exit (1); + } } if (strcmp (fpr, result->imports->fpr)) { @@ -157,25 +172,52 @@ check_result (gpgme_import_result_t result, char *fpr, int secret) result->imports->fpr); exit (1); } + if (result->imports->next && strcmp (fpr, result->imports->next->fpr)) + { + fprintf (stderr, "Unexpected fingerprint on second status %s\n", + result->imports->next->fpr); + exit (1); + } if (result->imports->result != 0) { fprintf (stderr, "Unexpected status result %s\n", gpgme_strerror (result->imports->result)); exit (1); } - if ((secret - && ((result->secret_imported == 0 - && result->imports->status != GPGME_IMPORT_SECRET) - || (result->secret_imported == 1 - && result->imports->status != (GPGME_IMPORT_SECRET | GPGME_IMPORT_NEW)))) - || (!secret - && ((result->imported == 0 && result->imports->status != 0) - || (result->imported == 1 - && result->imports->status != GPGME_IMPORT_NEW)))) - { - fprintf (stderr, "Unexpected status %i\n", - result->imports->status); - exit (1); + if (secret) + { + if (result->secret_imported == 0) + { + if (result->imports->status != GPGME_IMPORT_SECRET) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } + } + else + { + if (result->imports->status + != (GPGME_IMPORT_SECRET | GPGME_IMPORT_NEW) + || !result->imports->next + || result->imports->next->status != GPGME_IMPORT_SIG) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } + } + } + else + { + if ((result->imported == 0 && result->imports->status != 0) + || (result->imported == 1 + && result->imports->status != GPGME_IMPORT_NEW)) + { + fprintf (stderr, "Unexpected status %i\n", + result->imports->status); + exit (1); + } } } -- cgit v1.2.3