diff options
author | elijah <elijah@riseup.net> | 2013-08-06 01:02:29 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-08-06 01:02:29 -0700 |
commit | be90709b114b6f1cd84b70b58b989a3f46712da4 (patch) | |
tree | d34af5f9e25d30f9eafc9ec8d882b0ca823c4db2 /test/unit | |
parent | f5e6e60cbea2db77d275e34c3e61c590b49dbf48 (diff) |
fix crash when fetched key is rejected (e.g. too short, etc), report errors in the request, prevent most crashes by catching exceptions.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/hkp_test.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/unit/hkp_test.rb b/test/unit/hkp_test.rb index 1b7b2c9..c211690 100644 --- a/test/unit/hkp_test.rb +++ b/test/unit/hkp_test.rb @@ -21,7 +21,7 @@ class HkpTest < MiniTest::Unit::TestCase def test_key_info_reject_keysize fetch_key_info :hkp_vindex_result, 'frog@leap.se' do |keys| - assert_equal 1, keys.length, 'should find one key' + assert_equal 1, keys.length, 'should find one key' # because short key gets ignored assert_equal '00440025', keys.first.keyid end end @@ -67,6 +67,17 @@ class HkpTest < MiniTest::Unit::TestCase end end + def test_fetch_key_too_short + uid = 'chiiph@leap.se' + key_id = '9A753A6B' + + stub_sks_vindex_reponse(uid, :body => file_content(:short_key_vindex_result)) + test_em_errback "Nickserver::HKP::FetchKey.new.get '#{uid}'" do |error| + assert_equal 500, error + end + end + + protected # |