summaryrefslogtreecommitdiff
path: root/test/remote
diff options
context:
space:
mode:
Diffstat (limited to 'test/remote')
-rw-r--r--test/remote/celluloid_http_test.rb27
-rw-r--r--test/remote/hkp_source_test.rb49
-rw-r--r--test/remote/nicknym_source_test.rb4
3 files changed, 77 insertions, 3 deletions
diff --git a/test/remote/celluloid_http_test.rb b/test/remote/celluloid_http_test.rb
new file mode 100644
index 0000000..46a5259
--- /dev/null
+++ b/test/remote/celluloid_http_test.rb
@@ -0,0 +1,27 @@
+require 'test_helper'
+require 'nickserver/adapters/celluloid_http'
+
+class Nickserver::Adapters::CelluloidHttpTest < Minitest::Test
+
+ def setup
+ super
+ Celluloid.boot
+ end
+
+ def teardown
+ Celluloid.shutdown
+ super
+ end
+
+ def test_https_for_hkp
+ url = Nickserver::Config.hkp_url
+ status, _body = adapter.get url
+ assert_equal 404, status
+ end
+
+ protected
+
+ def adapter
+ @adapter ||= Nickserver::Adapters::CelluloidHttp.new
+ end
+end
diff --git a/test/remote/hkp_source_test.rb b/test/remote/hkp_source_test.rb
new file mode 100644
index 0000000..aabc4d3
--- /dev/null
+++ b/test/remote/hkp_source_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+require 'nickserver/hkp/source'
+
+class RemoteHkpSourceTest < Minitest::Test
+
+ def setup
+ super
+ Celluloid.boot
+ end
+
+ def teardown
+ Celluloid.shutdown
+ super
+ end
+
+ def test_key_info
+ uid = 'elijah@riseup.net'
+ assert_key_info_for_uid uid do |keys|
+ assert_equal 1, keys.size
+ assert keys.first.keyid =~ /00440025$/
+ end
+ end
+
+ def test_tls_validation
+ hkp_url = 'https://keys.mayfirst.org/pks/lookup'
+ ca_file = file_path('mayfirst-ca.pem')
+
+ config.stub(:hkp_url, hkp_url) do
+ config.stub(:hkp_ca_file, ca_file) do
+ #config.stub(:hkp_ca_file, file_path('autistici-ca.pem')) do
+ assert File.exist?(Nickserver::Config.hkp_ca_file)
+ uid = 'elijah@riseup.net'
+ assert_key_info_for_uid uid do |keys|
+ assert_equal 1, keys.size
+ assert keys.first.keyid =~ /00440025$/
+ end
+ end
+ end
+ end
+
+ protected
+
+ def assert_key_info_for_uid(uid, &block)
+ Nickserver::Hkp::Source.new.search uid do |status, keys|
+ assert_equal 200, status
+ yield keys
+ end
+ end
+end
diff --git a/test/remote/nicknym_source_test.rb b/test/remote/nicknym_source_test.rb
index 0c6df65..e516895 100644
--- a/test/remote/nicknym_source_test.rb
+++ b/test/remote/nicknym_source_test.rb
@@ -14,9 +14,7 @@ class RemoteNicknymSourceTest < Minitest::Test
end
def test_truth
- real_network do
- assert source.available_for? 'mail.bitmask.net'
- end
+ assert source.available_for? 'mail.bitmask.net'
end
protected