X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/15689af6bfa6220b9c539eb0717a3d75cc3c4799..8da385e0db1d56a5cfc1d7355960f43ab8958927:/test/controllers/api_controller_test.rb diff --git a/test/controllers/api_controller_test.rb b/test/controllers/api_controller_test.rb index 67469d094..7d249acf3 100644 --- a/test/controllers/api_controller_test.rb +++ b/test/controllers/api_controller_test.rb @@ -53,6 +53,7 @@ class ApiControllerTest < ActionController::TestCase def test_map node = current_nodes(:used_node_1) + tag = create(:node_tag, :node => node) # Need to split the min/max lat/lon out into their own variables here # so that we can test they are returned later. minlon = node.lon - 0.1 @@ -68,9 +69,9 @@ class ApiControllerTest < ActionController::TestCase assert_response :success, "Expected scucess with the map call" assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do assert_select "bounds[minlon='#{minlon}'][minlat='#{minlat}'][maxlon='#{maxlon}'][maxlat='#{maxlat}']", :count => 1 - assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do + assert_select "node[id='#{node.id}'][lat='#{format('%.7f', node.lat)}'][lon='#{format('%.7f', node.lon)}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do # This should really be more generic - assert_select "tag[k='test'][v='yes']" + assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" end assert_select "way", :count => 2 assert_select "way[id='1']", :count => 1 @@ -84,14 +85,15 @@ class ApiControllerTest < ActionController::TestCase # the same as the node we are looking at def test_map_inclusive node = current_nodes(:used_node_1) + tag = create(:node_tag, :node => node) bbox = "#{node.lon},#{node.lat},#{node.lon},#{node.lat}" get :map, :bbox => bbox assert_response :success, "The map call should have succeeded" assert_select "osm[version='#{API_VERSION}'][generator='#{GENERATOR}']", :count => 1 do assert_select "bounds[minlon='#{node.lon}'][minlat='#{node.lat}'][maxlon='#{node.lon}'][maxlat='#{node.lat}']", :count => 1 - assert_select "node[id='#{node.id}'][lat='#{node.lat}'][lon='#{node.lon}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do + assert_select "node[id='#{node.id}'][lat='#{format('%.7f', node.lat)}'][lon='#{format('%.7f', node.lon)}'][version='#{node.version}'][changeset='#{node.changeset_id}'][visible='#{node.visible}'][timestamp='#{node.timestamp.xmlschema}']", :count => 1 do # This should really be more generic - assert_select "tag[k='test'][v='yes']" + assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" end assert_select "way", :count => 2 assert_select "way[id='1']", :count => 1 @@ -362,6 +364,7 @@ class ApiControllerTest < ActionController::TestCase assert_select "api", :count => 1 do assert_select "version[minimum='#{API_VERSION}'][maximum='#{API_VERSION}']", :count => 1 assert_select "area[maximum='#{MAX_REQUEST_AREA}']", :count => 1 + assert_select "note_area[maximum='#{MAX_NOTE_REQUEST_AREA}']", :count => 1 assert_select "tracepoints[per_page='#{TRACEPOINTS_PER_PAGE}']", :count => 1 assert_select "changesets[maximum_elements='#{Changeset::MAX_ELEMENTS}']", :count => 1 assert_select "status[database='online']", :count => 1 @@ -380,7 +383,7 @@ class ApiControllerTest < ActionController::TestCase end def test_permissions_basic_auth - basic_authorization(users(:normal_user).email, "test") + basic_authorization(create(:user).email, "test") get :permissions assert_response :success assert_select "osm > permissions", :count => 1 do