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.13 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.12 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.11 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.10 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.9 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.8 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.7 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.6 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.5 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.4 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.3 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.2 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.0 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.0.beta4 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.0.beta3 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.0.beta2 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.5.0.beta1 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.4.13 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.4.12 spec/bearcat/client/blueprint_courses_spec.rb
bearcat-1.4.11 spec/bearcat/client/blueprint_courses_spec.rb