diff options
author | Azul <azul@riseup.net> | 2016-08-29 12:51:00 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-08-30 08:25:16 +0200 |
commit | cd1bbe970ca17034b0e380ff2996542e3af81e31 (patch) | |
tree | 6090adda14bee5443d164a13f8f499ae92c3ed73 /test/integration/dispatcher_test.rb | |
parent | 6e2d31e3f7c515f65d92533bcdb035438461a00c (diff) |
feature: keep trying if no Host header given
So far we would error out if no host was specified in the config or
the request. It's true that we can't do local lookup if we don't
know our own domain. However we can still use HKP.
In the future we will query leaps own API for other providers. If the
host was not set in the initial request we might even proxy a request to
ourselves. Providing the Host header will prevent an infinite loop in
that case.
Diffstat (limited to 'test/integration/dispatcher_test.rb')
-rw-r--r-- | test/integration/dispatcher_test.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/integration/dispatcher_test.rb b/test/integration/dispatcher_test.rb index 60d252b..4ec823b 100644 --- a/test/integration/dispatcher_test.rb +++ b/test/integration/dispatcher_test.rb @@ -15,16 +15,12 @@ class Nickserver::DispatcherTest < Minitest::Test def test_missing_domain handle address: ['valid@email.tld'] - assert_response status: 500, content: "500 HTTP request must include a Host header.\n" + assert_response_from_hkp 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 + assert_response_from_hkp end def test_fingerprint_to_short @@ -62,6 +58,14 @@ class Nickserver::DispatcherTest < Minitest::Test responder.verify end + def assert_response_from_hkp + 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 + def dispatcher Nickserver::Dispatcher.new responder end |