summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZara Gebru <zgebru@thoughtworks.com>2016-07-12 12:47:15 +0200
committerZara Gebru <zgebru@thoughtworks.com>2016-07-12 12:47:15 +0200
commita96a8f552074e8a624f1420d2f58db4e90c3762c (patch)
treec2ae72a54034ad40cff5afb7efa61e4ab1968992
parent67d5d8d5257e59155d4ce3a76ef4ec315b4b2994 (diff)
[Test] get email form hkp
-rw-r--r--test/unit/request_handler_test.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/unit/request_handler_test.rb b/test/unit/request_handler_test.rb
index ef656f9..11cc59b 100644
--- a/test/unit/request_handler_test.rb
+++ b/test/unit/request_handler_test.rb
@@ -18,11 +18,20 @@ class Nickserver::RequestHandlerTest < Minitest::Test
assert_response status: 500, content: "500 HTTP request must include a Host header.\n"
end
+ def test_email_from_hkp
+ handle address: ['valid@email.tld'], headers: { "Host" => "http://nickserver.me" }
+ source = Minitest::Mock.new
+ source.expect :query, Nickserver::Response.new(200, "fake content"), [Nickserver::EmailAddress]
+ Nickserver::Hkp::Source.stub :new, source do
+ assert_response status: 200, content: "200 fake content"
+ end
+ end
+
protected
- def handle(params = {}, headers = {})
+ def handle(params = {})
+ @headers = params.delete(:headers) || {}
@params = Hash[ params.map{ |k,v| [k.to_s, v] } ]
- @headers = headers
end
def assert_response(args)