- # check moderator can still see the redacted data, without passing
- # the appropriate flag
- get api_relation_version_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
- assert_response :success, "After unredaction, relation should not be gone for moderator."
-
- # and when accessed via history
- get api_relation_versions_path(relation), :headers => auth_header
- assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
- "relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for moderators."
-
- auth_header = bearer_authorization_header
-
- # check normal user can now see the redacted data
- get api_relation_version_path(relation_v1.relation_id, relation_v1.version), :headers => auth_header
- assert_response :success, "After redaction, node should not be gone for normal user."
-
- # and when accessed via history
- get api_relation_versions_path(relation), :headers => auth_header
- assert_response :success, "Redaction shouldn't have stopped history working."
- assert_select "osm relation[id='#{relation_v1.relation_id}'][version='#{relation_v1.version}']", 1,
- "relation #{relation_v1.relation_id} version #{relation_v1.version} should still be present in the history for normal users."
- end
-
- private
-
- def do_redact_redactable_relation(headers = {})
- relation = create(:relation, :with_history, :version => 2)
- redaction = create(:redaction)
-
- post relation_version_redact_path(relation, 1), :params => { :redaction => redaction.id }, :headers => headers