+ assert_require_public_data("shouldn't be able to delete node when user's data isn't public'")
+
+ # this won't work since the node is already deleted
+ content(nodes(:invisible_node).to_xml)
+ delete :delete, :id => current_nodes(:invisible_node).id
+ assert_require_public_data
+
+ # this won't work since the node never existed
+ delete :delete, :id => 0
+ assert_require_public_data
+
+ ## these test whether nodes which are in-use can be deleted:
+ # in a way...
+ content(nodes(:used_node_1).to_xml)
+ delete :delete, :id => current_nodes(:used_node_1).id
+ assert_require_public_data
+ "shouldn't be able to delete a node used in a way (#{@response.body})"
+
+ # in a relation...
+ content(nodes(:node_used_by_relationship).to_xml)
+ delete :delete, :id => current_nodes(:node_used_by_relationship).id
+ assert_require_public_data
+ "shouldn't be able to delete a node used in a relation (#{@response.body})"
+
+
+
+ ## now set auth for the public data user
+ basic_authorization(users(:public_user).email, "test");
+
+ # try to delete with an invalid (closed) changeset
+ content update_changeset(current_nodes(:visible_node).to_xml,
+ changesets(:normal_user_closed_change).id)
+ delete :delete, :id => current_nodes(:visible_node).id
+ assert_response :conflict
+
+ # try to delete with an invalid (non-existent) changeset
+ content update_changeset(current_nodes(:visible_node).to_xml,0)
+ delete :delete, :id => current_nodes(:visible_node).id
+ assert_response :conflict
+
+ # valid delete now takes a payload
+ content(nodes(:public_visible_node).to_xml)
+ delete :delete, :id => current_nodes(:public_visible_node).id