aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2013-06-03 22:08:19 +0200
committerHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2013-06-04 00:09:44 +0200
commit2060defad2971122d634d22d25f002ee4bad1eff (patch)
tree4c79bf7a72c5fc932f9216ea6d2e1117c3c50e36 /test
parent9282361c2d7a935ee2252fb19b434ea85a22e8d6 (diff)
downloadecs2-2060defad2971122d634d22d25f002ee4bad1eff.tar.gz
ecs2-2060defad2971122d634d22d25f002ee4bad1eff.zip
Missing headers when POST on resource queue.
There were missing headers X-EcsSender and X-EcsReceiverCommunities when accessing a resource through a POST on its queue mode or a DELETE. This was caused by deleting the relationships between message memberships before composing the headers. To prevent a double rendering error it was also necessary to devide the show_render method.
Diffstat (limited to 'test')
-rw-r--r--test/functional/messages_controller_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index dcb35c5..3497b93 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -238,6 +238,8 @@ class MessagesControllerTest < ActionController::TestCase
assert_response 200
assert_nothing_raised(ActiveRecord::RecordNotFound) { Message.find(@request.parameters[:id]) }
assert_equal 0, MembershipMessage.find_all_by_message_id(@request.parameters[:id]).count
+ assert_equal Membership.find_by_participant_id_and_community_id(participants(:ilias_ulm),communities(:wuv)).id.to_s, @response["X-EcsSender"]
+ assert_equal communities(:wuv).id.to_s, @response["X-EcsReceiverCommunities"]
end
test "delete_none_postrouted_message_as_none_owner_with_last_reference_in_place" do
@@ -261,6 +263,8 @@ class MessagesControllerTest < ActionController::TestCase
assert_equal $~.to_s, @request.parameters[:id]
assert_nothing_raised(ActiveRecord::RecordNotFound) { Message.find(@request.parameters[:id]) }
assert_nil MembershipMessage.find_by_message_id(@request.parameters[:id])
+ assert_equal Membership.find_by_participant_id_and_community_id(participants(:ilias_stgt),communities(:public)).id.to_s, @response["X-EcsSender"]
+ assert_equal communities(:public).id.to_s, @response["X-EcsReceiverCommunities"]
end
test "delete_none_postrouted_message_as_none_owner_with_references_in_place" do
@@ -297,6 +301,8 @@ class MessagesControllerTest < ActionController::TestCase
get :fifo
assert_response 200
assert_equal "Hallo Ihr da im Radio.", @response.body.strip
+ assert_equal Membership.find_by_participant_id_and_community_id(participants(:ilias_stgt),communities(:wuv)).id.to_s, @response["X-EcsSender"]
+ assert_equal communities(:wuv).id.to_s, @response["X-EcsReceiverCommunities"]
end
test "fifo get not idempotent" do
@@ -305,6 +311,8 @@ class MessagesControllerTest < ActionController::TestCase
post :fifo
assert_response 200
assert_equal "Hallo Ihr da im Radio.", @response.body.strip
+ assert_equal Membership.find_by_participant_id_and_community_id(participants(:ilias_stgt),communities(:wuv)).id.to_s, @response["X-EcsSender"]
+ assert_equal communities(:wuv).id.to_s, @response["X-EcsReceiverCommunities"]
get :fifo
assert_response 200
assert_not_equal "Hallo Ihr da im Radio.", @response.body.strip