summaryrefslogtreecommitdiff
path: root/test/unit/nicknym/source_test.rb
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-09-12 11:42:02 +0200
committerAzul <azul@riseup.net>2016-09-12 11:42:02 +0200
commitce09dd9c21d79e2260f9436e41f9970b42935b27 (patch)
treef620f8bf3d7386d8a5a48b1feb0a18c58269c128 /test/unit/nicknym/source_test.rb
parentf18d698d09afda894a568de79c5770704a0c9de7 (diff)
[wip] nicknym source query implemented
Also changed Nickserver::Response to not include the status code. This may be okay for error responses but in most cases we want to have a parsable message and not some status code prepended to it.
Diffstat (limited to 'test/unit/nicknym/source_test.rb')
-rw-r--r--test/unit/nicknym/source_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/nicknym/source_test.rb b/test/unit/nicknym/source_test.rb
index 586dc0e..41f5ac0 100644
--- a/test/unit/nicknym/source_test.rb
+++ b/test/unit/nicknym/source_test.rb
@@ -1,5 +1,6 @@
require 'test_helper'
require 'nickserver/nicknym/source'
+require 'nickserver/email_address'
class NicknymSourceTest < Minitest::Test
@@ -21,6 +22,15 @@ class NicknymSourceTest < Minitest::Test
adapter.verify
end
+ def test_successful_query
+ adapter.expect :get, [200, 'dummy body'],
+ ['https://nicknym.leap_powered.tld', address: email_stub.to_s]
+ response = source.query(email_stub)
+ assert_equal 200, response.status
+ assert_equal 'dummy body', response.content
+ adapter.verify
+ end
+
protected
def source
@@ -30,4 +40,8 @@ class NicknymSourceTest < Minitest::Test
def adapter
@adapter ||= Minitest::Mock.new
end
+
+ def email_stub
+ @email_stub ||= Nickserver::EmailAddress.new 'test@leap_powered.tld'
+ end
end