summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2018-02-05 11:25:33 +0100
committerAzul <azul@riseup.net>2018-02-05 11:58:26 +0100
commit5ab2095a169a867b1158a77181dd447b2bbf2118 (patch)
treebb2280cd6063547b3240c9f62d17ecdd264ddb59 /test/integration
parent51d41e15dca8aac3c96ab68b1cec22415a8ceae9 (diff)
feature: enamble wkd lookupfeature/web-key-directory
fixes #1
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/dispatcher_test.rb27
-rw-r--r--test/integration/nickserver_test.rb1
2 files changed, 18 insertions, 10 deletions
diff --git a/test/integration/dispatcher_test.rb b/test/integration/dispatcher_test.rb
index 1973e84..0fb395a 100644
--- a/test/integration/dispatcher_test.rb
+++ b/test/integration/dispatcher_test.rb
@@ -37,30 +37,31 @@ class Nickserver::DispatcherTest < Minitest::Test
def test_missing_domain
handle address: ['valid@email.tld']
stub_nicknym_not_available
- hkp_source.expect :query, success, [Nickserver::EmailAddress]
+ wkd_source.expect :query, success, [Nickserver::EmailAddress]
assert_response success
end
- def test_email_via_hkp
+ def test_email_via_wkd
handle address: ['valid@email.tld'],
headers: { 'Host' => 'http://nickserver.me' }
stub_nicknym_not_available
- hkp_source.expect :query, success, [Nickserver::EmailAddress]
+ wkd_source.expect :query, success, [Nickserver::EmailAddress]
assert_response success
end
- def test_email_via_hkp_nicknym_unreachable
+ def test_email_via_wkd_nicknym_unreachable
handle address: ['valid@email.tld'],
headers: { 'Host' => 'http://nickserver.me' }
stub_nicknym_raises
- hkp_source.expect :query, success, [Nickserver::EmailAddress]
+ wkd_source.expect :query, success, [Nickserver::EmailAddress]
assert_response success
end
- def test_email_not_found_hkp_nicknym_unreachable
+ def test_email_not_found_wkd_nicknym_unreachable
handle address: ['valid@email.tld'],
headers: { 'Host' => 'http://nickserver.me' }
stub_nicknym_raises
+ wkd_source.expect :query, nil, [Nickserver::EmailAddress]
hkp_source.expect :query, nil, [Nickserver::EmailAddress]
assert_response http_connection_error
end
@@ -90,14 +91,20 @@ class Nickserver::DispatcherTest < Minitest::Test
def assert_response(response)
Nickserver::Nicknym::Source.stub :new, nicknym_source do
- Nickserver::Hkp::Source.stub :new, hkp_source do
- responder.expect :respond, nil, [response.status, response.content]
- dispatcher.respond_to @params, @headers
- responder.verify
+ Nickserver::Wkd::Source.stub :new, wkd_source do
+ Nickserver::Hkp::Source.stub :new, hkp_source do
+ responder.expect :respond, nil, [response.status, response.content]
+ dispatcher.respond_to @params, @headers
+ responder.verify
+ end
end
end
end
+ def wkd_source
+ @wkd_source ||= Minitest::Mock.new
+ end
+
def hkp_source
@hkp_source ||= Minitest::Mock.new
end
diff --git a/test/integration/nickserver_test.rb b/test/integration/nickserver_test.rb
index 832a68c..29a3561 100644
--- a/test/integration/nickserver_test.rb
+++ b/test/integration/nickserver_test.rb
@@ -30,6 +30,7 @@ class NickserverTest < CelluloidTest
uid = 'cloudadmin@leap.se'
key_id = 'E818C478D3141282F7590D29D041EB11B1647490'
stub_nicknym_available_response 'leap.se', status: 404
+ stub_wkd_response uid, status: 404
stub_sks_vindex_reponse(uid, body: file_content(:leap_vindex_result))
stub_sks_get_reponse(key_id, body: file_content(:leap_public_key))