# test that the upload is rejected when lat is non-numeric
# create a minimal xml file
xml = "<osm><node lat='abc' lon='#{lon}' changeset='#{changeset.id}'/></osm>"
- put node_create_path, :params => xml, :headers => auth_header
+ post api_nodes_path, :params => xml, :headers => auth_header
# hope for success
assert_response :bad_request, "node upload did not return bad_request status"
assert_equal "Cannot parse valid node from xml string <node lat=\"abc\" lon=\"#{lon}\" changeset=\"#{changeset.id}\"/>. lat not a number", @response.body
# test that the upload is rejected when lon is non-numeric
# create a minimal xml file
xml = "<osm><node lat='#{lat}' lon='abc' changeset='#{changeset.id}'/></osm>"
- put node_create_path, :params => xml, :headers => auth_header
+ post api_nodes_path, :params => xml, :headers => auth_header
# hope for success
assert_response :bad_request, "node upload did not return bad_request status"
assert_equal "Cannot parse valid node from xml string <node lat=\"#{lat}\" lon=\"abc\" changeset=\"#{changeset.id}\"/>. lon not a number", @response.body
# test that the upload is rejected when we have a tag which is too long
xml = "<osm><node lat='#{lat}' lon='#{lon}' changeset='#{changeset.id}'><tag k='foo' v='#{'x' * 256}'/></node></osm>"
- put node_create_path, :params => xml, :headers => auth_header
+ post api_nodes_path, :params => xml, :headers => auth_header
assert_response :bad_request, "node upload did not return bad_request status"
assert_match(/ v: is too long \(maximum is 255 characters\) /, @response.body)
end
- def test_show
- # check that a visible node is returned properly
- get api_node_path(create(:node))
- assert_response :success
+ def test_show_not_found
+ get api_node_path(0)
+ assert_response :not_found
+ end
- # check that an deleted node is not returned
+ def test_show_deleted
get api_node_path(create(:node, :deleted))
assert_response :gone
+ end
- # check chat a non-existent node is not returned