diff options
author | Tails developers <amnesia@boum.org> | 2014-12-19 00:40:08 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2014-12-21 09:45:40 +0100 |
commit | 51680b6ebb645d37ebdfcd122ca163b3a638aefa (patch) | |
tree | 337e128d2eac3cbc89ecbacf38851bfa33469cd5 /features/step_definitions/i2p.rb | |
parent | 44bab3c86ca3d95837f4c50cc535206352385a46 (diff) | |
download | jenkins.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/i2p.rb')
-rw-r--r-- | features/step_definitions/i2p.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/features/step_definitions/i2p.rb b/features/step_definitions/i2p.rb new file mode 100644 index 00000000..0b8a8d3c --- /dev/null +++ b/features/step_definitions/i2p.rb @@ -0,0 +1,60 @@ +Given /^I2P is running$/ do + next if @skip_steps_while_restoring_background + try_for(30) do + @vm.execute('service i2p status').success? + end +end + +Given /^the I2P router console is ready$/ do + next if @skip_steps_while_restoring_background + try_for(60) do + @vm.execute('. /usr/local/lib/tails-shell-library/i2p.sh; ' + + 'i2p_router_console_is_ready').success? + end +end + +When /^I start the I2P Browser through the GNOME menu$/ do + next if @skip_steps_while_restoring_background + @screen.wait_and_click("GnomeApplicationsMenu.png", 10) + @screen.wait_and_click("GnomeApplicationsInternet.png", 10) + @screen.wait_and_click("GnomeApplicationsI2PBrowser.png", 20) +end + +Then /^the I2P Browser desktop file is (|not )present$/ do |mode| + next if @skip_steps_while_restoring_background + file = '/usr/share/applications/i2p-browser.desktop' + if mode == '' + assert(@vm.execute("test -e #{file}").success?) + elsif mode == 'not ' + assert(@vm.execute("! test -e #{file}").success?) + else + raise "Unsupported mode passed: '#{mode}'" + end +end + +Then /^the I2P Browser sudo rules are (enabled|not present)$/ do |mode| + next if @skip_steps_while_restoring_background + file = '/etc/sudoers.d/zzz_i2pbrowser' + if mode == 'enabled' + assert(@vm.execute("test -e #{file}").success?) + elsif mode == 'not present' + assert(@vm.execute("! test -e #{file}").success?) + else + raise "Unsupported mode passed: '#{mode}'" + end +end + +Then /^the I2P firewall rules are (enabled|disabled)$/ do |mode| + next if @skip_steps_while_restoring_background + i2p_username = 'i2psvc' + i2p_uid = @vm.execute("getent passwd #{i2p_username} | awk -F ':' '{print $3}'").stdout.chomp + accept_rules = @vm.execute("iptables -L -n -v | grep -E '^\s+[0-9]+\s+[0-9]+\s+ACCEPT.*owner UID match #{i2p_uid}$'").stdout + accept_rules_count = accept_rules.lines.count + if mode == 'enabled' + assert_equal(13, accept_rules_count) + elsif mode == 'disabled' + assert_equal(0, accept_rules_count) + else + raise "Unsupported mode passed: '#{mode}'" + end +end |