Tests for PreconditionFailed error messages.
Change to relation.rb to bring element selection in-line with that of way, so to return nil to be caught later, rather than raise an error. Change to way.rb to clarify which way on diff upload.
This commit is contained in:
parent
d7fd3fb6e5
commit
c273b4b1fa
6 changed files with 10 additions and 2 deletions
|
@ -397,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
|
||||
|
|
|
@ -197,12 +197,14 @@ class NodeControllerTest < ActionController::TestCase
|
|||
delete :delete, :id => current_nodes(:used_node_1).id
|
||||
assert_response :precondition_failed,
|
||||
"shouldn't be able to delete a node used in a way (#{@response.body})"
|
||||
assert_equal "Precondition failed: Node 3 is still used by way 1.", @response.body
|
||||
|
||||
# in a relation...
|
||||
content(nodes(:node_used_by_relationship).to_xml)
|
||||
delete :delete, :id => current_nodes(:node_used_by_relationship).id
|
||||
assert_response :precondition_failed,
|
||||
"shouldn't be able to delete a node used in a relation (#{@response.body})"
|
||||
assert_equal "Precondition failed: Node 5 is still used by relation 3.", @response.body
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -341,6 +341,7 @@ class RelationControllerTest < ActionController::TestCase
|
|||
# expect failure
|
||||
assert_response :precondition_failed,
|
||||
"relation upload with invalid node did not return 'precondition failed'"
|
||||
assert_equal "Precondition failed: Cannot create relation: data or member data is invalid.", @response.body
|
||||
end
|
||||
|
||||
# -------------------------------------
|
||||
|
@ -465,6 +466,7 @@ class RelationControllerTest < ActionController::TestCase
|
|||
delete :delete, :id => current_relations(:public_used_relation).id
|
||||
assert_response :precondition_failed,
|
||||
"shouldn't be able to delete a relation used in a relation (#{@response.body})"
|
||||
assert_equal "Precondition failed: The relation 5 is used in relation 6.", @response.body
|
||||
|
||||
# this should work when we provide the appropriate payload...
|
||||
content(relations(:multi_tag_relation).to_xml)
|
||||
|
|
|
@ -164,6 +164,7 @@ class WayControllerTest < ActionController::TestCase
|
|||
# expect failure
|
||||
assert_response :precondition_failed,
|
||||
"way upload with invalid node did not return 'precondition failed'"
|
||||
assert_equal "Precondition failed: Way requires the node with id 0, which either does not exist, or is not visible.", @response.body
|
||||
|
||||
# create a way with no nodes
|
||||
content "<osm><way changeset='#{open_changeset_id}'>" +
|
||||
|
@ -172,6 +173,7 @@ class WayControllerTest < ActionController::TestCase
|
|||
# expect failure
|
||||
assert_response :precondition_failed,
|
||||
"way upload with no node did not return 'precondition failed'"
|
||||
assert_equal "Precondition failed: Cannot create way: data is invalid.", @response.body
|
||||
|
||||
# create a way inside a closed changeset
|
||||
content "<osm><way changeset='#{closed_changeset_id}'>" +
|
||||
|
@ -286,6 +288,7 @@ class WayControllerTest < ActionController::TestCase
|
|||
delete :delete, :id => current_ways(:used_way).id
|
||||
assert_response :precondition_failed,
|
||||
"shouldn't be able to delete a way used in a relation (#{@response.body})"
|
||||
assert_equal "Precondition failed: Way 3 still used by relation 1.", @response.body
|
||||
|
||||
# this won't work since the way never existed
|
||||
delete :delete, :id => 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue