diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-03-27 09:55:13 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-03-27 09:55:13 +0000 |
commit | bb13725e3e678efccd0ed6f5cb0c9e5cc4c218fb (patch) | |
tree | 04fb6685d25f7ed15732941241c08869a4bdb4bf /yarns/9000-implements.yarn | |
parent | 085919ac9dd04af99e48f73151a912b94c0c5cc7 (diff) | |
parent | 3b2e8a7328f00b217c72a5e479b50ebc0ab507d9 (diff) | |
download | obnam-bb13725e3e678efccd0ed6f5cb0c9e5cc4c218fb.tar.gz |
Convert encryption-replaces-key cmdtest to yarn
Merge branch 'liw/enc-cmdtest-conv'
Diffstat (limited to 'yarns/9000-implements.yarn')
-rw-r--r-- | yarns/9000-implements.yarn | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index 121627a6..5591370f 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -179,7 +179,18 @@ use. We store that. mkdir "$DATADIR/$MATCH_1.gnupg" cp -a "$SRCDIR/$MATCH_3/." "$DATADIR/$MATCH_1.gnupg/." add_to_env "$MATCH_1" GNUPGHOME "$DATADIR/$MATCH_1.gnupg" + else + # Export public and secret keys from new keyring. + export GNUPGHOME="$SRCDIR/$MATCH_3" + gpg --export "$MATCH_2" > "$DATADIR/public.key" + gpg --export-secret-keys "$MATCH_2" > "$DATADIR/secret.key" + + # Import into the keyring uses for tests. + export GNUPGHOME="$DATADIR/$MATCH_1.gnupg" + gpg --import "$DATADIR/public.key" + gpg --import "$DATADIR/secret.key" fi + add_to_config "$MATCH_1" encrypt-with "$MATCH_2" Encryption scenarions, at least, also need users that pretend to be @@ -395,10 +406,35 @@ Import a key into one user's keyring from another keyring. GNUPGHOME="$SRCDIR/$MATCH_3" gpg --export --armor "$MATCH_2" | GNUPGHOME="$DATADIR/$MATCH_1.gnupg" gpg --import -Add a public key to a repository. +Add a public key to a repository, but not to the calling user, only to +the shared parts. + + IMPLEMENTS WHEN user (\S+) adds key "(.+)" to repository (\S+) only + run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_3" \ + add-key --keyid "$MATCH_2" + +Add a public key to a repository, and the calling user. + + IMPLEMENTS WHEN user (\S+) adds key "(.+)" to repository (\S+) and self + run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_3" \ + add-key --keyid "$MATCH_2" "$MATCH_1" + +Remove a public key from a repository. - IMPLEMENTS WHEN user (\S+) adds key "(.+)" to repository (\S+) - run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_3" add-key --keyid "$MATCH_2" + IMPLEMENTS WHEN user (\S+) removes key "(.+)" from repository (\S+) + export GNUPGHOME="$DATADIR/$MATCH_1.gnupg" + keyid="$( + get_fingerprint "$MATCH_2" | + awk '{ print substr($0, length-16) }')" + run_obnam "$MATCH_1" -r "$DATADIR/$MATCH_3" \ + remove-key --keyid "$keyid" \ + +Forget a key from the user's keyring. + + IMPLEMENTS WHEN user (\S+) no longer has key "(.+)" + export GNUPGHOME="$DATADIR/$MATCH_1.gnupg" + fingerprint="$(get_fingerprint "$MATCH_2")" + gpg --batch --delete-secret-key "$fingerprint" Client management ----------------- @@ -443,6 +479,15 @@ test the results in various ways as separate steps. IMPLEMENTS THEN the attempt failed with exit code (\d+) attempt_exit_was "$MATCH_1" +We want to match the stdout against a regular expression. + + IMPLEMENTS THEN the output matches "(.+)" + echo ----------------------- + echo stdout being matched: + cat "$DATADIR/attempt.stdout" + echo ----------------------- + attempt_matches stdout "$MATCH_1" + We can also match the stderr against a regular expression. IMPLEMENTS THEN the error message matches "(.+)" @@ -535,4 +580,3 @@ Run the Nagios monitoring subcommand. IMPLEMENTS WHEN user (\S+) attempts nagios-last-backup-age against repository (\S+) attempt run_obnam "$MATCH_1" nagios-last-backup-age \ -r "$DATADIR/$MATCH_2" - |