Project

General

Profile

Actions

action #50606

closed

[sle] Refine GnuPG case to use a better solution for interactive command

Added by whdu about 5 years ago. Updated almost 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Bugs in existing tests
Target version:
-
Start date:
2019-04-22
Due date:
% Done:

0%

Estimated time:
Difficulty:

Description

Now, tests/console/gpg.pm uses a "blind input" method for the user interactive of key generating. It is not elegant, unstable prone, and not friendly for debugging. Some other methods we usually use, eg. disable pipe buffer with 'unbuffer' command or typescript, do not work on gpg.

Unless we really want to test the user interface for key generating, we could always use --batch arguement to make gpg get all the necessary user input value include passphrase from a file.

A simple input file format could be like:

$ cat >foo <<EOF
    %echo Generating a standard key
    Key-Type: default
    Key-Length: 2048
    Subkey-Type: default
    Subkey-Length: 2048
    Name-Real: SUSE Tester
    Name-Email: tester@suse.de
    Passphrase: testingpassword
    Expire-Date: 0
EOF

Then generate the key with

$ gpg --batch --gen-key foo
Actions

Also available in: Atom PDF