+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "redacted relation #{relation.relation_id} version #{relation.version} shouldn't be present in the history."
+ get :version, :id => relation.relation_id, :version => relation.version
+ get :history, :id => relation.relation_id
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "redacted node #{relation.relation_id} version #{relation.version} shouldn't be present in the history, even when logged in."
+ end
+
+ ##
+ # test the redaction of an old version of a relation, while being
+ assert_response :success, "After redaction, node should not be gone for moderator, when flag passed."
+
+ # and when accessed via history
+ get :history, :id => relation.relation_id
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "relation #{relation.relation_id} version #{relation.version} should not be present in the history for moderators when not passing flag."
+ get :history, :id => relation.relation_id, :show_redactions => 'true'
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 1, "relation #{relation.relation_id} version #{relation.version} should still be present in the history for moderators when passing flag."
+ end
+
+ # testing that if the moderator drops auth, he can't see the
+ get :version, :id => relation.relation_id, :version => relation.version
+ assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
+
+ # and when accessed via history
+ get :history, :id => relation.relation_id
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm relation[id=#{relation.relation_id}][version=#{relation.version}]", 0, "redacted relation #{relation.relation_id} version #{relation.version} shouldn't be present in the history."
+ end
+
+ ##
+ # check that the current version of a relation is equivalent to the
+ # version which we're getting from the versions call.
+ def check_current_version(relation_id)
+ # get the current version
+ current_relation = with_controller(RelationController.new) do
+ get :read, :id => relation_id
+ assert_response :success, "can't get current relation #{relation_id}"
+ Relation.from_xml(@response.body)
+ end
+ assert_not_nil current_relation, "getting relation #{relation_id} returned nil"
+
+ # get the "old" version of the relation from the version method
+ get :version, :id => relation_id, :version => current_relation.version
+ assert_response :success, "can't get old relation #{relation_id}, v#{current_relation.version}"