From 51680b6ebb645d37ebdfcd122ca163b3a638aefa Mon Sep 17 00:00:00 2001 From: Tails developers Date: Fri, 19 Dec 2014 00:40:08 +0100 Subject: 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 --- features/step_definitions/torified_gnupg.rb | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 features/step_definitions/torified_gnupg.rb (limited to 'features/step_definitions/torified_gnupg.rb') 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 -- cgit v1.2.3-70-g09d2