course exports use instfs if enabled

closes RECNVS-414

test plan
- with instfs enabled
  - have a course
  - export it
  - verify that the download comes from instfs, not canvas

Change-Id: I18dec04f7c98e85163cd29afeba6b1878a0f62c6
Reviewed-on: https://gerrit.instructure.com/148704
Tested-by: Jenkins
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Collin Parrish <cparrish@instructure.com>
Product-Review: Michael Jasper <mjasper@instructure.com>
This commit is contained in:
Michael Jasper 2018-04-30 16:56:54 -06:00
parent adc0455369
commit 7cbf9917eb
2 changed files with 10 additions and 1 deletions

View File

@ -98,7 +98,8 @@ module CC
att = Attachment.new
att.context = @content_export
att.user = @content_export.user
att.uploaded_data = Rack::Test::UploadedFile.new(@export_path, @export_type || Attachment.mimetype(@export_path))
data = Rack::Test::UploadedFile.new(@export_path, @export_type || Attachment.mimetype(@export_path))
Attachments::Storage.store_for_attachment(att, data)
if att.save
@content_export.attachment = att
@content_export.save

View File

@ -200,6 +200,14 @@ describe "Common Cartridge exporting" do
expect(ccc_schema.validate(doc)).to be_empty
end
it "should use instfs to host export files if it is enabled" do
allow(InstFS).to receive(:enabled?).and_return(true)
uuid = "1234-abcd"
allow(InstFS).to receive(:direct_upload).and_return(uuid)
@ce.export_without_send_later
expect(@ce.attachments.first.instfs_uuid).to eq(uuid)
end
it "should create a quizzes-only export" do
@q1 = @course.quizzes.create!(:title => 'quiz1')