summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/empty_couchdb_result5
-rw-r--r--test/unit/nickserver_test.rb14
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