Move current version redaction tests above roles/scopes tests
This commit is contained in:
parent
03ebd2ac5e
commit
319c9af975
3 changed files with 42 additions and 42 deletions
|
@ -193,20 +193,6 @@ module Api
|
|||
assert_match(/lon="0.0000800"/, response.body)
|
||||
end
|
||||
|
||||
##
|
||||
# test the redaction of an old version of a node, while not being
|
||||
# authorised.
|
||||
def test_redact_node_unauthorised
|
||||
node = create(:node, :with_history, :version => 2)
|
||||
old_node = node.old_nodes.find_by(:version => 1)
|
||||
redaction = create(:redaction)
|
||||
|
||||
post node_version_redact_path(*old_node.id), :params => { :redaction => redaction.id }
|
||||
|
||||
assert_response :unauthorized, "should need to be authenticated to redact."
|
||||
assert_nil old_node.reload.redaction
|
||||
end
|
||||
|
||||
##
|
||||
# test that, even as moderator, the current version of a node
|
||||
# can't be redacted.
|
||||
|
@ -222,6 +208,20 @@ module Api
|
|||
assert_nil old_node.reload.redaction
|
||||
end
|
||||
|
||||
##
|
||||
# test the redaction of an old version of a node, while not being
|
||||
# authorised.
|
||||
def test_redact_node_unauthorised
|
||||
node = create(:node, :with_history, :version => 2)
|
||||
old_node = node.old_nodes.find_by(:version => 1)
|
||||
redaction = create(:redaction)
|
||||
|
||||
post node_version_redact_path(*old_node.id), :params => { :redaction => redaction.id }
|
||||
|
||||
assert_response :unauthorized, "should need to be authenticated to redact."
|
||||
assert_nil old_node.reload.redaction
|
||||
end
|
||||
|
||||
def test_redact_node_by_regular_without_write_redactions_scope
|
||||
node = create(:node, :with_history, :version => 2)
|
||||
old_node = node.old_nodes.find_by(:version => 1)
|
||||
|
|
|
@ -184,20 +184,6 @@ module Api
|
|||
assert_response :success, "Redacted relation should not be gone for moderator, when flag passed."
|
||||
end
|
||||
|
||||
##
|
||||
# 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 => 1)
|
||||
redaction = create(:redaction)
|
||||
|
||||
post relation_version_redact_path(*old_relation.id), :params => { :redaction => redaction.id }
|
||||
|
||||
assert_response :unauthorized, "should need to be authenticated to redact."
|
||||
assert_nil old_relation.reload.redaction
|
||||
end
|
||||
|
||||
##
|
||||
# test that, even as moderator, the current version of a relation
|
||||
# can't be redacted.
|
||||
|
@ -213,6 +199,20 @@ module Api
|
|||
assert_nil old_relation.reload.redaction
|
||||
end
|
||||
|
||||
##
|
||||
# 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 => 1)
|
||||
redaction = create(:redaction)
|
||||
|
||||
post relation_version_redact_path(*old_relation.id), :params => { :redaction => redaction.id }
|
||||
|
||||
assert_response :unauthorized, "should need to be authenticated to redact."
|
||||
assert_nil old_relation.reload.redaction
|
||||
end
|
||||
|
||||
def test_redact_relation_by_regular_without_write_redactions_scope
|
||||
relation = create(:relation, :with_history, :version => 2)
|
||||
old_relation = relation.old_relations.find_by(:version => 1)
|
||||
|
|
|
@ -195,20 +195,6 @@ module Api
|
|||
check_history_equals_versions(way_with_versions.id)
|
||||
end
|
||||
|
||||
##
|
||||
# test the redaction of an old version of a way, while not being
|
||||
# authorised.
|
||||
def test_redact_way_unauthorised
|
||||
way = create(:way, :with_history, :version => 2)
|
||||
old_way = way.old_ways.find_by(:version => 1)
|
||||
redaction = create(:redaction)
|
||||
|
||||
post way_version_redact_path(*old_way.id), :params => { :redaction => redaction.id }
|
||||
|
||||
assert_response :unauthorized, "should need to be authenticated to redact."
|
||||
assert_nil old_way.reload.redaction
|
||||
end
|
||||
|
||||
##
|
||||
# test that, even as moderator, the current version of a way
|
||||
# can't be redacted.
|
||||
|
@ -224,6 +210,20 @@ module Api
|
|||
assert_nil old_way.reload.redaction
|
||||
end
|
||||
|
||||
##
|
||||
# test the redaction of an old version of a way, while not being
|
||||
# authorised.
|
||||
def test_redact_way_unauthorised
|
||||
way = create(:way, :with_history, :version => 2)
|
||||
old_way = way.old_ways.find_by(:version => 1)
|
||||
redaction = create(:redaction)
|
||||
|
||||
post way_version_redact_path(*old_way.id), :params => { :redaction => redaction.id }
|
||||
|
||||
assert_response :unauthorized, "should need to be authenticated to redact."
|
||||
assert_nil old_way.reload.redaction
|
||||
end
|
||||
|
||||
def test_redact_way_by_regular_without_write_redactions_scope
|
||||
way = create(:way, :with_history, :version => 2)
|
||||
old_way = way.old_ways.find_by(:version => 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue