summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2016-12-02 11:25:35 +0000
committerazul <azul@riseup.net>2016-12-02 11:25:35 +0000
commit8bfd27e0c851e9786110be4e6485635f769d853f (patch)
treeaed9cc67f5711352e86d8314a4718c777a23cc43 /test/unit
parent244d8a4702f98619078c0e09e485d7e1944e5013 (diff)
parent0aa101524270c0c398fe17c287d51927f810e499 (diff)
Merge branch 'bugfix/couch-auth' into 'master'
bugfix: use user:password@ prefix in http basic auth See merge request !9
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/adapters/couch_db.rb15
-rw-r--r--test/unit/adapters/local_test.rb5
-rw-r--r--test/unit/couch_db/source_unit_test.rb11
3 files changed, 11 insertions, 20 deletions
diff --git a/test/unit/adapters/couch_db.rb b/test/unit/adapters/couch_db.rb
deleted file mode 100644
index 339e4f4..0000000
--- a/test/unit/adapters/couch_db.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'testhelper'
-require 'nickserver/adapters/couch_db'
-
-class Nickserver::Adapters::CouchDBTest < Minitest::Test
-
- def test_query_404
- adapter.query(nil) do |status, content|
- assert_equal 404, status
- end
- end
-
- def adapter
- @adapter ||= Nickserver::Adapters::CouchDB.new
- end
-end
diff --git a/test/unit/adapters/local_test.rb b/test/unit/adapters/local_test.rb
deleted file mode 100644
index 97d394f..0000000
--- a/test/unit/adapters/local_test.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'test_helper'
-require 'nickserver/adapters/local'
-
-class Nickserver::Adapters::LocalTest < Minitest::Test
-end
diff --git a/test/unit/couch_db/source_unit_test.rb b/test/unit/couch_db/source_unit_test.rb
index fd07808..e5a4f43 100644
--- a/test/unit/couch_db/source_unit_test.rb
+++ b/test/unit/couch_db/source_unit_test.rb
@@ -12,5 +12,16 @@ module Nickserver::CouchDB
Source.new(adapter).query address
adapter.verify
end
+
+ def test_401
+ address = "nick@domain.tl"
+ adapter = Minitest::Mock.new
+ adapter.expect :get, [401, nil],
+ [String, {query: { reduce: "false", key: "\"#{address}\"" }}]
+ assert_raises Error do
+ Source.new(adapter).query address
+ end
+ adapter.verify
+ end
end
end