]> git.openstreetmap.org Git - rails.git/blobdiff - test/functional/changeset_controller_test.rb
fix typo which meant that it was testing the node twice, rather than the node then...
[rails.git] / test / functional / changeset_controller_test.rb
index 1e20f640b84963d365bd217e2cea90223d199653..ce739b96c5cf5c217d8d3d46c9c6c11b2865d507 100644 (file)
@@ -308,14 +308,22 @@ EOF
     diff.root = XML::Node.new "osmChange"
     delete = XML::Node.new "delete"
     diff.root << delete
-    delete << current_relations(:public_used_relation).to_xml_node
-    delete << current_relations(:public_visible_relation).to_xml_node
+    delete << current_relations(:visible_relation).to_xml_node
+    delete << current_relations(:used_relation).to_xml_node
     delete << current_ways(:used_way).to_xml_node
     delete << current_nodes(:node_used_by_relationship).to_xml_node
 
+    # update the changeset to one that this user owns
+    changeset_id = changesets(:public_user_first_change).id
+    ["node", "way", "relation"].each do |type|
+      delete.find("//osmChange/delete/#{type}").each do |n| 
+        n['changeset'] = changeset_id.to_s 
+      end
+    end
+
     # upload it
     content diff
-    post :upload, :id => changesets(:public_user_first_change).id
+    post :upload, :id => changeset_id
     assert_response :success, 
       "can't upload a deletion diff to changeset: #{@response.body}"
 
@@ -389,6 +397,7 @@ EOF
     post :upload, :id => 2
     assert_response :precondition_failed, 
       "shouldn't be able to upload a invalid deletion diff: #{@response.body}"
+    assert_equal "Precondition failed: Way 3 still used by relation 1.", @response.body
 
     # check that nothing was, in fact, deleted
     assert_equal true, Node.find(current_nodes(:node_used_by_relationship).id).visible