canvas-lms/db/migrate/20180226221155_add_data_to_...

25 lines
828 B
Ruby
Raw Normal View History

Outcome import creation/status endpoints closes OUT-1534 Scheduling of outcome import jobs will occur in a separate PS, after this merges and OUT-1997 is merged too. test plan: - start up canvas - generate api docs: > docker-compose run --rm web bundle exec rake doc:api - load api docs in http://canvas.docker/doc/api/index.html - read over the "Outcomes CSV Format" and make sure it reads well - read over the "Outcomes Import" and make sure it reads well - obtain an access token: https://community.canvaslms.com/docs/DOC-10806-4214724194 - request an outcome import, replace "canvas-path" and "token" values: curl -F attachment=@<canvas-path>/spec/lib/outcomes/fixtures/demo.csv \ -F 'import_type=instructure_csv' \ -H "Authorization: Bearer <token>" \ http://canvas.docker/api/v1/accounts/1/outcome_imports - in a rails console, confirm that the import was accepted: > docker-compose run --rm web bin/rails console % pp OutcomeImport.last # confirm that the import is in the 'created' state, associated with your user and associated with an account context # note the "id" value for later use % pp OutcomeImport.last.attachment # confirm that the attachment is in the 'processed' state and has the filename "test_outcomes_1.csv" passed in above - request the status of the outcome import (should return a message saying "The specified resource does not exist"): curl -H "Authorization: Bearer <token>" \ http://canvas.docker/api/v1/accounts/1/outcome_imports/latest - back in the rails console created above, manually transition the import to "importing": % OutcomeImport.last.job_started - run the above curl command again, and this time the latest outcome import should be returned, in the 'importing' state - run the above curl command again, replacing "latest" with the "id" value obtained above. it should return the same response as the previous step. Change-Id: Ice7d67b625b443cec70f531f2e673face6d6fbeb Reviewed-on: https://gerrit.instructure.com/142024 Reviewed-by: Neil Gupta <ngupta@instructure.com> Reviewed-by: Frank Murphy <fmurphy@instructure.com> Tested-by: Jenkins QA-Review: Frank Murphy <fmurphy@instructure.com> Product-Review: Neil Gupta <ngupta@instructure.com>
2018-02-24 06:18:42 +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 AddDataToOutcomeImports < ActiveRecord::Migration[5.0]
tag :predeploy
def change
add_column :outcome_imports, :data, :json
end
end