From: Tom Hughes Date: Sat, 16 Mar 2019 15:39:03 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/2177' X-Git-Tag: live~3728 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/e3ed9988ce5f57ed303326072f7f583b641e8774?ds=inline;hp=-c Merge remote-tracking branch 'upstream/pull/2177' --- e3ed9988ce5f57ed303326072f7f583b641e8774 diff --combined Gemfile index f2e1e2121,96d696561..372b7d021 --- a/Gemfile +++ b/Gemfile @@@ -1,7 -1,7 +1,7 @@@ source "https://rubygems.org" # Require rails -gem "rails", "5.2.2" +gem "rails", "5.2.2.1" # Require things which have moved to gems in ruby 1.9 gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19 @@@ -48,6 -48,7 +48,7 @@@ gem "actionpack-page_caching gem "active_record_union" gem "cancancan" gem "composite_primary_keys", "~> 11.1.0" + gem "config" gem "delayed_job_active_record" gem "dynamic_form" gem "http_accept_language", "~> 2.0.0" diff --combined Gemfile.lock index e7e391417,702ee49a1..2b5cc1dd5 --- a/Gemfile.lock +++ b/Gemfile.lock @@@ -2,49 -2,49 +2,49 @@@ GE remote: https://rubygems.org/ specs: SystemTimer (1.2.3) - aasm (5.0.1) + aasm (5.0.2) concurrent-ruby (~> 1.0) - actioncable (5.2.2) - actionpack (= 5.2.2) + actioncable (5.2.2.1) + actionpack (= 5.2.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) + actionmailer (5.2.2.1) + actionpack (= 5.2.2.1) + actionview (= 5.2.2.1) + activejob (= 5.2.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.2) - actionview (= 5.2.2) - activesupport (= 5.2.2) + actionpack (5.2.2.1) + actionview (= 5.2.2.1) + activesupport (= 5.2.2.1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) actionpack-page_caching (1.1.1) actionpack (>= 4.0.0, < 6) - actionview (5.2.2) - activesupport (= 5.2.2) + actionview (5.2.2.1) + activesupport (= 5.2.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) active_record_union (1.3.0) activerecord (>= 4.0) - activejob (5.2.2) - activesupport (= 5.2.2) + activejob (5.2.2.1) + activesupport (= 5.2.2.1) globalid (>= 0.3.6) - activemodel (5.2.2) - activesupport (= 5.2.2) - activerecord (5.2.2) - activemodel (= 5.2.2) - activesupport (= 5.2.2) + activemodel (5.2.2.1) + activesupport (= 5.2.2.1) + activerecord (5.2.2.1) + activemodel (= 5.2.2.1) + activesupport (= 5.2.2.1) arel (>= 9.0) - activestorage (5.2.2) - actionpack (= 5.2.2) - activerecord (= 5.2.2) + activestorage (5.2.2.1) + actionpack (= 5.2.2.1) + activerecord (= 5.2.2.1) marcel (~> 0.3.1) - activesupport (5.2.2) + activesupport (5.2.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@@ -65,7 -65,7 +65,7 @@@ bigdecimal (1.1.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bootsnap (1.4.0) + bootsnap (1.4.1) msgpack (~> 1.0) browser (2.5.3) builder (3.2.3) @@@ -91,7 -91,11 +91,11 @@@ coffee-script-source (1.12.2) composite_primary_keys (11.1.0) activerecord (~> 5.2.1) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.5) + config (1.7.1) + activesupport (>= 3.0) + deep_merge (~> 1.2.1) + dry-validation (>= 0.12.2) coveralls (0.8.22) json (>= 1.8, < 3) simplecov (~> 0.16.1) @@@ -103,25 -107,54 +107,54 @@@ crass (1.0.4) dalli (2.7.9) debug_inspector (0.0.3) + deep_merge (1.2.1) delayed_job (4.1.5) activesupport (>= 3.0, < 5.3) delayed_job_active_record (4.1.3) activerecord (>= 3.0, < 5.3) delayed_job (>= 3.0, < 5) docile (1.3.1) + dry-configurable (0.8.2) + concurrent-ruby (~> 1.0) + dry-core (~> 0.4, >= 0.4.7) + dry-container (0.7.0) + concurrent-ruby (~> 1.0) + dry-configurable (~> 0.1, >= 0.1.3) + dry-core (0.4.7) + concurrent-ruby (~> 1.0) + dry-equalizer (0.2.2) + dry-inflector (0.1.2) + dry-logic (0.5.0) + dry-container (~> 0.2, >= 0.2.6) + dry-core (~> 0.2) + dry-equalizer (~> 0.2) + dry-types (0.14.0) + concurrent-ruby (~> 1.0) + dry-container (~> 0.3) + dry-core (~> 0.4, >= 0.4.4) + dry-equalizer (~> 0.2) + dry-inflector (~> 0.1, >= 0.1.2) + dry-logic (~> 0.5, >= 0.5) + dry-validation (0.13.0) + concurrent-ruby (~> 1.0) + dry-configurable (~> 0.1, >= 0.1.3) + dry-core (~> 0.2, >= 0.2.1) + dry-equalizer (~> 0.2) + dry-logic (~> 0.5, >= 0.5.0) + dry-types (~> 0.14, >= 0.14) dynamic_form (1.1.4) erubi (1.8.0) execjs (2.7.0) exifr (1.3.6) - factory_bot (5.0.0) + factory_bot (5.0.2) activesupport (>= 4.2.0) factory_bot_rails (5.0.1) factory_bot (~> 5.0.0) railties (>= 4.2.0) - fakefs (0.19.1) + fakefs (0.20.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.9.25) + ffi (1.10.0) fspath (3.1.0) gd2-ffij (0.3.0) ffi (>= 1.0.0) @@@ -157,7 -190,7 +190,7 @@@ execjs (>= 1.4.0) multi_json (~> 1.0) therubyracer (~> 0.12.1) - json (2.1.0) + json (2.2.0) jsonify (0.3.1) multi_json (~> 1.0) jsonify-rails (0.3.2) @@@ -192,7 -225,7 +225,7 @@@ mini_mime (1.0.1) mini_portile2 (2.4.0) minitest (5.11.3) - msgpack (1.2.6) + msgpack (1.2.9) multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.0.0) @@@ -221,7 -254,7 +254,7 @@@ omniauth-github (1.3.0) omniauth (~> 1.5) omniauth-oauth2 (>= 1.4.0, < 2.0) - omniauth-google-oauth2 (0.6.0) + omniauth-google-oauth2 (0.6.1) jwt (>= 2.0) omniauth (>= 1.1.1) omniauth-oauth2 (>= 1.5) @@@ -247,7 -280,7 +280,7 @@@ mime-types mimemagic (~> 0.3.0) terrapin (~> 0.6.0) - parallel (1.13.0) + parallel (1.14.0) parser (2.6.0.0) ast (~> 2.4.0) pg (0.21.0) @@@ -270,18 -303,18 +303,18 @@@ rack-test (1.1.0) rack (>= 1.0, < 3) rack-uri_sanitizer (0.0.2) - rails (5.2.2) - actioncable (= 5.2.2) - actionmailer (= 5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) - activemodel (= 5.2.2) - activerecord (= 5.2.2) - activestorage (= 5.2.2) - activesupport (= 5.2.2) + rails (5.2.2.1) + actioncable (= 5.2.2.1) + actionmailer (= 5.2.2.1) + actionpack (= 5.2.2.1) + actionview (= 5.2.2.1) + activejob (= 5.2.2.1) + activemodel (= 5.2.2.1) + activerecord (= 5.2.2.1) + activestorage (= 5.2.2.1) + activesupport (= 5.2.2.1) bundler (>= 1.3.0) - railties (= 5.2.2) + railties (= 5.2.2.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) @@@ -295,9 -328,9 +328,9 @@@ rails-i18n (4.0.2) i18n (~> 0.6) rails (>= 4.0) - railties (5.2.2) - actionpack (= 5.2.2) - activesupport (= 5.2.2) + railties (5.2.2.1) + actionpack (= 5.2.2.1) + activesupport (= 5.2.2.1) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@@ -312,27 -345,26 +345,27 @@@ request_store (1.4.1) rack (>= 1.4) rinku (2.0.4) - rotp (4.0.2) + rotp (4.1.0) addressable (~> 2.5) - rubocop (0.64.0) + rubocop (0.65.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) + psych (>= 3.1.0) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.4.0) ruby-openid (2.7.0) ruby-progressbar (1.10.0) ruby_dep (1.5.0) - safe_yaml (1.0.4) + safe_yaml (1.0.5) sanitize (5.0.0) crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) - sassc (2.0.0) - ffi (~> 1.9.6) + sassc (2.0.1) + ffi (~> 1.9) rake sassc-rails (2.1.0) railties (>= 4.0.0) @@@ -340,7 -372,7 +373,7 @@@ sprockets (> 3.0) sprockets-rails tilt - secure_headers (6.0.0) + secure_headers (6.1.0) simplecov (0.16.1) docile (~> 1.1) json (>= 1.8, < 3) @@@ -402,6 -434,7 +435,7 @@@ DEPENDENCIE capybara (~> 2.13) coffee-rails (~> 4.2) composite_primary_keys (~> 11.1.0) + config coveralls dalli delayed_job_active_record @@@ -443,7 -476,7 +477,7 @@@ r2 (~> 0.2.7) rack-cors rack-uri_sanitizer - rails (= 5.2.2) + rails (= 5.2.2.1) rails-controller-testing rails-i18n (~> 4.0.0) record_tag_helper diff --combined test/controllers/api/changesets_controller_test.rb index 730c3cbd9,76230deec..be4875630 --- a/test/controllers/api/changesets_controller_test.rb +++ b/test/controllers/api/changesets_controller_test.rb @@@ -137,14 -137,14 +137,14 @@@ module Ap get :show, :params => { :id => changeset_id } assert_response :success, "cannot get first changeset" - assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1 + assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1 assert_select "osm>changeset[id='#{changeset_id}']", 1 assert_select "osm>changeset>discussion", 0 get :show, :params => { :id => changeset_id, :include_discussion => true } assert_response :success, "cannot get first changeset with comments" - assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1 + assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1 assert_select "osm>changeset[id='#{changeset_id}']", 1 assert_select "osm>changeset>discussion", 1 assert_select "osm>changeset>discussion>comment", 0 @@@ -155,7 -155,7 +155,7 @@@ get :show, :params => { :id => changeset_id, :include_discussion => true } assert_response :success, "cannot get closed changeset with comments" - assert_select "osm[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1 + assert_select "osm[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1 assert_select "osm>changeset[id='#{changeset_id}']", 1 assert_select "osm>changeset>discussion", 1 assert_select "osm>changeset>discussion>comment", 3 @@@ -409,7 -409,7 +409,7 @@@ CHANGESE "can't upload a simple valid creation to changeset: #{@response.body}" # check the returned payload - assert_select "diffResult[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1 + assert_select "diffResult[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1 assert_select "diffResult>node", 1 assert_select "diffResult>way", 1 assert_select "diffResult>relation", 1 @@@ -647,7 -647,7 +647,7 @@@ CHANGESE "can't do a conditional delete of in use objects: #{@response.body}" # check the returned payload - assert_select "diffResult[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1 + assert_select "diffResult[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1 assert_select "diffResult>node", 1 assert_select "diffResult>way", 1 assert_select "diffResult>relation", 1 @@@ -742,7 -742,7 +742,7 @@@ CHANGESE "can't upload a complex diff to changeset: #{@response.body}" # check the returned payload - assert_select "diffResult[version='#{API_VERSION}'][generator='#{GENERATOR}']", 1 + assert_select "diffResult[version='#{Settings.api_version}'][generator='#{Settings.generator}']", 1 assert_select "diffResult>node", 1 assert_select "diffResult>way", 1 assert_select "diffResult>relation", 1 @@@ -1234,7 -1234,7 +1234,7 @@@ CHANGESE "failed to return error in XML format" # check the returned payload - assert_select "osmError[version='#{API_VERSION}'][generator='OpenStreetMap server']", 1 + assert_select "osmError[version='#{Settings.api_version}'][generator='OpenStreetMap server']", 1 assert_select "osmError>status", 1 assert_select "osmError>message", 1 end @@@ -1428,7 -1428,7 +1428,7 @@@ CHANGESE assert_template nil # print @response.body # FIXME: needs more assert_select tests - assert_select "osmChange[version='#{API_VERSION}'][generator='#{GENERATOR}']" do + assert_select "osmChange[version='#{Settings.api_version}'][generator='#{Settings.generator}']" do assert_select "create", :count => 5 assert_select "create>node[id='#{node.id}'][visible='#{node.visible?}'][version='#{node.version}']" do assert_select "tag[k='#{tag.k}'][v='#{tag.v}']" @@@ -1674,7 -1674,7 +1674,7 @@@ changeset = create(:changeset, :user => user) ## First try with a non-public user - new_changeset = private_changeset.to_xml + new_changeset = create_changeset_xml(:user => private_user) new_tag = XML::Node.new "tag" new_tag["k"] = "tagtesting" new_tag["v"] = "valuetesting" @@@ -1695,7 -1695,8 +1695,7 @@@ assert_require_public_data "user with their data non-public, shouldn't be able to edit their changeset" ## Now try with the public user - create(:changeset_tag, :changeset => changeset) - new_changeset = changeset.to_xml + new_changeset = create_changeset_xml(:id => 1) new_tag = XML::Node.new "tag" new_tag["k"] = "tagtesting" new_tag["v"] = "valuetesting" @@@ -1717,7 -1718,7 +1717,7 @@@ assert_response :success assert_select "osm>changeset[id='#{changeset.id}']", 1 - assert_select "osm>changeset>tag", 2 + assert_select "osm>changeset>tag", 1 assert_select "osm>changeset>tag[k='tagtesting'][v='valuetesting']", 1 end @@@ -1728,7 -1729,7 +1728,7 @@@ basic_authorization create(:user).email, "test" changeset = create(:changeset) - new_changeset = changeset.to_xml + new_changeset = create_changeset_xml(:user => changeset.user, :id => changeset.id) new_tag = XML::Node.new "tag" new_tag["k"] = "testing" new_tag["v"] = "testing" @@@ -1958,20 -1959,5 +1958,20 @@@ xml.find("//osm/way").first[name] = value.to_s xml end + + ## + # build XML for changesets + def create_changeset_xml(user: nil, id: nil) + root = XML::Document.new + root.root = XML::Node.new "osm" + cs = XML::Node.new "changeset" + if user + cs["user"] = user.display_name + cs["uid"] = user.id.to_s + end + cs["id"] = id.to_s if id + root.root << cs + root + end end end