##// END OF EJS Templates
API: creating an issue with an invalid project_id should return 422 instead of 403 (#19276)....
Jean-Philippe Lang -
r13759:d5093417971b
parent child
Show More
@@ -133,7 +133,7 class IssuesController < ApplicationController
133 end
133 end
134
134
135 def create
135 def create
136 unless User.current.allowed_to?(:add_issues, @issue.project)
136 unless User.current.allowed_to?(:add_issues, @issue.project, :global => true)
137 raise ::Unauthorized
137 raise ::Unauthorized
138 end
138 end
139 call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
139 call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
@@ -444,6 +444,11 JSON
444 assert json['errors'].include?("Subject cannot be blank")
444 assert json['errors'].include?("Subject cannot be blank")
445 end
445 end
446
446
447 test "POST /issues.json with invalid project_id should respond with 422" do
448 post '/issues.json', {:issue => {:project_id => 999, :subject => "API"}}, credentials('jsmith')
449 assert_response 422
450 end
451
447 test "PUT /issues/:id.xml" do
452 test "PUT /issues/:id.xml" do
448 assert_difference('Journal.count') do
453 assert_difference('Journal.count') do
449 put '/issues/6.xml',
454 put '/issues/6.xml',
General Comments 0
You need to be logged in to leave comments. Login now