]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/relation_controller_test.rb
Hide hidden notes and comments correctly in the data browser
[rails.git] / test / controllers / relation_controller_test.rb
index 7e10159b4d416f450af60368b5ccf5cf5a49574f..bb9286f1d2f7863c5f5d059807d94f7ae8039fbf 100644 (file)
@@ -105,10 +105,15 @@ class RelationControllerTest < ActionController::TestCase
 
   def test_full
     # check the "full" mode
+    get :full, :id => 999999
+    assert_response :not_found
+
+    get :full, :id => current_relations(:invisible_relation).id
+    assert_response :gone
+
     get :full, :id => current_relations(:visible_relation).id
     assert_response :success
     # FIXME: check whether this contains the stuff we want!
-    print @response.body if $VERBOSE
   end
 
   ##
@@ -172,7 +177,7 @@ class RelationControllerTest < ActionController::TestCase
     # need a role attribute to be included
     nid = current_nodes(:used_node_1).id
     content "<osm><relation changeset='#{changeset_id}'>" +
-      "<member  ref='#{nid}' type='node'/>" +       "<tag k='test' v='yes' /></relation></osm>"
+      "<member  ref='#{nid}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for forbidden due to user
     assert_response :forbidden,
@@ -260,7 +265,7 @@ class RelationControllerTest < ActionController::TestCase
     # need a role attribute to be included
     nid = current_nodes(:used_node_1).id
     content "<osm><relation changeset='#{changeset_id}'>" +
-      "<member  ref='#{nid}' type='node'/>" +       "<tag k='test' v='yes' /></relation></osm>"
+      "<member  ref='#{nid}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
     put :create
     # hope for success
     assert_response :success,
@@ -382,6 +387,19 @@ class RelationControllerTest < ActionController::TestCase
     end
   end
 
+  def test_update_wrong_id
+    basic_authorization users(:public_user).email, "test"
+    rel_id = current_relations(:multi_tag_relation).id
+    cs_id = changesets(:public_user_first_change).id
+
+    with_relation(rel_id) do |rel|
+      update_changeset(rel, cs_id)
+      content rel
+      put :update, :id => current_relations(:visible_relation).id
+      assert_response :bad_request
+    end
+  end
+
   # -------------------------------------
   # Test creating some invalid relations.
   # -------------------------------------