Commit 0a7610f2 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

updating em-http-request version and making some tests more reliable

parent 25fa8dc2
...@@ -4,7 +4,7 @@ gem 'rake' ...@@ -4,7 +4,7 @@ gem 'rake'
group :test do group :test do
gem 'POpen4', '0.1.4' gem 'POpen4', '0.1.4'
gem 'em-http-request', '0.2.14' gem 'em-http-request', '1.0.3'
gem 'json', '1.4.3' gem 'json', '1.4.3'
gem 'jasmine', '1.0.2.1' gem 'jasmine', '1.0.2.1'
gem 'jshintrb' gem 'jshintrb'
......
...@@ -6,20 +6,27 @@ GEM ...@@ -6,20 +6,27 @@ GEM
open4 open4
Platform (0.4.0) Platform (0.4.0)
RedCloth (4.2.7) RedCloth (4.2.7)
addressable (2.2.2) addressable (2.3.2)
archive-tar-minitar (0.5.2) archive-tar-minitar (0.5.2)
childprocess (0.2.0) childprocess (0.2.0)
ffi (~> 1.0.6) ffi (~> 1.0.6)
columnize (0.3.2) columnize (0.3.2)
cookiejar (0.3.0)
diff-lcs (1.1.2) diff-lcs (1.1.2)
em-http-request (0.2.14) em-http-request (1.0.3)
addressable (>= 2.0.0) addressable (>= 2.2.3)
eventmachine (>= 0.12.9) cookiejar
eventmachine (0.12.10) em-socksify
eventmachine (>= 1.0.0.beta.4)
http_parser.rb (>= 0.5.3)
em-socksify (0.2.1)
eventmachine (>= 1.0.0.beta.4)
eventmachine (1.0.0)
execjs (1.4.0) execjs (1.4.0)
multi_json (~> 1.0) multi_json (~> 1.0)
ffi (1.0.9) ffi (1.0.9)
github-markup (0.7.1) github-markup (0.7.1)
http_parser.rb (0.5.3)
jasmine (1.0.2.1) jasmine (1.0.2.1)
json_pure (>= 1.4.3) json_pure (>= 1.4.3)
rack (>= 1.1) rack (>= 1.1)
...@@ -79,7 +86,7 @@ PLATFORMS ...@@ -79,7 +86,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
POpen4 (= 0.1.4) POpen4 (= 0.1.4)
RedCloth RedCloth
em-http-request (= 0.2.14) em-http-request (= 1.0.3)
github-markup github-markup
jasmine (= 1.0.2.1) jasmine (= 1.0.2.1)
jshintrb jshintrb
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -41,8 +41,8 @@ class TestComunicationProperties < Test::Unit::TestCase ...@@ -41,8 +41,8 @@ class TestComunicationProperties < Test::Unit::TestCase
pub = EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel.to_s ).post :head => headers, :body => body, :timeout => 30 pub = EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel.to_s ).post :head => headers, :body => body, :timeout => 30
pub.callback { pub.callback {
sub_2 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s).get :head => headers, :timeout => 60 sub_2 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s).get :head => headers, :timeout => 60
sub_2.stream { |chunk| sub_2.stream { |chunk2|
assert_equal("#{@header_template}\r\n", chunk, "Didn't received header template") assert_equal("#{@header_template}\r\n", chunk2, "Didn't received header template")
EventMachine.stop EventMachine.stop
} }
} }
...@@ -70,7 +70,7 @@ class TestComunicationProperties < Test::Unit::TestCase ...@@ -70,7 +70,7 @@ class TestComunicationProperties < Test::Unit::TestCase
sub_1 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s + '.b1').get :head => headers, :timeout => 60 sub_1 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s + '.b1').get :head => headers, :timeout => 60
sub_1.stream { |chunk| sub_1.stream { |chunk|
response_1 += chunk response_1 += chunk
sub_1.close_connection if response_1.include?(body) sub_1.close if response_1.include?(body)
} }
end end
...@@ -78,7 +78,7 @@ class TestComunicationProperties < Test::Unit::TestCase ...@@ -78,7 +78,7 @@ class TestComunicationProperties < Test::Unit::TestCase
sub_2 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s + '.b1').get :head => headers, :timeout => 60 sub_2 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s + '.b1').get :head => headers, :timeout => 60
sub_2.stream { |chunk| sub_2.stream { |chunk|
response_2 += chunk response_2 += chunk
sub_2.close_connection if response_2.include?(body) sub_2.close if response_2.include?(body)
} }
end end
...@@ -87,13 +87,13 @@ class TestComunicationProperties < Test::Unit::TestCase ...@@ -87,13 +87,13 @@ class TestComunicationProperties < Test::Unit::TestCase
sub_3 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s + '.b1').get :head => headers, :timeout => 60 sub_3 = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s + '.b1').get :head => headers, :timeout => 60
sub_3.stream { |chunk| sub_3.stream { |chunk|
response_3 += chunk response_3 += chunk
sub_3.close_connection if response_3.include?(body) sub_3.close if response_3.include?(body)
} }
end end
EM.add_timer(17) do EM.add_timer(17) do
assert_equal("#{@header_template}\r\n#{body}\r\n", response_1, "Didn't received header and message") assert_equal("#{@header_template}\r\n#{body}\r\n\r\n", response_1, "Didn't received header and message")
assert_equal("#{@header_template}\r\n#{body}\r\n", response_2, "Didn't received header and message") assert_equal("#{@header_template}\r\n#{body}\r\n\r\n", response_2, "Didn't received header and message")
assert_equal("#{@header_template}\r\n", response_3, "Didn't received header") assert_equal("#{@header_template}\r\n", response_3, "Didn't received header")
EventMachine.stop EventMachine.stop
end end
......
...@@ -6,7 +6,7 @@ class TestMeasureMemory < Test::Unit::TestCase ...@@ -6,7 +6,7 @@ class TestMeasureMemory < Test::Unit::TestCase
@@message_estimate_size = 174 @@message_estimate_size = 174
@@channel_estimate_size = 536 @@channel_estimate_size = 536
@@subscriber_estimate_size = 230 @@subscriber_estimate_size = 230
@@subscriber_estimate_system_size = 6890 @@subscriber_estimate_system_size = 6860
def global_configuration def global_configuration
@max_reserved_memory = "2m" @max_reserved_memory = "2m"
...@@ -61,7 +61,7 @@ class TestMeasureMemory < Test::Unit::TestCase ...@@ -61,7 +61,7 @@ class TestMeasureMemory < Test::Unit::TestCase
EventMachine.run { EventMachine.run {
publish_message_in_loop(1000, headers, body) publish_message_in_loop(1000, headers, body)
add_test_timeout(20) add_test_timeout(25)
} }
EventMachine.run { EventMachine.run {
......
...@@ -77,32 +77,32 @@ class TestPublisher < Test::Unit::TestCase ...@@ -77,32 +77,32 @@ class TestPublisher < Test::Unit::TestCase
EventMachine.run { EventMachine.run {
multi = EventMachine::MultiRequest.new multi = EventMachine::MultiRequest.new
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_1').get) multi.add(:a, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_1').get)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_2').put :body => 'body') multi.add(:b, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_2').put(:body => 'body'))
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_3').post) multi.add(:c, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_3').post)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_4').delete) multi.add(:d, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_4').delete)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_5').head) multi.add(:e, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_accepted_methods_5').head)
multi.callback { multi.callback {
assert_equal(5, multi.responses[:succeeded].length) assert_equal(5, multi.responses[:callback].length)
assert_not_equal(405, multi.responses[:succeeded][0].response_header.status, "Publisher does accept GET") assert_not_equal(405, multi.responses[:callback][:a].response_header.status, "Publisher does accept GET")
assert_equal("GET", multi.responses[:succeeded][0].method, "Array is with wrong order") assert_equal("GET", multi.responses[:callback][:a].req.method, "Array is with wrong order")
assert_equal(405, multi.responses[:succeeded][1].response_header.status, "Publisher does not accept PUT") assert_equal(405, multi.responses[:callback][:b].response_header.status, "Publisher does not accept PUT")
assert_equal("GET, POST", multi.responses[:succeeded][1].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET, POST", multi.responses[:callback][:b].response_header['ALLOW'], "Didn't receive the right error message")
assert_equal("PUT", multi.responses[:succeeded][1].method, "Array is with wrong order") assert_equal("PUT", multi.responses[:callback][:b].req.method, "Array is with wrong order")
assert_not_equal(405, multi.responses[:succeeded][2].response_header.status, "Publisher does accept POST") assert_not_equal(405, multi.responses[:callback][:c].response_header.status, "Publisher does accept POST")
assert_equal("POST", multi.responses[:succeeded][2].method, "Array is with wrong order") assert_equal("POST", multi.responses[:callback][:c].req.method, "Array is with wrong order")
assert_equal(405, multi.responses[:succeeded][3].response_header.status, "Publisher does not accept DELETE") assert_equal(405, multi.responses[:callback][:d].response_header.status, "Publisher does not accept DELETE")
assert_equal("DELETE", multi.responses[:succeeded][3].method, "Array is with wrong order") assert_equal("DELETE", multi.responses[:callback][:d].req.method, "Array is with wrong order")
assert_equal("GET, POST", multi.responses[:succeeded][3].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET, POST", multi.responses[:callback][:d].response_header['ALLOW'], "Didn't receive the right error message")
assert_equal(405, multi.responses[:succeeded][4].response_header.status, "Publisher does not accept HEAD") assert_equal(405, multi.responses[:callback][:e].response_header.status, "Publisher does not accept HEAD")
assert_equal("HEAD", multi.responses[:succeeded][4].method, "Array is with wrong order") assert_equal("HEAD", multi.responses[:callback][:e].req.method, "Array is with wrong order")
assert_equal("GET, POST", multi.responses[:succeeded][4].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET, POST", multi.responses[:callback][:e].response_header['ALLOW'], "Didn't receive the right error message")
EventMachine.stop EventMachine.stop
} }
...@@ -135,15 +135,15 @@ class TestPublisher < Test::Unit::TestCase ...@@ -135,15 +135,15 @@ class TestPublisher < Test::Unit::TestCase
EventMachine.run { EventMachine.run {
multi = EventMachine::MultiRequest.new multi = EventMachine::MultiRequest.new
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_1).post :head => headers, :body => body, :timeout => 30) multi.add(:a, EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_1).post(:head => headers, :body => body, :timeout => 30))
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_2).post :head => headers, :body => body, :timeout => 30) multi.add(:b, EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_2).post(:head => headers, :body => body, :timeout => 30))
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_3).post :head => headers, :body => body, :timeout => 30) multi.add(:c, EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_3).post(:head => headers, :body => body, :timeout => 30))
multi.callback { multi.callback {
assert_equal(3, multi.responses[:succeeded].length) assert_equal(3, multi.responses[:callback].length)
0.upto(2) do |i| multi.responses[:callback].each do |name, response|
assert_equal(403, multi.responses[:succeeded][i].response_header.status, "Channel was created") assert_equal(403, response.response_header.status, "Channel was created")
assert_equal(0, multi.responses[:succeeded][i].response_header.content_length, "Received response for creating channel with id containing wildcard") assert_equal(0, response.response_header.content_length, "Received response for creating channel with id containing wildcard")
assert_equal("Channel id not authorized for this method.", multi.responses[:succeeded][i].response_header['X_NGINX_PUSHSTREAM_EXPLAIN'], "Didn't receive the right error message") assert_equal("Channel id not authorized for this method.", response.response_header['X_NGINX_PUSHSTREAM_EXPLAIN'], "Didn't receive the right error message")
end end
EventMachine.stop EventMachine.stop
......
...@@ -81,31 +81,31 @@ class TestPublisherAdmin < Test::Unit::TestCase ...@@ -81,31 +81,31 @@ class TestPublisherAdmin < Test::Unit::TestCase
EventMachine.run { EventMachine.run {
multi = EventMachine::MultiRequest.new multi = EventMachine::MultiRequest.new
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_1').get) multi.add(:a, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_1').get)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_2').put :body => 'body') multi.add(:b, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_2').put(:body => 'body'))
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_3').post) multi.add(:c, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_3').post)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_4').delete) multi.add(:d, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_4').delete)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_5').head) multi.add(:e, EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_admin_accepted_methods_5').head)
multi.callback { multi.callback {
assert_equal(5, multi.responses[:succeeded].length) assert_equal(5, multi.responses[:callback].length)
assert_not_equal(405, multi.responses[:succeeded][0].response_header.status, "Publisher does accept GET") assert_not_equal(405, multi.responses[:callback][:a].response_header.status, "Publisher does accept GET")
assert_equal("GET", multi.responses[:succeeded][0].method, "Array is with wrong order") assert_equal("GET", multi.responses[:callback][:a].req.method, "Array is with wrong order")
assert_equal(405, multi.responses[:succeeded][1].response_header.status, "Publisher does not accept PUT") assert_equal(405, multi.responses[:callback][:b].response_header.status, "Publisher does not accept PUT")
assert_equal("GET, POST, DELETE", multi.responses[:succeeded][1].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET, POST, DELETE", multi.responses[:callback][:b].response_header['ALLOW'], "Didn't receive the right error message")
assert_equal("PUT", multi.responses[:succeeded][1].method, "Array is with wrong order") assert_equal("PUT", multi.responses[:callback][:b].req.method, "Array is with wrong order")
assert_not_equal(405, multi.responses[:succeeded][2].response_header.status, "Publisher does accept POST") assert_not_equal(405, multi.responses[:callback][:c].response_header.status, "Publisher does accept POST")
assert_equal("POST", multi.responses[:succeeded][2].method, "Array is with wrong order") assert_equal("POST", multi.responses[:callback][:c].req.method, "Array is with wrong order")
assert_not_equal(405, multi.responses[:succeeded][3].response_header.status, "Publisher does accept DELETE") assert_not_equal(405, multi.responses[:callback][:d].response_header.status, "Publisher does accept DELETE")
assert_equal("DELETE", multi.responses[:succeeded][3].method, "Array is with wrong order") assert_equal("DELETE", multi.responses[:callback][:d].req.method, "Array is with wrong order")
assert_equal(405, multi.responses[:succeeded][4].response_header.status, "Publisher does not accept HEAD") assert_equal(405, multi.responses[:callback][:e].response_header.status, "Publisher does not accept HEAD")
assert_equal("HEAD", multi.responses[:succeeded][4].method, "Array is with wrong order") assert_equal("HEAD", multi.responses[:callback][:e].req.method, "Array is with wrong order")
assert_equal("GET, POST, DELETE", multi.responses[:succeeded][4].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET, POST, DELETE", multi.responses[:callback][:e].response_header['ALLOW'], "Didn't receive the right error message")
EventMachine.stop EventMachine.stop
} }
...@@ -138,15 +138,15 @@ class TestPublisherAdmin < Test::Unit::TestCase ...@@ -138,15 +138,15 @@ class TestPublisherAdmin < Test::Unit::TestCase
EventMachine.run { EventMachine.run {
multi = EventMachine::MultiRequest.new multi = EventMachine::MultiRequest.new
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_1).post :head => headers, :body => body, :timeout => 30) multi.add(:a, EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_1).post(:head => headers, :body => body, :timeout => 30))
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_2).post :head => headers, :body => body, :timeout => 30) multi.add(:b, EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_2).post(:head => headers, :body => body, :timeout => 30))
multi.add(EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_3).post :head => headers, :body => body, :timeout => 30) multi.add(:c, EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel_3).post(:head => headers, :body => body, :timeout => 30))
multi.callback { multi.callback {
assert_equal(3, multi.responses[:succeeded].length) assert_equal(3, multi.responses[:callback].length)
0.upto(2) do |i| multi.responses[:callback].each do |name, response|
assert_equal(403, multi.responses[:succeeded][i].response_header.status, "Channel was created") assert_equal(403, response.response_header.status, "Channel was created")
assert_equal(0, multi.responses[:succeeded][i].response_header.content_length, "Received response for creating channel with id containing wildcard") assert_equal(0, response.response_header.content_length, "Received response for creating channel with id containing wildcard")
assert_equal("Channel id not authorized for this method.", multi.responses[:succeeded][i].response_header['X_NGINX_PUSHSTREAM_EXPLAIN'], "Didn't receive the right error message") assert_equal("Channel id not authorized for this method.", response.response_header['X_NGINX_PUSHSTREAM_EXPLAIN'], "Didn't receive the right error message")
end end
EventMachine.stop EventMachine.stop
......
This diff is collapsed.
...@@ -18,7 +18,7 @@ class TestSubscriberConnectionCleanup < Test::Unit::TestCase ...@@ -18,7 +18,7 @@ class TestSubscriberConnectionCleanup < Test::Unit::TestCase
response = '' response = ''
EventMachine.run { EventMachine.run {
sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s).get :head => headers, :timeout => 60 sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s, :inactivity_timeout => 60).get :head => headers, :timeout => 60
sub.stream { |chunk| sub.stream { |chunk|
response += chunk response += chunk
assert(response.include?(@header_template), "Didn't received header template") assert(response.include?(@header_template), "Didn't received header template")
...@@ -50,7 +50,7 @@ class TestSubscriberConnectionCleanup < Test::Unit::TestCase ...@@ -50,7 +50,7 @@ class TestSubscriberConnectionCleanup < Test::Unit::TestCase
chunksReceived = 0 chunksReceived = 0
EventMachine.run { EventMachine.run {
sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s).get :head => headers, :timeout => 60 sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s, :inactivity_timeout => 15).get :head => headers, :timeout => 60
sub.stream { |chunk| sub.stream { |chunk|
chunksReceived += 1; chunksReceived += 1;
} }
......
...@@ -325,7 +325,7 @@ class TestSubscriberLongPolling < Test::Unit::TestCase ...@@ -325,7 +325,7 @@ class TestSubscriberLongPolling < Test::Unit::TestCase
start = Time.now start = Time.now
EventMachine.run { EventMachine.run {
sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s).get :timeout => 30 sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s, :inactivity_timeout => 30).get :timeout => 30
sub.callback { sub.callback {
stop = Time.now stop = Time.now
elapsed = time_diff_sec(start, stop) elapsed = time_diff_sec(start, stop)
......
...@@ -23,33 +23,33 @@ class TestWebSocket < Test::Unit::TestCase ...@@ -23,33 +23,33 @@ class TestWebSocket < Test::Unit::TestCase
EventMachine.run { EventMachine.run {
multi = EventMachine::MultiRequest.new multi = EventMachine::MultiRequest.new
multi.add(EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_1').head) multi.add(:a, EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_1').head)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_2').put :body => 'body') multi.add(:b, EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_2').put(:body => 'body'))
multi.add(EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_3').post) multi.add(:c, EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_3').post)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_4').delete) multi.add(:d, EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_4').delete)
multi.add(EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_5').get) multi.add(:e, EventMachine::HttpRequest.new(nginx_address + '/ws/ch_test_accepted_methods_5').get)
multi.callback { multi.callback {
assert_equal(5, multi.responses[:succeeded].length) assert_equal(5, multi.responses[:callback].length)
assert_equal(405, multi.responses[:succeeded][0].response_header.status, "Publisher does not accept HEAD") assert_equal(405, multi.responses[:callback][:a].response_header.status, "Publisher does not accept HEAD")
assert_equal("HEAD", multi.responses[:succeeded][0].method, "Array is with wrong order") assert_equal("HEAD", multi.responses[:callback][:a].req.method, "Array is with wrong order")
assert_equal("GET", multi.responses[:succeeded][0].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET", multi.responses[:callback][:a].response_header['ALLOW'], "Didn't receive the right error message")
assert_equal(405, multi.responses[:succeeded][1].response_header.status, "Publisher does not accept PUT") assert_equal(405, multi.responses[:callback][:b].response_header.status, "Publisher does not accept PUT")
assert_equal("PUT", multi.responses[:succeeded][1].method, "Array is with wrong order") assert_equal("PUT", multi.responses[:callback][:b].req.method, "Array is with wrong order")
assert_equal("GET", multi.responses[:succeeded][1].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET", multi.responses[:callback][:b].response_header['ALLOW'], "Didn't receive the right error message")
assert_equal(405, multi.responses[:succeeded][2].response_header.status, "Publisher does accept POST") assert_equal(405, multi.responses[:callback][:c].response_header.status, "Publisher does accept POST")
assert_equal("POST", multi.responses[:succeeded][2].method, "Array is with wrong order") assert_equal("POST", multi.responses[:callback][:c].req.method, "Array is with wrong order")
assert_equal("GET", multi.responses[:succeeded][1].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET", multi.responses[:callback][:b].response_header['ALLOW'], "Didn't receive the right error message")
assert_equal(405, multi.responses[:succeeded][3].response_header.status, "Publisher does not accept DELETE") assert_equal(405, multi.responses[:callback][:d].response_header.status, "Publisher does not accept DELETE")
assert_equal("DELETE", multi.responses[:succeeded][3].method, "Array is with wrong order") assert_equal("DELETE", multi.responses[:callback][:d].req.method, "Array is with wrong order")
assert_equal("GET", multi.responses[:succeeded][3].response_header['ALLOW'], "Didn't receive the right error message") assert_equal("GET", multi.responses[:callback][:d].response_header['ALLOW'], "Didn't receive the right error message")
assert_not_equal(405, multi.responses[:succeeded][4].response_header.status, "Publisher does accept GET") assert_not_equal(405, multi.responses[:callback][:e].response_header.status, "Publisher does accept GET")
assert_equal("GET", multi.responses[:succeeded][4].method, "Array is with wrong order") assert_equal("GET", multi.responses[:callback][:e].req.method, "Array is with wrong order")
EventMachine.stop EventMachine.stop
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment