aboutsummaryrefslogtreecommitdiffstats
path: root/test/plum/client/test_client.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-01-24 14:51:02 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-01-26 14:08:18 +0900
commitc237ea8d6672617e86afc132ca9e06b1013ac1c1 (patch)
tree19e86ef7f01c09b6233fe65e6b219db2fc522cc5 /test/plum/client/test_client.rb
parent9190801a092d46c7079ccee201b212b2d7985952 (diff)
downloadplum-c237ea8d6672617e86afc132ca9e06b1013ac1c1.tar.gz
Cleanup projectrestart
Switch test framework, remove unnecessary files, remove unnecessary magic comments.
Diffstat (limited to 'test/plum/client/test_client.rb')
-rw-r--r--test/plum/client/test_client.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/plum/client/test_client.rb b/test/plum/client/test_client.rb
index c6c7af7..97a5176 100644
--- a/test/plum/client/test_client.rb
+++ b/test/plum/client/test_client.rb
@@ -1,15 +1,15 @@
-require "test_helper"
+require_relative "../../utils"
-using Plum::BinaryString
-class ClientTest < Minitest::Test
+using BinaryString
+class ClientTest < Test::Unit::TestCase
def test_request_async
res2 = nil
client = nil
server_thread = start_tls_server
Client.start("127.0.0.1", LISTEN_PORT, https: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |c|
client = c
- res1 = client.request({ ":path" => "/", ":method" => "GET", ":scheme" => "https", "header" => "ccc" }, nil) { |res1|
- assert(res1.headers)
+ res1 = client.request({ ":path" => "/", ":method" => "GET", ":scheme" => "https", "header" => "ccc" }, nil) { |res1x|
+ assert(res1x.headers)
}
assert_nil(res1.headers)
@@ -35,7 +35,7 @@ class ClientTest < Minitest::Test
def test_raise_error_async_seq_resume
server_thread = start_tls_server
client = Client.start("127.0.0.1", LISTEN_PORT, https: true, verify_mode: OpenSSL::SSL::VERIFY_NONE)
- res = client.get("/error_in_data")
+ client.get("/error_in_data")
assert_raises(LocalConnectionError) {
client.resume
}
@@ -73,12 +73,12 @@ class ClientTest < Minitest::Test
def start_tls_server(&block)
ctx = OpenSSL::SSL::SSLContext.new
ctx.alpn_select_cb = -> protocols { "h2" }
- ctx.cert = TLS_CERT
- ctx.key = TLS_KEY
+ ctx.cert = issue_cert("CN=localhost", rsa2048)
+ ctx.key = rsa2048
tcp_server = TCPServer.new("127.0.0.1", LISTEN_PORT)
ssl_server = OpenSSL::SSL::SSLServer.new(tcp_server, ctx)
- server_thread = Thread.new {
+ Thread.new {
plum = nil
begin
Timeout.timeout(1) {
@@ -117,7 +117,7 @@ class ClientTest < Minitest::Test
rescue OpenSSL::SSL::SSLError
rescue Timeout::Error
flunk "server timeout"
- rescue ExampleError => e
+ rescue ExampleError
plum.goaway(:internal_error) if plum
ensure
tcp_server.close