summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-16 15:23:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-16 15:23:11 +0000
commite9f62d1209bfa81df33bcb390eb67ba4cab90c0a (patch)
tree40dff8ceb02a30dce788799904d4a8c145d0d6e2 /test/integration
parent0e3017dc62c672a291cda6053aaba6bda39b2de4 (diff)
downloadredmine-e9f62d1209bfa81df33bcb390eb67ba4cab90c0a.tar.gz
redmine-e9f62d1209bfa81df33bcb390eb67ba4cab90c0a.zip
Enable ability for administrators to delete users (#7296).
User's personal data (eg. preferences, tokens, private queries...) are deleted, public data (eg. issues, wiki edits, attachments...) are reassigned to the anonymous user. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4729 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/users_test.rb40
-rw-r--r--test/integration/routing_test.rb3
2 files changed, 28 insertions, 15 deletions
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb
index e1eb7a237..00dc4cc95 100644
--- a/test/integration/api_test/users_test.rb
+++ b/test/integration/api_test/users_test.rb
@@ -245,26 +245,36 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
end
end
end
+ end
- context "DELETE /users/2" do
- context ".xml" do
- should "not be allowed" do
- assert_no_difference('User.count') do
- delete '/users/2.xml'
- end
-
- assert_response :method_not_allowed
+ context "DELETE /users/2" do
+ context ".xml" do
+ should_allow_api_authentication(:delete,
+ '/users/2.xml',
+ {},
+ {:success_code => :ok})
+
+ should "delete user" do
+ assert_difference('User.count', -1) do
+ delete '/users/2.xml', {}, :authorization => credentials('admin')
end
+
+ assert_response :ok
end
-
- context ".json" do
- should "not be allowed" do
- assert_no_difference('User.count') do
- delete '/users/2.json'
- end
+ end
+
+ context ".json" do
+ should_allow_api_authentication(:delete,
+ '/users/2.xml',
+ {},
+ {:success_code => :ok})
- assert_response :method_not_allowed
+ should "delete user" do
+ assert_difference('User.count', -1) do
+ delete '/users/2.json', {}, :authorization => credentials('admin')
end
+
+ assert_response :ok
end
end
end
diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb
index 4b18e317a..1198081fc 100644
--- a/test/integration/routing_test.rb
+++ b/test/integration/routing_test.rb
@@ -302,6 +302,9 @@ class RoutingTest < ActionController::IntegrationTest
should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
+
+ should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
+ should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
end
# TODO: should they all be scoped under /projects/:project_id ?