canvas-lms/db/migrate/20180413213456_create_outco...

30 lines
957 B
Ruby
Raw Normal View History

Outcome proficiency endpoints closes OUT-1855, OUT-2214 test plan: - create an access token, which will be used below to perform HTTP requests, see: https://canvas.instructure.com/doc/api/file.oauth.html#using-access-tokens - using a tool like Postman, set an outcome proficiency for an account. perform a POST request at the endpoint `http://canvas.docker/api/v1/accounts/1/outcome_proficiency` with a `Content-Type` header value `application/json` and body with content like: { "ratings": [ { "description": "great work", "points": 10, "mastery": true, "color": "00ff00" } ] } - retrieve the saved proficiency by performing GET request at the endpoint `http://canvas.docker/api/v1/accounts/1/outcome_proficiency`. it should match the proficiency created above. - update the proficiency by doing another POST request, but with multiple ratings, like: { "ratings": [ { "description": "great work", "points": 10, "mastery": true, "color": "00ff00" }, { "description": "bad work", "points": 0, "mastery": false, "color": "ff0000" } ] } - do a GET request to confirm the above changes were saved - do several other POST requests with multiple ratings that contain either multiple mastery ratings or none. these requests should fail with a 422 status code and an error message that contains `Only one rating can have mastery`. Change-Id: Ib301c0394a99dbf55d7d85ceef28a95075faaec2 Reviewed-on: https://gerrit.instructure.com/150095 Reviewed-by: Frank Murphy <fmurphy@instructure.com> Tested-by: Jenkins Reviewed-by: Rob Orton <rob@instructure.com> Reviewed-by: Matt Berns <mberns@instructure.com> QA-Review: Andrew Porter <hporter-c@instructure.com> Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2018-04-14 06:16:16 +08:00
#
# Copyright (C) 2018 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
class CreateOutcomeProficiencies < ActiveRecord::Migration[5.1]
tag :predeploy
def change
create_table :outcome_proficiencies do |t|
t.belongs_to :account, index: { unique: true }, foreign_key: true, limit: 8, null: false
t.timestamps
end
end
end