Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix missing argument quotes in test helper. Add assert for successful…

… read-back after passwd command.
  • Loading branch information...
commit dfcfe73073df804faa04c4f9a4ad16b6a835e1d8 1 parent 74a2ad2
Nicholas E. Rabenau authored
Showing with 8 additions and 6 deletions.
  1. +4 −2 test/acceptance/test_passwd.rb
  2. +4 −4 test/helper.rb
View
6 test/acceptance/test_passwd.rb
@@ -7,15 +7,17 @@ def test_blank_password
end
def test_standard
+ assert_successful('', 'put foo bar')
+
new_pwd = store_password.reverse
# If we are in a pipe (and we are in these tests), the new password is expected as first arg
- assert_successful('^$', "passwd #{new_pwd}")
+ assert_successful('^$', "passwd \"#{new_pwd}\"")
# the old password must not work anymore
assert_error('The master password is wrong', 'list')
# re-open with the changed password
-# assert_successful('', '')
+ assert_successful('^bar$', 'get foo', new_pwd)
end
end
View
8 test/helper.rb
@@ -53,21 +53,21 @@ class AppTestCase < TestCase
protected
def assert_successful(expected_out, cmd, password = store_password)
- out, err, rc = execute(cmd)
+ out, err, rc = execute(cmd, password)
assert_equal(0, rc.exitstatus, "Expected exit status 0, but it was #{rc.exitstatus}. STDERR was: #{err}")
assert(err.empty?, "Expected empty STDERR, but it yielded #{err}")
assert(out =~ /#{expected_out}/, "'#{out}' did not match expected response '#{expected_out}'")
end
def assert_error(expected_err, cmd, password = store_password)
- out, err, rc = execute(cmd)
+ out, err, rc = execute(cmd, password)
assert_not_equal(0, rc.exitstatus, "Expected non-zero exit status, but it was #{rc.exitstatus}. STDOUT was: #{out}")
assert(out.empty?, "Expected empty STDOUT, but it yielded #{out}")
assert(err =~ /#{expected_err}/, "'#{err}' did not match expected response '#{expected_err}'")
end
- def execute(cmd, password = store_password)
- Open3.capture3("echo #{password} | #{APP} #{cmd} --file #{store_file}")
+ def execute(cmd, password)
+ Open3.capture3("echo \"#{password}\" | #{APP} #{cmd} --file \"#{store_file}\"")
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.