summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkytv <killyourtv@i2pmail.org>2015-07-09 10:30:42 +0000
committerkytv <killyourtv@i2pmail.org>2015-07-09 20:57:45 +0000
commit661457b6d58f325b9be93fbcb24123106e9b9ef8 (patch)
tree807f2342e01d16a7c7b0293771d924bf9d6fece5
parentac9ecf21689a2fc9a646d2cf2f88376692463d67 (diff)
Use the force_new_tor_circuit function where it makes sense
-rw-r--r--features/step_definitions/pidgin.rb8
-rw-r--r--features/step_definitions/torified_gnupg.rb30
2 files changed, 15 insertions, 23 deletions
diff --git a/features/step_definitions/pidgin.rb b/features/step_definitions/pidgin.rb
index 7407d8c..cbfbea1 100644
--- a/features/step_definitions/pidgin.rb
+++ b/features/step_definitions/pidgin.rb
@@ -296,8 +296,8 @@ end
Then /^Pidgin successfully connects to the "([^"]+)" account$/ do |account|
next if @skip_steps_while_restoring_background
expected_channel_entry = chan_image(account, default_chan(account), 'roster')
- tries = 0
- until tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
+ @new_circuit_tries = 0
+ until @new_circuit_tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
# Sometimes the OFTC welcome notice window pops up over the buddy list one...
begin
@vm.focus_window('Buddy List')
@@ -313,9 +313,7 @@ Then /^Pidgin successfully connects to the "([^"]+)" account$/ do |account|
@screen.wait(expected_channel_entry, 60)
break
rescue FindFailed
- tries += 1
- STDERR.puts "Forcing new Tor circuit... (attempt ##{tries})" if $config["DEBUG"]
- step "I force Tor to use a new circuit"
+ force_new_tor_circuit
@screen.wait_and_click('PidginReconnect.png', 20)
end
end
diff --git a/features/step_definitions/torified_gnupg.rb b/features/step_definitions/torified_gnupg.rb
index fe27ebd..51eb4da 100644
--- a/features/step_definitions/torified_gnupg.rb
+++ b/features/step_definitions/torified_gnupg.rb
@@ -50,20 +50,18 @@ When /^I fetch the "([^"]+)" OpenPGP key using the GnuPG CLI( without any signat
else
importopts = ''
end
- tries = 0
- until tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
+ @new_circuit_tries = 0
+ until @new_circuit_tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
begin
@gnupg_recv_key_res = @vm.execute_successfully(
"gpg --batch #{importopts} --recv-key '#{keyid}'",
LIVE_USER)
break
rescue ExecutionFailedInVM
- tries += 1
- STDERR.puts "Forcing new Tor circuit... (attempt ##{tries})" if $config["DEBUG"]
- step 'I force Tor to use a new circuit'
+ force_new_tor_circuit
end
end
- assert(tries <= $config["MAX_NEW_TOR_CIRCUIT_RETRIES"], "Fetching keys with the GnuPG CLI did not succeed after retrying #{tries} times")
+ assert(@new_circuit_tries < $config["MAX_NEW_TOR_CIRCUIT_RETRIES"], "Fetching keys with the GnuPG CLI did not succeed after retrying #{@new_circuit_tries} times")
end
When /^the GnuPG fetch is successful$/ do
@@ -112,8 +110,8 @@ end
Then /^I synchronize keys in Seahorse$/ do
next if @skip_steps_while_restoring_background
- tries = 0
- until tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
+ @new_circuit_tries = 0
+ until @new_circuit_tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
begin
step 'process "seahorse" is running'
@screen.wait_and_click("SeahorseWindow.png", 10)
@@ -124,7 +122,7 @@ Then /^I synchronize keys in Seahorse$/ do
seahorse_wait_helper('SeahorseWindow.png', 5*60)
break
rescue OpenPGPKeyserverCommunicationError
- tries += 1
+ force_new_tor_circuit
@screen.wait_and_click('GnomeCloseButton.png', 20)
if @screen.exists('SeahorseSynchronizing.png')
# Seahorse is likely to segfault if we end up here.
@@ -132,11 +130,9 @@ Then /^I synchronize keys in Seahorse$/ do
@screen.type(Sikuli::Key.ESC)
end
seahorse_wait_helper('SeahorseWindow.png')
- STDERR.puts "Forcing new Tor circuit... (attempt ##{tries})" if $config["DEBUG"]
- step 'I force Tor to use a new circuit'
end
end
- assert(tries <= $config["MAX_NEW_TOR_CIRCUIT_RETRIES"], "Syncing keys in Seahorse did not succeed after retrying #{tries} times")
+ assert(@new_circuit_tries < $config["MAX_NEW_TOR_CIRCUIT_RETRIES"], "Syncing keys in Seahorse did not succeed after retrying #{@new_circuit_tries} times")
end
When /^I fetch the "([^"]+)" OpenPGP key using Seahorse( via the Tails OpenPGP Applet)?$/ do |keyid, withgpgapplet|
@@ -147,8 +143,8 @@ When /^I fetch the "([^"]+)" OpenPGP key using Seahorse( via the Tails OpenPGP A
step "I start Seahorse"
end
step "Seahorse has opened"
- tries = 0
- until tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
+ @new_circuit_tries = 0
+ until @new_circuit_tries == $config["MAX_NEW_TOR_CIRCUIT_RETRIES"] do
begin
@screen.wait_and_click("SeahorseWindow.png", 10)
seahorse_menu_click_helper('SeahorseRemoteMenu.png', 'SeahorseRemoteMenuFind.png', 'seahorse')
@@ -169,15 +165,13 @@ When /^I fetch the "([^"]+)" OpenPGP key using Seahorse( via the Tails OpenPGP A
@screen.click("SeahorseImport.png")
break
rescue OpenPGPKeyserverCommunicationError
- tries += 1
+ force_new_tor_circuit
@screen.wait_and_click('GnomeCloseButton.png', 20)
@screen.type(Sikuli::Key.ESC)
@screen.type("w", Sikuli::KeyModifier.CTRL)
- STDERR.puts "Forcing new Tor circuit... (attempt ##{tries})" if $config["DEBUG"]
- step 'I force Tor to use a new circuit'
end
end
- assert(tries <= $config["MAX_NEW_TOR_CIRCUIT_RETRIES"], "Fetching keys in Seahorse did not succeed after retrying #{tries} times")
+ assert(@new_circuit_tries < $config["MAX_NEW_TOR_CIRCUIT_RETRIES"], "Fetching keys in Seahorse did not succeed after retrying #{@new_circuit_tries} times")
end
Then /^Seahorse is configured to use the correct keyserver$/ do