diff options
author | Zara Gebru <zgebru@thoughtworks.com> | 2016-07-13 20:20:52 +0200 |
---|---|---|
committer | Zara Gebru <zgebru@thoughtworks.com> | 2016-07-13 20:35:55 +0200 |
commit | 59263baee9fc04524c8a69af1f7293fa4315d3ff (patch) | |
tree | b01cf32a0a95a11b3ea9bd279c2b251a1fb5b58e /test/unit | |
parent | a96a8f552074e8a624f1420d2f58db4e90c3762c (diff) |
[FEATURE] fetch key by fingerprint
- add fingerprint unit tests
- add integration test
- implement by_fingerprint
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/request_handler_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/request_handler_test.rb b/test/unit/request_handler_test.rb index 11cc59b..420e74b 100644 --- a/test/unit/request_handler_test.rb +++ b/test/unit/request_handler_test.rb @@ -27,6 +27,28 @@ class Nickserver::RequestHandlerTest < Minitest::Test end end + def test_fingerprint_to_short + handle fingerprint: ['44F2F455E28'] + assert_response status: 500, content: "500 Fingerprint invalid: 44F2F455E28\n" + end + + def test_fingerprint_is_not_hex + handle fingerprint: ['X36E738D69173C13Z709E44F2F455E2824D18DDX'] + assert_response status: 500, + content: "500 Fingerprint invalid: X36E738D69173C13Z709E44F2F455E2824D18DDX\n" + end + + def test_get_key_with_fingerprint_from_hkp + handle fingerprint: ['E36E738D69173C13D709E44F2F455E2824D18DDF'] + source = Minitest::Mock.new + source.expect :get_key_by_fingerprint, + Nickserver::Response.new(200, "fake fingerprint"), + ['E36E738D69173C13D709E44F2F455E2824D18DDF'] + Nickserver::Hkp::Source.stub :new, source do + assert_response status: 200, content: "200 fake fingerprint" + end + end + protected def handle(params = {}) |