mute assignments through the api
test plan: * create an assignment using the muted flag = true. It should be muted * update this assignment using the muted flag = false. It should not be muted * update this assignment without using the muted flag. It should not be muted * create an assignment using the muted flag = false. It should not be muted * update this assignment using the muted flag = true. It should be muted. * update this assignment without using the muted flag. It should be muted. Change-Id: I07d1a83dc3cbbcb203ba4454f5d888b453898d7f Reviewed-on: https://gerrit.instructure.com/16790 Reviewed-by: Simon Williams <simon@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Amber Taniuchi <amber@instructure.com>
This commit is contained in:
parent
d74f46eb42
commit
224c18a7f3
|
@ -369,6 +369,12 @@ class AssignmentsApiController < ApplicationController
|
|||
# The assignment group id to put the assignment in.
|
||||
# Defaults to the top assignment group in the course.
|
||||
#
|
||||
# @argument assignment[muted] [Boolean]
|
||||
# Whether this assignment is muted.
|
||||
# A muted assignment does not send change notifications
|
||||
# and hides grades from students.
|
||||
# Defaults to false.
|
||||
#
|
||||
# @argument assignment[assignment_overrides] [Optional, [AssignmentOverride]]
|
||||
# List of overrides for the assignment.
|
||||
# NOTE: The assignment overrides feature is in beta.
|
||||
|
|
|
@ -194,6 +194,8 @@ module Api::V1::Assignment
|
|||
update_params["group_category_id"] = gc.try(:id)
|
||||
end
|
||||
|
||||
assignment.muted = value_to_boolean(assignment_params["muted"]) if assignment_params.key? "muted"
|
||||
|
||||
# do some fiddling with due_at for fancy midnight and add to update_params
|
||||
if update_params.has_key?("due_at")
|
||||
update_params["time_zone_edited"] = Time.zone.name
|
||||
|
|
|
@ -178,7 +178,8 @@ describe AssignmentsApiController, :type => :integration do
|
|||
'test_custom' => {
|
||||
'value' => '1'
|
||||
}
|
||||
}
|
||||
},
|
||||
'muted' => 'true'
|
||||
}
|
||||
)
|
||||
@group_category.reload
|
||||
|
@ -189,7 +190,7 @@ describe AssignmentsApiController, :type => :integration do
|
|||
@json['name'].should == 'some assignment'
|
||||
@json['course_id'].should == @course.id
|
||||
@json['description'].should == 'assignment description'
|
||||
@json['muted'].should == false
|
||||
@json['muted'].should == true
|
||||
@json['lock_at'].should == @assignment.lock_at.iso8601
|
||||
@json['unlock_at'].should == @assignment.unlock_at.iso8601
|
||||
@json['automatic_peer_reviews'].should == true
|
||||
|
@ -401,9 +402,9 @@ describe AssignmentsApiController, :type => :integration do
|
|||
@json['description'].should == 'assignment description'
|
||||
end
|
||||
|
||||
it "does not update the assignment's muted property" do
|
||||
@assignment.muted?.should == false
|
||||
@json['muted'].should == false
|
||||
it "updates the assignment's muted property" do
|
||||
@assignment.muted?.should == true
|
||||
@json['muted'].should == true
|
||||
end
|
||||
|
||||
it "updates the assignment's position" do
|
||||
|
|
Loading…
Reference in New Issue