end
def test_read_changeset
- browse_check "changeset", changesets(:normal_user_first_change).id, "browse/changeset"
- browse_check "changeset", changesets(:public_user_first_change).id, "browse/changeset"
+ private_changeset = create(:changeset, :user => create(:user, :data_public => false))
+ changeset = create(:changeset)
+ browse_check "changeset", private_changeset.id, "browse/changeset"
+ browse_check "changeset", changeset.id, "browse/changeset"
end
def test_read_changeset_hidden_comments
# josm-dev.
## FIXME Move this to an integration test
def test_update_relation_tags
- basic_authorization "test@example.com", "test"
- rel_id = current_relations(:multi_tag_relation).id
- create_list(:relation_tag, 4, :relation => current_relations(:multi_tag_relation))
- cs_id = changesets(:public_user_first_change).id
+ user = create(:user)
+ changeset = create(:changeset, :user => user)
+ relation = create(:relation)
+ create_list(:relation_tag, 4, :relation => relation)
+
+ basic_authorization user.email, "test"
- with_relation(rel_id) do |rel|
+ with_relation(relation.id) do |rel|
# alter one of the tags
tag = rel.find("//osm/relation/tag").first
tag["v"] = "some changed value"
- update_changeset(rel, cs_id)
+ update_changeset(rel, changeset.id)
# check that the downloaded tags are the same as the uploaded tags...
new_version = with_update(rel) do |new_rel|
end
# check the original one in the current_* table again
- with_relation(rel_id) { |r| assert_tags_equal rel, r }
+ with_relation(relation.id) { |r| assert_tags_equal rel, r }
# now check the version in the history
- with_relation(rel_id, new_version) { |r| assert_tags_equal rel, r }
+ with_relation(relation.id, new_version) { |r| assert_tags_equal rel, r }
end
end
# try and update in a closed changeset
content update_changeset(private_way.to_xml,
- create(:changeset, :closed, :user => private_user))
+ create(:changeset, :closed, :user => private_user).id)
put :update, :id => private_way.id
assert_require_public_data "update with closed changeset should be forbidden, when data isn't public"
# try and update in a closed changeset
content update_changeset(way.to_xml,
- changesets(:normal_user_closed_change).id)
+ create(:changeset, :closed, :user => user).id)
put :update, :id => way.id
assert_response :conflict, "update with closed changeset should be rejected"