Fix rubocop lint issues
This commit is contained in:
parent
ef7f3d800c
commit
baf10cd392
40 changed files with 105 additions and 150 deletions
|
@ -446,7 +446,7 @@ class AmfControllerTest < ActionController::TestCase
|
|||
# Using similar method for the node controller test
|
||||
def test_putpoi_create_valid
|
||||
# This node has no tags
|
||||
nd = Node.new
|
||||
|
||||
# create a node with random lat/lon
|
||||
lat = rand(100) - 50 + rand
|
||||
lon = rand(100) - 50 + rand
|
||||
|
@ -485,7 +485,7 @@ class AmfControllerTest < ActionController::TestCase
|
|||
|
||||
####
|
||||
# This node has some tags
|
||||
tnd = Node.new
|
||||
|
||||
# create a node with random lat/lon
|
||||
lat = rand(100) - 50 + rand
|
||||
lon = rand(100) - 50 + rand
|
||||
|
@ -528,7 +528,7 @@ class AmfControllerTest < ActionController::TestCase
|
|||
# try creating a POI with rubbish in the tags
|
||||
def test_putpoi_create_with_control_chars
|
||||
# This node has no tags
|
||||
nd = Node.new
|
||||
|
||||
# create a node with random lat/lon
|
||||
lat = rand(100) - 50 + rand
|
||||
lon = rand(100) - 50 + rand
|
||||
|
@ -563,7 +563,7 @@ class AmfControllerTest < ActionController::TestCase
|
|||
# try creating a POI with rubbish in the tags
|
||||
def test_putpoi_create_with_invalid_utf8
|
||||
# This node has no tags
|
||||
nd = Node.new
|
||||
|
||||
# create a node with random lat/lon
|
||||
lat = rand(100) - 50 + rand
|
||||
lon = rand(100) - 50 + rand
|
||||
|
@ -649,21 +649,21 @@ class AmfControllerTest < ActionController::TestCase
|
|||
req.read(2) # version
|
||||
|
||||
# parse through any headers
|
||||
headers = AMF.getint(req) # Read number of headers
|
||||
headers.times do # Read each header
|
||||
name = AMF.getstring(req) # |
|
||||
req.getc # | skip boolean
|
||||
value = AMF.getvalue(req) # |
|
||||
headers = AMF.getint(req) # Read number of headers
|
||||
headers.times do # Read each header
|
||||
AMF.getstring(req) # |
|
||||
req.getc # | skip boolean
|
||||
AMF.getvalue(req) # |
|
||||
end
|
||||
|
||||
# parse through responses
|
||||
results = {}
|
||||
bodies = AMF.getint(req) # Read number of bodies
|
||||
bodies.times do # Read each body
|
||||
message = AMF.getstring(req) # | get message name
|
||||
index = AMF.getstring(req) # | get index in response sequence
|
||||
bytes = AMF.getlong(req) # | get total size in bytes
|
||||
args = AMF.getvalue(req) # | get response (probably an array)
|
||||
bodies = AMF.getint(req) # Read number of bodies
|
||||
bodies.times do # Read each body
|
||||
message = AMF.getstring(req) # | get message name
|
||||
AMF.getstring(req) # | get index in response sequence
|
||||
AMF.getlong(req) # | get total size in bytes
|
||||
args = AMF.getvalue(req) # | get response (probably an array)
|
||||
results[message] = args
|
||||
end
|
||||
@amf_result = results
|
||||
|
|
|
@ -521,7 +521,6 @@ EOF
|
|||
put :create
|
||||
end
|
||||
assert_response :success
|
||||
changeset_id = @response.body.to_i
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -778,6 +777,7 @@ EOF
|
|||
# check that objects are unmodified
|
||||
assert_nodes_are_equal(node, Node.find(1))
|
||||
assert_ways_are_equal(way, Way.find(1))
|
||||
assert_relations_are_equal(rel, Relation.find(1))
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -194,14 +194,12 @@ class NodeControllerTest < ActionController::TestCase
|
|||
# in a way...
|
||||
content(nodes(:used_node_1).to_xml)
|
||||
delete :delete, :id => current_nodes(:used_node_1).id
|
||||
assert_require_public_data
|
||||
"shouldn't be able to delete a node used in a way (#{@response.body})"
|
||||
assert_require_public_data "shouldn't be able to delete a node used in a way (#{@response.body})"
|
||||
|
||||
# in a relation...
|
||||
content(nodes(:node_used_by_relationship).to_xml)
|
||||
delete :delete, :id => current_nodes(:node_used_by_relationship).id
|
||||
assert_require_public_data
|
||||
"shouldn't be able to delete a node used in a relation (#{@response.body})"
|
||||
assert_require_public_data "shouldn't be able to delete a node used in a relation (#{@response.body})"
|
||||
|
||||
## now set auth for the public data user
|
||||
basic_authorization(users(:public_user).email, "test")
|
||||
|
|
|
@ -35,7 +35,6 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
def test_version
|
||||
## First try this with a non-public user
|
||||
basic_authorization(users(:normal_user).email, "test")
|
||||
changeset_id = changesets(:normal_user_first_change).id
|
||||
|
||||
# setup a simple XML node
|
||||
xml_doc = current_nodes(:visible_node).to_xml
|
||||
|
@ -85,7 +84,6 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
|
||||
## Now do it with the public user
|
||||
basic_authorization(users(:public_user).email, "test")
|
||||
changeset_id = changesets(:public_user_first_change).id
|
||||
|
||||
# setup a simple XML node
|
||||
xml_doc = current_nodes(:node_with_versions).to_xml
|
||||
|
|
|
@ -681,7 +681,7 @@ OSM
|
|||
content doc
|
||||
put :update, :id => relation_id
|
||||
assert_response :success, "can't update relation: #{@response.body}"
|
||||
new_version = @response.body.to_i
|
||||
assert_equal 2, @response.body.to_i
|
||||
|
||||
# get it back again and check the ordering again
|
||||
get :read, :id => relation_id
|
||||
|
|
|
@ -124,11 +124,9 @@ class WayControllerTest < ActionController::TestCase
|
|||
"<nd ref='#{nid1}'/><nd ref='#{nid2}'/>" +
|
||||
"<tag k='test' v='yes' /></way></osm>"
|
||||
put :create
|
||||
# hope for success
|
||||
# hope for failure
|
||||
assert_response :forbidden,
|
||||
"way upload did not return success status"
|
||||
# read id of created way and search for it
|
||||
wayid = @response.body
|
||||
"way upload did not return forbidden status"
|
||||
|
||||
## Now use a public user
|
||||
nid1 = current_nodes(:used_node_1).id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue