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").
      with(:body => {"name" => "cc.imscc", "size" => "2034"}).
      to_return(json_response('content_migrations', 'upload_success.json'))

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

      response = @client.upload_content_package('my/upload/path', fixture('cc.imscc'))
      expect(response['id']).to eq 293
    end

end