- ##
- # test the redaction of an old version of a way, while being
- # authorised as a moderator.
- def test_redact_way_moderator
- way = create(:way, :with_history, :version => 4)
- way_v3 = way.old_ways.find_by(:version => 3)
- basic_authorization create(:moderator_user).email, "test"
-
- do_redact_way(way_v3, create(:redaction))
- assert_response :success, "should be OK to redact old version as moderator."
-
- # check moderator can still see the redacted data, when passing
- # the appropriate flag
- get :version, :params => { :id => way_v3.way_id, :version => way_v3.version }, :format => :xml
- assert_response :forbidden, "After redaction, node should be gone for moderator, when flag not passed."
- get :version, :params => { :id => way_v3.way_id, :version => way_v3.version, :show_redactions => "true" }, :format => :xml
- assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
-
- # and when accessed via history
- get :history, :params => { :id => way_v3.way_id }, :format => :xml
- assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v3.way_id}'][version='#{way_v3.version}']", 0, "way #{way_v3.way_id} version #{way_v3.version} should not be present in the history for moderators when not passing flag."
- get :history, :params => { :id => way_v3.way_id, :show_redactions => "true" }, :format => :xml