summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-05-14 14:33:07 +0000
committerGo MAEDA <maeda@farend.jp>2020-05-14 14:33:07 +0000
commitca2bde9fbf0176be069f4c64313216a23558bf89 (patch)
treea5a50705c1ceba85bde6ee14976076304a4c33a1 /test/integration/api_test
parenta924a3dfa1e25ff1acb062abf52525a92e2852d0 (diff)
downloadredmine-ca2bde9fbf0176be069f4c64313216a23558bf89.tar.gz
redmine-ca2bde9fbf0176be069f4c64313216a23558bf89.zip
Updating an issue via REST API causes internal server error if invalid project id is specified (#33417).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@19777 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test')
-rw-r--r--test/integration/api_test/issues_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb
index fffbc4f7b..d040728f9 100644
--- a/test/integration/api_test/issues_test.rb
+++ b/test/integration/api_test/issues_test.rb
@@ -663,6 +663,34 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
assert_response 422
end
+ test "POST /issues.json with invalid project_id and any assigned_to_id should respond with 422" do
+ post(
+ '/issues.json',
+ :params => {
+ :issue => {
+ :project_id => 999,
+ :assigned_to_id => 1,
+ :subject => 'API'
+ }
+ },
+ :headers => credentials('jsmith'))
+ assert_response 422
+ end
+
+ test "POST /issues.json with invalid project_id and any fixed_version_id should respond with 422" do
+ post(
+ '/issues.json',
+ :params => {
+ :issue => {
+ :project_id => 999,
+ :fixed_version_id => 1,
+ :subject => 'API'
+ }
+ },
+ :headers => credentials('jsmith'))
+ assert_response 422
+ end
+
test "PUT /issues/:id.xml" do
assert_difference('Journal.count') do
put(