X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/03ebd2ac5e8048fcf7c5dea1cbdde6d90f606402..319c9af97553f2a37d10097bf1017740ebfdbf12:/test/controllers/api/old_relations_controller_test.rb diff --git a/test/controllers/api/old_relations_controller_test.rb b/test/controllers/api/old_relations_controller_test.rb index ecd9107b4..603499503 100644 --- a/test/controllers/api/old_relations_controller_test.rb +++ b/test/controllers/api/old_relations_controller_test.rb @@ -185,31 +185,31 @@ module Api end ## - # test the redaction of an old version of a relation, while not being - # authorised. - def test_redact_relation_unauthorised + # test that, even as moderator, the current version of a relation + # can't be redacted. + def test_redact_relation_current_version relation = create(:relation, :with_history, :version => 2) - old_relation = relation.old_relations.find_by(:version => 1) + old_relation = relation.old_relations.find_by(:version => 2) redaction = create(:redaction) + auth_header = bearer_authorization_header create(:moderator_user) - post relation_version_redact_path(*old_relation.id), :params => { :redaction => redaction.id } + post relation_version_redact_path(*old_relation.id), :params => { :redaction => redaction.id }, :headers => auth_header - assert_response :unauthorized, "should need to be authenticated to redact." + assert_response :bad_request, "shouldn't be OK to redact current version as moderator." assert_nil old_relation.reload.redaction end ## - # test that, even as moderator, the current version of a relation - # can't be redacted. - def test_redact_relation_current_version + # test the redaction of an old version of a relation, while not being + # authorised. + def test_redact_relation_unauthorised relation = create(:relation, :with_history, :version => 2) - old_relation = relation.old_relations.find_by(:version => 2) + old_relation = relation.old_relations.find_by(:version => 1) redaction = create(:redaction) - auth_header = bearer_authorization_header create(:moderator_user) - post relation_version_redact_path(*old_relation.id), :params => { :redaction => redaction.id }, :headers => auth_header + post relation_version_redact_path(*old_relation.id), :params => { :redaction => redaction.id } - assert_response :bad_request, "shouldn't be OK to redact current version as moderator." + assert_response :unauthorized, "should need to be authenticated to redact." assert_nil old_relation.reload.redaction end