]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/relation_controller_test.rb
Use a resourceful path for message marking
[rails.git] / test / controllers / relation_controller_test.rb
index 487d99b8016b7f1c81ec747e77ab03d85ea424e3..8a7e8b2fe2b6bcf212c804e19ace3df7475e8efd 100644 (file)
@@ -188,7 +188,7 @@ class RelationControllerTest < ActionController::TestCase
     end
 
     # check error when a non-existent relation is included
-    get :relations, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},400" }
+    get :relations, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" }
     assert_response :not_found
   end
 
@@ -216,8 +216,8 @@ class RelationControllerTest < ActionController::TestCase
     ###
     # create an relation with a node as member
     # This time try with a role attribute in the relation
-    content "<osm><relation changeset='#{private_changeset.id}'>" +
-            "<member  ref='#{node.id}' type='node' role='some'/>" +
+    content "<osm><relation changeset='#{private_changeset.id}'>" \
+            "<member  ref='#{node.id}' type='node' role='some'/>" \
             "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for forbidden due to user
@@ -227,7 +227,7 @@ class RelationControllerTest < ActionController::TestCase
     ###
     # create an relation with a node as member, this time test that we don't
     # need a role attribute to be included
-    content "<osm><relation changeset='#{private_changeset.id}'>" +
+    content "<osm><relation changeset='#{private_changeset.id}'>" \
             "<member  ref='#{node.id}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for forbidden due to user
@@ -236,9 +236,9 @@ class RelationControllerTest < ActionController::TestCase
 
     ###
     # create an relation with a way and a node as members
-    content "<osm><relation changeset='#{private_changeset.id}'>" +
-            "<member type='node' ref='#{node.id}' role='some'/>" +
-            "<member type='way' ref='#{way.id}' role='other'/>" +
+    content "<osm><relation changeset='#{private_changeset.id}'>" \
+            "<member type='node' ref='#{node.id}' role='some'/>" \
+            "<member type='way' ref='#{way.id}' role='other'/>" \
             "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for forbidden, due to user
@@ -277,8 +277,8 @@ class RelationControllerTest < ActionController::TestCase
     ###
     # create an relation with a node as member
     # This time try with a role attribute in the relation
-    content "<osm><relation changeset='#{changeset.id}'>" +
-            "<member  ref='#{node.id}' type='node' role='some'/>" +
+    content "<osm><relation changeset='#{changeset.id}'>" \
+            "<member  ref='#{node.id}' type='node' role='some'/>" \
             "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for success
@@ -308,7 +308,7 @@ class RelationControllerTest < ActionController::TestCase
     ###
     # create an relation with a node as member, this time test that we don't
     # need a role attribute to be included
-    content "<osm><relation changeset='#{changeset.id}'>" +
+    content "<osm><relation changeset='#{changeset.id}'>" \
             "<member  ref='#{node.id}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for success
@@ -337,9 +337,9 @@ class RelationControllerTest < ActionController::TestCase
 
     ###
     # create an relation with a way and a node as members
-    content "<osm><relation changeset='#{changeset.id}'>" +
-            "<member type='node' ref='#{node.id}' role='some'/>" +
-            "<member type='way' ref='#{way.id}' role='other'/>" +
+    content "<osm><relation changeset='#{changeset.id}'>" \
+            "<member type='node' ref='#{node.id}' role='some'/>" \
+            "<member type='way' ref='#{way.id}' role='other'/>" \
             "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for success
@@ -461,8 +461,8 @@ class RelationControllerTest < ActionController::TestCase
     basic_authorization user.email, "test"
 
     # create a relation with non-existing node as member
-    content "<osm><relation changeset='#{changeset.id}'>" +
-            "<member type='node' ref='0'/><tag k='test' v='yes' />" +
+    content "<osm><relation changeset='#{changeset.id}'>" \
+            "<member type='node' ref='0'/><tag k='test' v='yes' />" \
             "</relation></osm>"
     put :create
     # expect failure
@@ -482,8 +482,8 @@ class RelationControllerTest < ActionController::TestCase
     basic_authorization user.email, "test"
 
     # create some xml that should return an error
-    content "<osm><relation changeset='#{changeset.id}'>" +
-            "<member type='type' ref='#{node.id}' role=''/>" +
+    content "<osm><relation changeset='#{changeset.id}'>" \
+            "<member type='type' ref='#{node.id}' role=''/>" \
             "<tag k='tester' v='yep'/></relation></osm>"
     put :create
     # expect failure
@@ -514,7 +514,7 @@ class RelationControllerTest < ActionController::TestCase
     assert_response :unauthorized
 
     ## Then try with the private user, to make sure that you get a forbidden
-    basic_authorization(private_user.email, "test")
+    basic_authorization private_user.email, "test"
 
     # this shouldn't work, as we should need the payload...
     delete :delete, :params => { :id => relation.id }
@@ -556,7 +556,7 @@ class RelationControllerTest < ActionController::TestCase
     assert_response :forbidden
 
     ## now set auth for the public user
-    basic_authorization(user.email, "test")
+    basic_authorization user.email, "test"
 
     # this shouldn't work, as we should need the payload...
     delete :delete, :params => { :id => relation.id }
@@ -739,7 +739,7 @@ class RelationControllerTest < ActionController::TestCase
     way1 = create(:way_with_nodes, :nodes_count => 2)
     way2 = create(:way_with_nodes, :nodes_count => 2)
 
-    basic_authorization(user.email, "test")
+    basic_authorization user.email, "test"
 
     doc_str = <<OSM.strip_heredoc
       <osm>
@@ -814,14 +814,14 @@ OSM
     doc = XML::Parser.string(doc_str).parse
 
     ## First try with the private user
-    basic_authorization(private_user.email, "test")
+    basic_authorization private_user.email, "test"
 
     content doc
     put :create
     assert_response :forbidden
 
     ## Now try with the public user
-    basic_authorization(user.email, "test")
+    basic_authorization user.email, "test"
 
     content doc
     put :create
@@ -855,7 +855,7 @@ OSM
       </osm>
 OSM
     doc = XML::Parser.string(doc_str).parse
-    basic_authorization(user.email, "test")
+    basic_authorization user.email, "test"
 
     content doc
     put :create
@@ -936,7 +936,7 @@ OSM
   # that the changeset bounding box is +bbox+.
   def check_changeset_modify(bbox)
     ## First test with the private user to check that you get a forbidden
-    basic_authorization(create(:user, :data_public => false).email, "test")
+    basic_authorization create(:user, :data_public => false).email, "test"
 
     # create a new changeset for this operation, so we are assured
     # that the bounding box will be newly-generated.
@@ -947,7 +947,7 @@ OSM
     end
 
     ## Now do the whole thing with the public user
-    basic_authorization(create(:user).email, "test")
+    basic_authorization create(:user).email, "test"
 
     # create a new changeset for this operation, so we are assured
     # that the bounding box will be newly-generated.
@@ -1063,7 +1063,7 @@ OSM
     assert_equal a_tags.keys, b_tags.keys, "Tag keys should be identical."
     a_tags.each do |k, v|
       assert_equal v, b_tags[k],
-                   "Tags which were not altered should be the same. " +
+                   "Tags which were not altered should be the same. " \
                    "#{a_tags.inspect} != #{b_tags.inspect}"
     end
   end