diff options
author | elijah <elijah@riseup.net> | 2013-05-12 23:38:36 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-05-12 23:38:36 -0700 |
commit | 887de21aeae8c784ff49c2d34fe2c7606d5bc94e (patch) | |
tree | d5ed2c9a90a2181f9fe7de4280c5b90a24a018ae /test/test_helper.rb | |
parent | 0c74967d5db0d6af89212f3c4a35c38290cf2975 (diff) |
switch to new api for nickserver (get or post, json response)
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r-- | test/test_helper.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb index 517ae78..634f1a3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -9,6 +9,8 @@ class MiniTest::Unit::TestCase # Add global extensions to the test case class here def setup + Nickserver::Config.load + # by default, mock all non-localhost network connections WebMock.disable_net_connect!(:allow_localhost => true) end @@ -25,18 +27,26 @@ class MiniTest::Unit::TestCase end end - def stub_vindex_response(uid, opts = {}) + def stub_sks_vindex_reponse(uid, opts = {}) options = {:status => 200, :body => ""}.merge(opts) stub_http_request(:get, Nickserver::Config.sks_url).with( :query => {:op => 'vindex', :search => uid, :exact => 'on', :options => 'mr', :fingerprint => 'on'} ).to_return(options) end - def stub_get_response(key_id, opts = {}) + def stub_sks_get_reponse(key_id, opts = {}) options = {:status => 200, :body => ""}.merge(opts) stub_http_request(:get, Nickserver::Config.sks_url).with( :query => {:op => 'get', :search => "0x"+key_id, :exact => 'on', :options => 'mr'} ).to_return(options) end + def stub_couch_response(uid, opts = {}) + options = {:status => 200, :body => ""}.merge(opts) + url = ['http://', Nickserver::Config.couch_host, ':', Nickserver::Config.couch_port].join + stub_http_request(:get, url).with( + :query => {:address => uid} + ).to_return(options) + end + end |