diff options
Diffstat (limited to 'tests/gpg')
| -rw-r--r-- | tests/gpg/Makefile.am | 6 | ||||
| -rw-r--r-- | tests/gpg/t-edit.c | 11 | ||||
| -rw-r--r-- | tests/gpg/t-import.c | 76 | ||||
| -rw-r--r-- | tests/gpg/t-keylist-sig.c | 12 | ||||
| -rw-r--r-- | tests/gpg/t-keylist.c | 6 | 
5 files changed, 83 insertions, 28 deletions
| diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index 9120785a..11ab0b03 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -23,9 +23,11 @@ GPG = @GPG@  TESTS_ENVIRONMENT = GNUPGHOME=. GPG_AGENT_INFO= +# The keylist test must come after the import test.  TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers	\ -	t-decrypt t-verify t-decrypt-verify t-keylist t-keylist-sig \ -	t-export t-import t-trustlist t-eventloop t-edit +	t-decrypt t-verify t-decrypt-verify \ +	t-export t-import t-trustlist t-eventloop t-edit \ +	t-keylist t-keylist-sig  CLEANFILES = secring.gpg pubring.gpg trustdb.gpg  DISTCLEANFILES = pubring.gpg~ random_seed diff --git a/tests/gpg/t-edit.c b/tests/gpg/t-edit.c index 74f0cde4..fb2f62fe 100644 --- a/tests/gpg/t-edit.c +++ b/tests/gpg/t-edit.c @@ -92,6 +92,17 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)  	    case 1:  	      result = "expire";  	      break; + +	      /* Work around a bug in GPG 1.2.2, which causes the +		 primary UID to change when setting the expiration +		 date.  */ +	    case 2: +	      result = "1"; +	      break; +	    case 3: +	      result = "primary"; +	      break; +  	    default:  	      result = "quit";  	      break; 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); +	}      }  } diff --git a/tests/gpg/t-keylist-sig.c b/tests/gpg/t-keylist-sig.c index 46260bfb..63251ad7 100644 --- a/tests/gpg/t-keylist-sig.c +++ b/tests/gpg/t-keylist-sig.c @@ -62,15 +62,15 @@ struct  keys[] =    {      { "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", -      { { "Alpha Test", "demo key", "[email protected]", +      { { "Alfa Test", "demo key", "[email protected]",            { GPGME_PK_DSA, "2D727CC768697734", -	    "Alpha Test", "demo key", "[email protected]", 19, 1 } }, -	{ "Alice", "demo key", NULL, +	    "Alfa Test", "demo key", "[email protected]", 19, 1 } }, +	{ "Alpha Test", "demo key", "[email protected]",            { GPGME_PK_DSA, "2D727CC768697734", -	    "Alpha Test", "demo key", "[email protected]", 19, 1 } }, -	{ "Alfa Test", "demo key", "[email protected]", +	    "Alfa Test", "demo key", "[email protected]", 19, 1 } }, +	{ "Alice", "demo key", NULL,            { GPGME_PK_DSA, "2D727CC768697734", -	    "Alpha Test", "demo key", "[email protected]", 19, 1 } } } }, +	    "Alfa Test", "demo key", "[email protected]", 19, 1 } } } },      { NULL }    }; diff --git a/tests/gpg/t-keylist.c b/tests/gpg/t-keylist.c index 45e46a0f..a4c46ae8 100644 --- a/tests/gpg/t-keylist.c +++ b/tests/gpg/t-keylist.c @@ -52,9 +52,9 @@ struct  keys[] =    {      { "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8", -      { { "Alpha Test", "demo key", "[email protected]" }, -	{ "Alice", "demo key", NULL }, -	{ "Alfa Test", "demo key", "[email protected]" } } }, +      { { "Alfa Test", "demo key", "[email protected]" }, +        { "Alpha Test", "demo key", "[email protected]" }, +	{ "Alice", "demo key", NULL } } },      { "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60",        { { "Charlie Test", "demo key", "[email protected]" } } },      { "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D", | 
