+ # this tests deletion restrictions - basic deletion is tested in the unit
+ # tests for node!
+ def test_delete
+
+ # first try to delete node without auth
+ delete :delete, :id => current_nodes(:visible_node).id
+ assert_response :unauthorized
+
+ # now set auth
+ basic_authorization(users(:normal_user).email, "test");
+
+ # delete now takes a payload
+ content(nodes(:visible_node).to_xml)
+ delete :delete, :id => current_nodes(:visible_node).id
+ assert_response :success
+
+ # 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_response :gone
+
+ # this won't work since the node never existed
+ delete :delete, :id => 0
+ assert_response :not_found
+
+ # this won't work since the node is in use
+ content(nodes(:used_node_1).to_xml)
+ delete :delete, :id => current_nodes(:used_node_1).id
+ assert_response :precondition_failed
+ end
+
+