diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-09 17:26:55 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-09 17:26:55 +0900 |
commit | 9bf2c8a0b1c1bf1010de5dea0c37627f7abd4944 (patch) | |
tree | fdfce7386d63c39ba6d98088629a7f34dc00f53a /test | |
parent | 0d379e8d343df0e21ed93ebd52bf608dc9a4aa46 (diff) | |
download | plum-9bf2c8a0b1c1bf1010de5dea0c37627f7abd4944.tar.gz |
client: rename #wait to #resume
Diffstat (limited to 'test')
-rw-r--r-- | test/plum/client/test_client.rb | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/test/plum/client/test_client.rb b/test/plum/client/test_client.rb index c9514cf..8806052 100644 --- a/test/plum/client/test_client.rb +++ b/test/plum/client/test_client.rb @@ -2,16 +2,14 @@ require "test_helper" using Plum::BinaryString class ClientTest < Minitest::Test - def test_request + def test_request_sync server_thread = start_tls_server client = Client.start("127.0.0.1", LISTEN_PORT, https: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) - res1 = client.request({ ":path" => "/", ":method" => "POST", ":scheme" => "https", "header" => "ccc" }, "abc") - assert_equal("POSTcccabc", res1.body) - res2 = client.put("/", "aaa", headers: { "header" => "ccc" }) - assert_equal("PUTcccaaa", res2.body) + res1 = client.put("/", "aaa", headers: { "header" => "ccc" }) + assert_equal("PUTcccaaa", res1.body) client.close ensure - server_thread.join + server_thread.join if server_thread end def test_request_async @@ -20,7 +18,7 @@ class ClientTest < Minitest::Test 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_async({ ":path" => "/", ":method" => "GET", ":scheme" => "https", "header" => "ccc" }, nil) { |res1| + res1 = client.request({ ":path" => "/", ":method" => "GET", ":scheme" => "https", "header" => "ccc" }, nil) { |res1| assert(res1.headers) } assert_nil(res1.headers) @@ -30,7 +28,7 @@ class ClientTest < Minitest::Test assert(res2.headers) assert_equal("GETccc", res2.body) ensure - server_thread.join + server_thread.join if server_thread end def test_verify @@ -40,7 +38,7 @@ class ClientTest < Minitest::Test client = Client.start("127.0.0.1", LISTEN_PORT, https: true, verify_mode: OpenSSL::SSL::VERIFY_PEER) } ensure - server_thread.join + server_thread.join if server_thread end def test_raise_error_sync @@ -53,19 +51,19 @@ class ClientTest < Minitest::Test } } ensure - server_thread.join + server_thread.join if server_thread end - def test_raise_error_async_seq_wait + 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_async("/error_in_data") assert_raises(LocalConnectionError) { - client.wait(res) + client.resume(res) } client.close ensure - server_thread.join + server_thread.join if server_thread end def test_raise_error_async_block @@ -75,10 +73,10 @@ class ClientTest < Minitest::Test Client.start("127.0.0.1", LISTEN_PORT, https: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |c| client = c client.get_async("/connection_error") { |res| flunk "success??" } - } # wait + } # resume } ensure - server_thread.join + server_thread.join if server_thread end private |