Sha256: 98d8b36c0000fa11b55a50afbaa5f79097ebc4867a7fc215c05ba3df25c58623

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

require 'helper'

describe Bearcat::Client::ContentMigrations do
  before do
    @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
  end

  it 'uploads a file' do
    stub_post(@client, "/my/upload/path").
    to_return(json_response('content_migration_files/response.json'))

    stub_request(:post, "http://host/files_api").
      to_return(status: 302, headers: {'Location' => 'https://confirm-upload.invalid/confirm?param=true'})

    stub_post(@client, '/confirm').to_return(json_response('content_migration_files/upload_success.json'))

    opts = {migration_type: 'canvas_cartridge_importer', pre_attachment: {name: 'cc.imscc', size: '2034'}}
    response = @client.upload_content_package('my/upload/path', fixture('cc.imscc'), opts)
    expect(response['id']).to eq 293
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bearcat-1.3.4 spec/bearcat/client/content_migrations_spec.rb
bearcat-1.3.3 spec/bearcat/client/content_migrations_spec.rb