end
# check error when a non-existent way is included
- get :ways, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},400" }
+ get :ways, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" }
assert_response :not_found
end
changeset_id = private_changeset.id
# create a way with pre-existing nodes
- content "<osm><way changeset='#{changeset_id}'>" +
- "<nd ref='#{node1.id}'/><nd ref='#{node2.id}'/>" +
+ content "<osm><way changeset='#{changeset_id}'>" \
+ "<nd ref='#{node1.id}'/><nd ref='#{node2.id}'/>" \
"<tag k='test' v='yes' /></way></osm>"
put :create
# hope for failure
changeset_id = changeset.id
# create a way with pre-existing nodes
- content "<osm><way changeset='#{changeset_id}'>" +
- "<nd ref='#{node1.id}'/><nd ref='#{node2.id}'/>" +
+ content "<osm><way changeset='#{changeset_id}'>" \
+ "<nd ref='#{node1.id}'/><nd ref='#{node2.id}'/>" \
"<tag k='test' v='yes' /></way></osm>"
put :create
# hope for success
# use the first user's open changeset
# create a way with non-existing node
- content "<osm><way changeset='#{private_open_changeset.id}'>" +
+ content "<osm><way changeset='#{private_open_changeset.id}'>" \
"<nd ref='0'/><tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
"way upload with invalid node using a private user did not return 'forbidden'"
# create a way with no nodes
- content "<osm><way changeset='#{private_open_changeset.id}'>" +
+ content "<osm><way changeset='#{private_open_changeset.id}'>" \
"<tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
"way upload with no node using a private userdid not return 'forbidden'"
# create a way inside a closed changeset
- content "<osm><way changeset='#{private_closed_changeset.id}'>" +
+ content "<osm><way changeset='#{private_closed_changeset.id}'>" \
"<nd ref='#{node.id}'/></way></osm>"
put :create
# expect failure
# use the first user's open changeset
# create a way with non-existing node
- content "<osm><way changeset='#{open_changeset.id}'>" +
+ content "<osm><way changeset='#{open_changeset.id}'>" \
"<nd ref='0'/><tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
assert_equal "Precondition failed: Way requires the nodes with id in (0), which either do not exist, or are not visible.", @response.body
# create a way with no nodes
- content "<osm><way changeset='#{open_changeset.id}'>" +
+ content "<osm><way changeset='#{open_changeset.id}'>" \
"<tag k='test' v='yes' /></way></osm>"
put :create
# expect failure
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}'>" +
+ content "<osm><way changeset='#{closed_changeset.id}'>" \
"<nd ref='#{node.id}'/></way></osm>"
put :create
# expect failure
"way upload to closed changeset did not return 'conflict'"
# create a way with a tag which is too long
- content "<osm><way changeset='#{open_changeset.id}'>" +
- "<nd ref='#{node.id}'/>" +
- "<tag k='foo' v='#{'x' * 256}'/>" +
+ content "<osm><way changeset='#{open_changeset.id}'>" \
+ "<nd ref='#{node.id}'/>" \
+ "<tag k='foo' v='#{'x' * 256}'/>" \
"</way></osm>"
put :create
# expect failure
assert_response :unauthorized
# now set auth using the private user
- basic_authorization(private_user.email, "test")
+ basic_authorization private_user.email, "test"
# this shouldn't work as with the 0.6 api we need pay load to delete
delete :delete, :params => { :id => private_way.id }
### Now check with a public user
# now set auth
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# this shouldn't work as with the 0.6 api we need pay load to delete
delete :delete, :params => { :id => way.id }
## Second test with the private user
# setup auth
- basic_authorization(private_user.email, "test")
+ basic_authorization private_user.email, "test"
## trying to break changesets
## Finally test with the public user
# setup auth
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
## trying to break changesets
## Try with the non-public user
# setup auth
- basic_authorization(private_user.email, "test")
+ basic_authorization private_user.email, "test"
# add an identical tag to the way
tag_xml = XML::Node.new("tag")
## Now try with the public user
# setup auth
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# add an identical tag to the way
tag_xml = XML::Node.new("tag")
## Try with the non-public user
# setup auth
- basic_authorization(private_user.email, "test")
+ basic_authorization private_user.email, "test"
# add an identical tag to the way
tag_xml = XML::Node.new("tag")
## Now try with the public user
# setup auth
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# add an identical tag to the way
tag_xml = XML::Node.new("tag")
## First test with the non-public user so should be rejected
# setup auth
- basic_authorization(private_user.email, "test")
+ basic_authorization private_user.email, "test"
# create duplicate tag
tag_xml = XML::Node.new("tag")
## Now test with the public user
# setup auth
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# create duplicate tag
tag_xml = XML::Node.new("tag")
## First make sure that you can't with a non-public user
# setup auth
- basic_authorization(private_user.email, "test")
+ basic_authorization private_user.email, "test"
# add the tag into the existing xml
way_str = "<osm><way changeset='#{private_changeset.id}'>"
## Now do it with a public user
# setup auth
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# add the tag into the existing xml
way_str = "<osm><way changeset='#{changeset.id}'>"