diff options
author | elijah <elijah@riseup.net> | 2013-08-05 02:27:23 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-08-05 02:27:23 -0700 |
commit | f5e6e60cbea2db77d275e34c3e61c590b49dbf48 (patch) | |
tree | bfde744068bfa1b2a07c6e4035b5f56d6c01a9e2 /test | |
parent | d355aca3f2d913e6fad9913064f217b45afb8061 (diff) |
fix bug with couchdb result parsing
Diffstat (limited to 'test')
-rw-r--r-- | test/files/empty_couchdb_result | 5 | ||||
-rw-r--r-- | test/unit/nickserver_test.rb | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/files/empty_couchdb_result b/test/files/empty_couchdb_result new file mode 100644 index 0000000..5cde81a --- /dev/null +++ b/test/files/empty_couchdb_result @@ -0,0 +1,5 @@ +{ + "total_rows":2, + "offset":2, + "rows":[] +} diff --git a/test/unit/nickserver_test.rb b/test/unit/nickserver_test.rb index 46e69ca..6a23d0d 100644 --- a/test/unit/nickserver_test.rb +++ b/test/unit/nickserver_test.rb @@ -60,6 +60,20 @@ class NickserverTest < MiniTest::Unit::TestCase end end + def test_GET_served_via_couch_empty_results + domain = "example.org" + uid = "stompy@" + domain + stub_couch_response(uid, :body => file_content(:empty_couchdb_result)) do + start do + params = {:query => {"address" => uid}, :head => {:host => domain}} + get(params) do |http| + assert_equal 404, http.response_header.status + stop + end + end + end + end + def test_GET_served_via_couch_success domain = "example.org" uid = "blue@" + domain |