+ get :version, :id => way.way_id, :version => way.version
+ assert_response :forbidden, "Redacted node shouldn't be visible via the version API, even when logged in."
+ end
+
+ ##
+ # test that redacted nodes aren't visible in the history
+ def test_history_redacted
+ way = ways(:way_with_redacted_versions_v2)
+
+ get :history, :id => way.way_id
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "redacted way #{way.way_id} version #{way.version} shouldn't be present in the history."
+ get :version, :id => way.way_id, :version => way.version
+ get :history, :id => way.way_id
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "redacted node #{way.way_id} version #{way.version} shouldn't be present in the history, even when logged in."
+ end
+
+ ##
+ # test the redaction of an old version of a way, 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 => way.way_id
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "way #{way.way_id} version #{way.version} should not be present in the history for moderators when not passing flag."
+ get :history, :id => way.way_id, :show_redactions => 'true'
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 1, "way #{way.way_id} version #{way.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 => way.way_id, :version => way.version
+ assert_response :forbidden, "Redacted node shouldn't be visible via the version API."
+
+ # and when accessed via history
+ get :history, :id => way.way_id
+ assert_response :success, "Redaction shouldn't have stopped history working."
+ assert_select "osm way[id=#{way.way_id}][version=#{way.version}]", 0, "redacted way #{way.way_id} version #{way.version} shouldn't be present in the history."
+ end
+
##
# check that the current version of a way is equivalent to the
# version which we're getting from the versions call.
@@ -99,4+214,12 @@ class OldWayControllerTest < ActionController::TestCase
end
end
+ def do_redact_way(way, redaction)
+ get :version, :id => way.way_id, :version => way.version
+ assert_response :success, "should be able to get version #{way.version} of node #{way.way_id}."