api: allow only offer as a param to course update
fixes #10063 the coures update api required passing at least one course[*something*] parameter, which meant if all you wanted to do was offer the course, you had to pass a dummy parameter. test plan: - call the course update api an only pass {:offer => 1} - it should work Change-Id: I5b89f1f3f474c3b097083f17403e1da20be4ca56 Reviewed-on: https://gerrit.instructure.com/13057 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Brian Palmer <brianp@instructure.com>
This commit is contained in:
parent
7b8dd548d3
commit
99c5a21022
|
@ -1107,6 +1107,7 @@ class CoursesController < ApplicationController
|
|||
def update
|
||||
@course = api_find(Course, params[:id])
|
||||
if authorized_action(@course, @current_user, :update)
|
||||
params[:course] ||= {}
|
||||
root_account_id = params[:course].delete :root_account_id
|
||||
if root_account_id && Account.site_admin.grants_right?(@current_user, session, :manage_courses)
|
||||
@course.root_account = Account.root_accounts.find(root_account_id)
|
||||
|
|
|
@ -269,6 +269,14 @@ describe CoursesController, :type => :integration do
|
|||
@course.reload
|
||||
@course.end_at.should be_nil
|
||||
end
|
||||
|
||||
it "should allow updating only the offer parameter" do
|
||||
@course.workflow_state = "claimed"
|
||||
@course.save!
|
||||
api_call(:put, @path, @params, {:offer => 1})
|
||||
@course.reload
|
||||
@course.workflow_state.should == "available"
|
||||
end
|
||||
end
|
||||
|
||||
context "a teacher" do
|
||||
|
|
Loading…
Reference in New Issue