Sha256: 0f0589cb7f2aad91c6ef72bbf8171418fb52562c000d187ffcfd523c4f9a804d

Contents?: true

Size: 1.81 KB

Versions: 52

Compression:

Stored size: 1.81 KB

Contents

require 'helper'

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

  it 'returns a list of blueprint subscriptions for the given course' do
    stub_get(@client, "/api/v1/courses/1/blueprint_subscriptions").to_return(json_response("blueprint_subscriptions.json"))
    subs = @client.blueprint_subscriptions(1)
    expect(subs['id']).to eq 101
    expect(subs['template_id']).to eq 1
    expect(subs['blueprint_course']).to be_present
  end

  it 'returns a blueprint template for the given course' do
    stub_get(@client, "/api/v1/courses/2/blueprint_templates/default").to_return(json_response("blueprint_template.json"))
    template = @client.blueprint_template(2)
    expect(template['id']).to eq 1
    expect(template['course_id']).to eq 2
  end

  it 'updates assocations for a blueprint course' do
    stub_put(@client, "/api/v1/courses/2/blueprint_templates/default/update_associations").to_return(json_response("blueprint_update_assocations_success.json"))
    result = @client.blueprint_update_associations(2, 'default', course_ids_to_add: [123])
    expect(result['success']).to eq true
  end

  it 'starts a migration for a blueprint course' do
    stub_post(@client, "/api/v1/courses/2/blueprint_templates/default/migrations").to_return(json_response("blueprint_migration.json"))
    migration = @client.start_blueprint_migration(2, 'default', {
      comment: 'An optional comment to be included in the sync history.',
      send_notification: false,
      copy_settings: true
    })
    expect(migration['id']).to eq 1
    expect(migration['template_id']).to eq 2
    expect(migration['subscription_id']).to eq 101
    expect(migration['user_id']).to eq 3
    expect(migration['workflow_state']).to eq 'running'
  end

end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
bearcat-1.5.37 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.36 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.35 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.34 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.33 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.32 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.31 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.30 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.29 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.28 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.28.beta1 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.26 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.24 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.23 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.20 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.19 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.17 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.16 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.15 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.14 spec/bearcat/client/blueprint_courses_spec.rb