aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2023-08-14 09:39:27 +0000
committerIngo Klöcker <[email protected]>2023-08-14 12:04:44 +0000
commit150a2f9e4e5afe359fec2bbb017f6d0cfa7ca4a7 (patch)
tree3b0bcbd52af55bc192e1c5b221367bc263fb162d
parentcore: Use offline mode for all operations of gpgsm engine (diff)
downloadgpgme-150a2f9e4e5afe359fec2bbb017f6d0cfa7ca4a7.tar.gz
gpgme-150a2f9e4e5afe359fec2bbb017f6d0cfa7ca4a7.zip
tests: Support offline mode in run-import
* tests/run-import.c (show_usage): New option --offline. (main): Parse new option. Set offline mode accordingly. -- This allows testing gpgme_op_import with (and without) offline mode. GnuPG-bug-id: 6648
-rw-r--r--tests/run-import.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/run-import.c b/tests/run-import.c
index 931a8d6e..b0320ef8 100644
--- a/tests/run-import.c
+++ b/tests/run-import.c
@@ -46,6 +46,7 @@ show_usage (int ex)
" --verbose run in verbose mode\n"
" --openpgp use the OpenPGP protocol (default)\n"
" --cms use the CMS protocol\n"
+ " --offline use offline mode\n"
" --key-origin use the specified key origin\n"
" --url import from given URLs\n"
" -0 URLs are delimited by a nul\n"
@@ -66,6 +67,7 @@ main (int argc, char **argv)
gpgme_protocol_t protocol = GPGME_PROTOCOL_OpenPGP;
char *import_filter = NULL;
char *key_origin = NULL;
+ int offline = 0;
if (argc)
{ argc--; argv++; }
@@ -120,6 +122,11 @@ main (int argc, char **argv)
key_origin = strdup (*argv);
argc--; argv++;
}
+ else if (!strcmp (*argv, "--offline"))
+ {
+ offline = 1;
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);
@@ -134,6 +141,8 @@ main (int argc, char **argv)
fail_if_err (err);
gpgme_set_protocol (ctx, protocol);
+ gpgme_set_offline (ctx, offline);
+
if (import_filter)
{
err = gpgme_set_ctx_flag (ctx, "import-filter", import_filter);