summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-11-22 23:28:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-11-22 23:28:12 +0000
commita74ffeff07491fd2c4b20ec37ca7c56e09caa258 (patch)
tree7bec936b3c05372d197cc4b1ce4a925c834e3aa7 /test
parent1cf93f6e32ccb6893bf93afe842880b57dbce1b4 (diff)
downloadredmine-a74ffeff07491fd2c4b20ec37ca7c56e09caa258.tar.gz
redmine-a74ffeff07491fd2c4b20ec37ca7c56e09caa258.zip
Merged r12311 (#15427).
git-svn-id: http://svn.redmine.org/redmine/branches/2.4-stable@12312 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/integration/api_test/api_test.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/integration/api_test/api_test.rb b/test/integration/api_test/api_test.rb
new file mode 100644
index 000000000..f4eb3b421
--- /dev/null
+++ b/test/integration/api_test/api_test.rb
@@ -0,0 +1,41 @@
+# Redmine - project management software
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require File.expand_path('../../../test_helper', __FILE__)
+
+class Redmine::ApiTest::ApiTest < Redmine::ApiTest::Base
+ fixtures :users
+
+ def setup
+ Setting.rest_api_enabled = '1'
+ end
+
+ def test_api_should_work_with_protect_from_forgery
+ ActionController::Base.allow_forgery_protection = true
+ assert_difference('User.count') do
+ post '/users.xml', {
+ :user => {
+ :login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname',
+ :mail => 'foo@example.net', :password => 'secret123'}
+ },
+ credentials('admin')
+ assert_response 201
+ end
+ ensure
+ ActionController::Base.allow_forgery_protection = false
+ end
+end \ No newline at end of file