summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-02-05 08:33:29 +0000
committerGo MAEDA <maeda@farend.jp>2019-02-05 08:33:29 +0000
commit29063283da5d333b990e2ce3a8c6221133f305c9 (patch)
tree2b9ebb6c7003652a378010d65108caab5ab46c67 /test/integration
parentf4b2c1a0d3ea597fcaa8dd5a4fd7a2875a7241d3 (diff)
downloadredmine-29063283da5d333b990e2ce3a8c6221133f305c9.tar.gz
redmine-29063283da5d333b990e2ce3a8c6221133f305c9.zip
Ajax Request Returns 200 but an error event is fired instead of success (#30073).
Patch by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@17849 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api_test/api_test.rb2
-rw-r--r--test/integration/api_test/attachments_test.rb8
-rw-r--r--test/integration/api_test/groups_test.rb8
-rw-r--r--test/integration/api_test/issue_categories_test.rb6
-rw-r--r--test/integration/api_test/issue_relations_test.rb2
-rw-r--r--test/integration/api_test/issues_test.rb12
-rw-r--r--test/integration/api_test/memberships_test.rb4
-rw-r--r--test/integration/api_test/projects_test.rb10
-rw-r--r--test/integration/api_test/time_entries_test.rb4
-rw-r--r--test/integration/api_test/users_test.rb8
-rw-r--r--test/integration/api_test/versions_test.rb4
-rw-r--r--test/integration/api_test/wiki_pages_test.rb6
12 files changed, 37 insertions, 37 deletions
diff --git a/test/integration/api_test/api_test.rb b/test/integration/api_test/api_test.rb
index b7723e974..469876f61 100644
--- a/test/integration/api_test/api_test.rb
+++ b/test/integration/api_test/api_test.rb
@@ -49,7 +49,7 @@ class Redmine::ApiTest::ApiTest < Redmine::ApiTest::Base
def test_head_response_should_have_empty_body
put '/users/7.xml', :params => {:user => {:login => 'foo'}}, :headers => credentials('admin')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
end
diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb
index 4983a3d64..5095a9504 100644
--- a/test/integration/api_test/attachments_test.rb
+++ b/test/integration/api_test/attachments_test.rb
@@ -84,7 +84,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "DELETE /attachments/:id.xml should return ok and delete Attachment" do
assert_difference 'Attachment.count', -1 do
delete '/attachments/7.xml', :headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
assert_nil Attachment.find_by_id(7)
@@ -93,7 +93,7 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
test "DELETE /attachments/:id.json should return ok and delete Attachment" do
assert_difference 'Attachment.count', -1 do
delete '/attachments/7.json', :headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
assert_nil Attachment.find_by_id(7)
@@ -104,8 +104,8 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
:params => {:attachment => {:filename => 'renamed.zip', :description => 'updated'}},
:headers => credentials('jsmith')
- assert_response :ok
- assert_equal 'application/json', response.content_type
+ assert_response :no_content
+ assert_nil response.content_type
attachment = Attachment.find(7)
assert_equal 'renamed.zip', attachment.filename
assert_equal 'updated', attachment.description
diff --git a/test/integration/api_test/groups_test.rb b/test/integration/api_test/groups_test.rb
index d1dd8d686..de6906ff4 100644
--- a/test/integration/api_test/groups_test.rb
+++ b/test/integration/api_test/groups_test.rb
@@ -157,7 +157,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
put "/groups/#{group.id}.xml",
:params => {:group => {:name => 'New name', :user_ids => [2, 3]}},
:headers => credentials('admin')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_equal 'New name', group.reload.name
@@ -181,7 +181,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
group = Group.generate!
assert_difference 'Group.count', -1 do
delete "/groups/#{group.id}.xml", :headers => credentials('admin')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
end
@@ -192,7 +192,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
post "/groups/#{group.id}/users.xml",
:params => {:user_id => 5},
:headers => credentials('admin')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
assert_include User.find(5), group.reload.users
@@ -220,7 +220,7 @@ class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base
assert_difference 'group.reload.users.count', -1 do
delete "/groups/#{group.id}/users/8.xml", :headers => credentials('admin')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
assert_not_include User.find(8), group.reload.users
diff --git a/test/integration/api_test/issue_categories_test.rb b/test/integration/api_test/issue_categories_test.rb
index a7d01876f..a1fd70f3f 100644
--- a/test/integration/api_test/issue_categories_test.rb
+++ b/test/integration/api_test/issue_categories_test.rb
@@ -70,7 +70,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base
:params => {:issue_category => {:name => 'API Update'}},
:headers => credentials('jsmith')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_equal 'API Update', IssueCategory.find(2).name
end
@@ -91,7 +91,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base
assert_difference 'IssueCategory.count', -1 do
delete '/issue_categories/1.xml', :headers => credentials('jsmith')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_nil IssueCategory.find_by_id(1)
end
@@ -107,7 +107,7 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base
:headers => credentials('jsmith')
end
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_nil IssueCategory.find_by_id(1)
end
diff --git a/test/integration/api_test/issue_relations_test.rb b/test/integration/api_test/issue_relations_test.rb
index 79c16d915..913322e84 100644
--- a/test/integration/api_test/issue_relations_test.rb
+++ b/test/integration/api_test/issue_relations_test.rb
@@ -77,7 +77,7 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base
delete '/relations/2.xml', :headers => credentials('jsmith')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_nil IssueRelation.find_by_id(2)
end
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb
index fc58014fc..207374823 100644
--- a/test/integration/api_test/issues_test.rb
+++ b/test/integration/api_test/issues_test.rb
@@ -795,7 +795,7 @@ JSON
:params => {:issue => {:subject => 'API update', :notes => 'A new note'}},
:headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
@@ -819,7 +819,7 @@ JSON
assert_difference('Issue.count', -1) do
delete '/issues/6.xml', :headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
assert_nil Issue.find_by_id(6)
@@ -829,7 +829,7 @@ JSON
assert_difference('Issue.count', -1) do
delete '/issues/6.json', :headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
assert_nil Issue.find_by_id(6)
@@ -841,7 +841,7 @@ JSON
:params => {:user_id => 3},
:headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
watcher = Watcher.order('id desc').first
@@ -855,7 +855,7 @@ JSON
assert_difference 'Watcher.count', -1 do
delete '/issues/1/watchers/3.xml', :headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', response.body
end
assert_equal false, Issue.find(1).watched_by?(User.find(3))
@@ -972,7 +972,7 @@ JSON
:uploads => [{:token => token, :filename => 'test.txt',
:content_type => 'text/plain'}]}},
:headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
diff --git a/test/integration/api_test/memberships_test.rb b/test/integration/api_test/memberships_test.rb
index f9d61646c..95e10d18f 100644
--- a/test/integration/api_test/memberships_test.rb
+++ b/test/integration/api_test/memberships_test.rb
@@ -135,7 +135,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base
:params => {:membership => {:user_id => 3, :role_ids => [1,2]}},
:headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
member = Member.find(2)
@@ -156,7 +156,7 @@ class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base
assert_difference 'Member.count', -1 do
delete '/memberships/2.xml', :headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
assert_nil Member.find_by_id(2)
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb
index f5d1e69c2..b804e8d00 100644
--- a/test/integration/api_test/projects_test.rb
+++ b/test/integration/api_test/projects_test.rb
@@ -198,9 +198,9 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
:params => {:project => {:name => 'API update'}},
:headers => credentials('jsmith')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
- assert_equal 'application/xml', @response.content_type
+ assert_nil @response.content_type
project = Project.find(2)
assert_equal 'API update', project.name
end
@@ -211,7 +211,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
:params => {:project => {:name => 'API update', :enabled_module_names => ['issue_tracking', 'news', 'time_tracking']}},
:headers => credentials('admin')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
project = Project.find(2)
assert_equal ['issue_tracking', 'news', 'time_tracking'], project.enabled_module_names.sort
@@ -223,7 +223,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
:params => {:project => {:name => 'API update', :tracker_ids => [1, 3]}},
:headers => credentials('admin')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
project = Project.find(2)
assert_equal [1, 3], project.trackers.map(&:id).sort
@@ -245,7 +245,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
assert_difference('Project.count',-1) do
delete '/projects/2.xml', :headers => credentials('admin')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_nil Project.find_by_id(2)
end
diff --git a/test/integration/api_test/time_entries_test.rb b/test/integration/api_test/time_entries_test.rb
index 832619437..832a45d73 100644
--- a/test/integration/api_test/time_entries_test.rb
+++ b/test/integration/api_test/time_entries_test.rb
@@ -135,7 +135,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base
:params => {:time_entry => {:comments => 'API Update'}},
:headers => credentials('jsmith')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_equal 'API Update', TimeEntry.find(2).comments
end
@@ -164,7 +164,7 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base
assert_difference 'TimeEntry.count', -1 do
delete '/time_entries/2.xml', :headers => credentials('jsmith')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_nil TimeEntry.find_by_id(2)
end
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb
index eb96b2d29..9847ca477 100644
--- a/test/integration/api_test/users_test.rb
+++ b/test/integration/api_test/users_test.rb
@@ -256,7 +256,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
assert_equal 'jsmith@somenet.foo', user.mail
assert !user.admin?
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
@@ -279,7 +279,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
assert_equal 'jsmith@somenet.foo', user.mail
assert !user.admin?
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
@@ -325,7 +325,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
delete '/users/2.xml', :headers => credentials('admin')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
@@ -334,7 +334,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
delete '/users/2.json', :headers => credentials('admin')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
end
end
diff --git a/test/integration/api_test/versions_test.rb b/test/integration/api_test/versions_test.rb
index 8f8b75e43..144ef531b 100644
--- a/test/integration/api_test/versions_test.rb
+++ b/test/integration/api_test/versions_test.rb
@@ -122,7 +122,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
:params => {:version => {:name => 'API update'}},
:headers => credentials('jsmith')
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_equal 'API update', Version.find(2).name
end
@@ -132,7 +132,7 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base
delete '/versions/3.xml', :headers => credentials('jsmith')
end
- assert_response :ok
+ assert_response :no_content
assert_equal '', @response.body
assert_nil Version.find_by_id(3)
end
diff --git a/test/integration/api_test/wiki_pages_test.rb b/test/integration/api_test/wiki_pages_test.rb
index 9cb82c0ac..89b6dac1b 100644
--- a/test/integration/api_test/wiki_pages_test.rb
+++ b/test/integration/api_test/wiki_pages_test.rb
@@ -106,7 +106,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
put '/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => {:wiki_page => {:text => 'New content from API', :comments => 'API update'}},
:headers => credentials('jsmith')
- assert_response 200
+ assert_response :no_content
end
end
@@ -123,7 +123,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
put '/projects/ecookbook/wiki/CookBook_documentation.xml',
:params => {:wiki_page => {:text => 'New content from API', :comments => 'API update', :version => '3'}},
:headers => credentials('jsmith')
- assert_response 200
+ assert_response :no_content
end
end
@@ -201,7 +201,7 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base
test "DELETE /projects/:project_id/wiki/:title.xml should destroy the page" do
assert_difference 'WikiPage.count', -1 do
delete '/projects/ecookbook/wiki/CookBook_documentation.xml', :headers => credentials('jsmith')
- assert_response 200
+ assert_response :no_content
end
assert_nil WikiPage.find_by_id(1)