From: Marcus Brinkmann Date: Thu, 1 Aug 2002 16:02:19 +0000 (+0000) Subject: 2002-08-01 Marcus Brinkmann X-Git-Tag: gpgme-0-3-9~18 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9285922de0c330d77ad4126122c7a4a672fad18a;p=gpgme.git 2002-08-01 Marcus Brinkmann * gpg/t-edit.c: Also add a test for the expire command (testing the passphrase callback). --- diff --git a/tests/ChangeLog b/tests/ChangeLog index 309ee09..53d427b 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2002-08-01 Marcus Brinkmann + + * gpg/t-edit.c: Also add a test for the expire command (testing + the passphrase callback). + 2002-07-28 Marcus Brinkmann * gpg/t-edit.c: New file. diff --git a/tests/gpg/t-edit.c b/tests/gpg/t-edit.c index b5f93e2..4a22955 100644 --- a/tests/gpg/t-edit.c +++ b/tests/gpg/t-edit.c @@ -78,26 +78,42 @@ GpgmeError edit_fnc (void *opaque, GpgmeStatusCode status, const char *args, const char **result) { GpgmeData out = (GpgmeData) opaque; - static int step = 0; fputs ("[-- Response --]\n", stdout); flush_data (out); fprintf (stdout, "[-- Code: %i, %s --]\n", status, args); - if (result) - { - switch (step) - { - case 0: - *result = "fpr"; - break; - case 1: - *result = "quit"; - break; - } - step++; - } + if (result) + { + if (!strcmp (args, "keyedit.prompt")) + { + static int step = 0; + + switch (step) + { + case 0: + *result = "fpr"; + break; + case 1: + *result = "expire"; + break; + default: + *result = "quit"; + break; + } + step++; + } + else if (!strcmp (args, "keyedit.save.okay")) + { + *result = "Y"; + } + else if (!strcmp (args, "keygen.valid")) + { + *result = "0"; + } + } + return 0; } @@ -110,7 +126,7 @@ main (int argc, char **argv) GpgmeData out = NULL; GpgmeKey key = NULL; struct passphrase_cb_info_s info; - const char *pattern = "Whisky"; + const char *pattern = "Alpha"; char *p; do