- # test the unredaction of an old version of a way, while being
- # authorised as a moderator.
- def test_unredact_way_moderator
- moderator_user = create(:moderator_user)
- way = create(:way, :with_history, :version => 2)
- way_v1 = way.old_ways.find_by(:version => 1)
- way_v1.redact!(create(:redaction))
-
- auth_header = bearer_authorization_header moderator_user
-
- post way_version_redact_path(way_v1.way_id, way_v1.version), :headers => auth_header
- assert_response :success, "should be OK to unredact old version as moderator."
-
- # check moderator can still see the unredacted data, without passing
- # the appropriate flag
- get api_old_way_path(way_v1.way_id, way_v1.version), :headers => auth_header
- assert_response :success, "After unredaction, node should not be gone for moderator."
-
- # and when accessed via history
- get api_way_versions_path(way), :headers => auth_header
- assert_response :success, "Unredaction shouldn't have stopped history working."
- assert_select "osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']", 1,
- "way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for moderators."
-
- auth_header = bearer_authorization_header
-
- # check normal user can now see the unredacted data
- get api_old_way_path(way_v1.way_id, way_v1.version), :headers => auth_header
- assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
+ # check that returned history is the same as getting all
+ # versions of a way from the api.
+ def test_history_equals_versions
+ way = create(:way, :with_history)
+ used_way = create(:way, :with_history)
+ create(:relation_member, :member => used_way)
+ way_with_versions = create(:way, :with_history, :version => 4)