summaryrefslogtreecommitdiffstats
path: root/features/step_definitions/torified_gnupg.rb
diff options
context:
space:
mode:
authorTails developers <amnesia@boum.org>2014-12-19 00:40:08 +0100
committerHolger Levsen <holger@layer-acht.org>2014-12-21 09:45:40 +0100
commit51680b6ebb645d37ebdfcd122ca163b3a638aefa (patch)
tree337e128d2eac3cbc89ecbacf38851bfa33469cd5 /features/step_definitions/torified_gnupg.rb
parent44bab3c86ca3d95837f4c50cc535206352385a46 (diff)
downloadjenkins.debian.net-51680b6ebb645d37ebdfcd122ca163b3a638aefa.tar.xz
files copied from https://git-tails.immerda.ch/tails - many thanks to the tails developers for their nice work and documentation of it - these files have been released under the GNU General Public License version 3 or (at your option) any later version
features/images has been omitted
Diffstat (limited to 'features/step_definitions/torified_gnupg.rb')
-rw-r--r--features/step_definitions/torified_gnupg.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/features/step_definitions/torified_gnupg.rb b/features/step_definitions/torified_gnupg.rb
new file mode 100644
index 00000000..5a1462ce
--- /dev/null
+++ b/features/step_definitions/torified_gnupg.rb
@@ -0,0 +1,54 @@
+When /^the "([^"]*)" OpenPGP key is not in the live user's public keyring$/ do |keyid|
+ next if @skip_steps_while_restoring_background
+ assert(!@vm.execute("gpg --batch --list-keys '#{keyid}'", $live_user).success?,
+ "The '#{keyid}' key is in the live user's public keyring.")
+end
+
+When /^I fetch the "([^"]*)" OpenPGP key using the GnuPG CLI$/ do |keyid|
+ next if @skip_steps_while_restoring_background
+ @gnupg_recv_key_res = @vm.execute(
+ "gpg --batch --recv-key '#{keyid}'",
+ $live_user)
+end
+
+When /^the GnuPG fetch is successful$/ do
+ next if @skip_steps_while_restoring_background
+ assert(@gnupg_recv_key_res.success?,
+ "gpg keyserver fetch failed:\n#{@gnupg_recv_key_res.stderr}")
+end
+
+When /^GnuPG uses the configured keyserver$/ do
+ next if @skip_steps_while_restoring_background
+ assert(@gnupg_recv_key_res.stderr[$configured_keyserver_hostname],
+ "GnuPG's stderr did not mention keyserver #{$configured_keyserver_hostname}")
+end
+
+When /^the "([^"]*)" key is in the live user's public keyring after at most (\d+) seconds$/ do |keyid, delay|
+ next if @skip_steps_while_restoring_background
+ try_for(delay.to_f, :msg => "The '#{keyid}' key is not in the live user's public keyring") {
+ @vm.execute("gpg --batch --list-keys '#{keyid}'", $live_user).success?
+ }
+end
+
+When /^I start Seahorse$/ do
+ next if @skip_steps_while_restoring_background
+ @screen.wait_and_click("GnomeApplicationsMenu.png", 10)
+ @screen.wait_and_click("GnomeApplicationsSystem.png", 10)
+ @screen.wait_and_click("GnomeApplicationsPreferences.png", 10)
+ @screen.wait_and_click("GnomeApplicationsSeahorse.png", 10)
+end
+
+When /^I fetch the "([^"]*)" OpenPGP key using Seahorse$/ do |keyid|
+ next if @skip_steps_while_restoring_background
+ step "I start Seahorse"
+ @screen.wait("SeahorseWindow.png", 10)
+ @screen.type("r", Sikuli::KeyModifier.ALT) # Menu: "Remote" ->
+ @screen.type("f") # "Find Remote Keys...".
+ @screen.wait("SeahorseFindKeysWindow.png", 10)
+ # Seahorse doesn't seem to support searching for fingerprints
+ @screen.type(keyid + Sikuli::Key.ENTER)
+ @screen.wait("SeahorseFoundKeyResult.png", 5*60)
+ @screen.type(Sikuli::Key.DOWN) # Select first item in result menu
+ @screen.type("f", Sikuli::KeyModifier.ALT) # Menu: "File" ->
+ @screen.type("i") # "Import"
+end