spec: fix assignment specs
Test Plan: 1. Pass Jenkins Change-Id: I187f1a4c0bbcc90538b71640b8a125885c6257eb Reviewed-on: https://gerrit.instructure.com/156349 Tested-by: Jenkins Reviewed-by: Robert Lamb <rlamb@instructure.com> Product-Review: Robert Lamb <rlamb@instructure.com> QA-Review: Robert Lamb <rlamb@instructure.com>
This commit is contained in:
parent
4cd8fa4e42
commit
d1dc057f72
|
@ -21,7 +21,7 @@ require_relative '../pact_helper'
|
|||
describe 'Assignments', :pact do
|
||||
subject(:assignments_api) { Helper::ApiClient::Assignments.new }
|
||||
|
||||
it 'List Assignments' do
|
||||
it 'should List Assignments' do
|
||||
canvas_lms_api.given('a student in a course with an assignment').
|
||||
upon_receiving('List Assignments').
|
||||
with(
|
||||
|
@ -47,8 +47,8 @@ describe 'Assignments', :pact do
|
|||
end
|
||||
|
||||
|
||||
it 'Post Assignments' do
|
||||
canvas_lms_api.given('a teacher in a course').
|
||||
it 'should Post Assignments' do
|
||||
canvas_lms_api.given('a teacher enrolled in a course').
|
||||
upon_receiving('Post Assignments').
|
||||
with(
|
||||
method: :post,
|
||||
|
|
|
@ -21,7 +21,7 @@ require_relative '../pact_helper'
|
|||
describe 'Courses', :pact do
|
||||
subject(:courses_api) { Helper::ApiClient::Courses.new }
|
||||
|
||||
it 'List Courses' do
|
||||
it 'should List Courses' do
|
||||
canvas_lms_api.given('a student enrolled in a course').
|
||||
upon_receiving('List Courses').
|
||||
with(
|
||||
|
@ -72,7 +72,7 @@ describe 'Courses', :pact do
|
|||
expect(response[0]['name']).to eq 'Course1A'
|
||||
end
|
||||
|
||||
it 'List Students' do
|
||||
it 'should List Students' do
|
||||
canvas_lms_api.given('a student enrolled in a course').
|
||||
upon_receiving('List Students').
|
||||
with(
|
||||
|
@ -102,7 +102,7 @@ describe 'Courses', :pact do
|
|||
expect(response[0]['name']).to eq 'student1'
|
||||
end
|
||||
|
||||
it 'List Teachers' do
|
||||
it 'should List Teachers' do
|
||||
canvas_lms_api.given('a teacher enrolled in a course').
|
||||
upon_receiving('List Teachers').
|
||||
with(
|
||||
|
@ -133,39 +133,37 @@ describe 'Courses', :pact do
|
|||
end
|
||||
|
||||
|
||||
context 'List TAs' do
|
||||
it 'should return JSON body' do
|
||||
canvas_lms_api.given('a teacher assistant enrolled in a course').
|
||||
upon_receiving('List TAs').
|
||||
with(
|
||||
method: :get,
|
||||
headers: {
|
||||
'Authorization': 'Bearer some_token',
|
||||
'Auth-User': 'TeacherAssistant1',
|
||||
'Connection': 'close',
|
||||
'Host': PactConfig.mock_provider_service_base_uri,
|
||||
'Version': 'HTTP/1.1'
|
||||
},
|
||||
'path' => '/api/v1/courses/1/users',
|
||||
query: 'enrollment_type[]=ta'
|
||||
).
|
||||
will_respond_with(
|
||||
status: 200,
|
||||
body: Pact.each_like(
|
||||
'id': 2,
|
||||
'name': 'ta1',
|
||||
'sortable_name': 'ta1',
|
||||
'short_name': 'ta1'
|
||||
)
|
||||
it 'should List TAs' do
|
||||
canvas_lms_api.given('a teacher assistant enrolled in a course').
|
||||
upon_receiving('List TAs').
|
||||
with(
|
||||
method: :get,
|
||||
headers: {
|
||||
'Authorization': 'Bearer some_token',
|
||||
'Auth-User': 'TeacherAssistant1',
|
||||
'Connection': 'close',
|
||||
'Host': PactConfig.mock_provider_service_base_uri,
|
||||
'Version': 'HTTP/1.1'
|
||||
},
|
||||
'path' => '/api/v1/courses/1/users',
|
||||
query: 'enrollment_type[]=ta'
|
||||
).
|
||||
will_respond_with(
|
||||
status: 200,
|
||||
body: Pact.each_like(
|
||||
'id': 2,
|
||||
'name': 'ta1',
|
||||
'sortable_name': 'ta1',
|
||||
'short_name': 'ta1'
|
||||
)
|
||||
courses_api.authenticate_as_user('TeacherAssistant1')
|
||||
response = courses_api.list_tas(1)
|
||||
expect(response[0]['id']).to eq 2
|
||||
expect(response[0]['name']).to eq 'ta1'
|
||||
end
|
||||
)
|
||||
courses_api.authenticate_as_user('TeacherAssistant1')
|
||||
response = courses_api.list_tas(1)
|
||||
expect(response[0]['id']).to eq 2
|
||||
expect(response[0]['name']).to eq 'ta1'
|
||||
end
|
||||
|
||||
it 'List Observers' do
|
||||
it 'should List Observers' do
|
||||
canvas_lms_api.given('an observer enrolled in a course').
|
||||
upon_receiving('List Observers').
|
||||
with(
|
||||
|
@ -195,7 +193,7 @@ describe 'Courses', :pact do
|
|||
expect(response[0]['name']).to eq 'observer1'
|
||||
end
|
||||
|
||||
it 'List Discussions' do
|
||||
it 'should List Discussions' do
|
||||
canvas_lms_api.given('a student in a course with a discussion').
|
||||
upon_receiving('List Discussions').
|
||||
with(
|
||||
|
@ -271,7 +269,7 @@ describe 'Courses', :pact do
|
|||
expect(response[0]['title']).to eq 'No Title'
|
||||
end
|
||||
|
||||
it 'List Quizzes' do
|
||||
it 'should List Quizzes' do
|
||||
canvas_lms_api.given('a quiz in a course').
|
||||
upon_receiving('List Quizzes').
|
||||
with(
|
||||
|
@ -369,7 +367,7 @@ describe 'Courses', :pact do
|
|||
expect(response[0]['title']).to eq 'Test Quiz'
|
||||
end
|
||||
|
||||
it 'Delete a Course' do
|
||||
it 'should Delete a Course' do
|
||||
canvas_lms_api.given('a teacher enrolled in a course').
|
||||
upon_receiving('Delete a Course').
|
||||
with(
|
||||
|
@ -395,7 +393,7 @@ describe 'Courses', :pact do
|
|||
expect(response['delete']).to eq true
|
||||
end
|
||||
|
||||
it 'List Wiki Pages' do
|
||||
it 'Should List Wiki Pages' do
|
||||
canvas_lms_api.given('a wiki page in a course').
|
||||
upon_receiving('List Wiki Pages').
|
||||
with(
|
||||
|
@ -431,7 +429,7 @@ describe 'Courses', :pact do
|
|||
expect(response[0]['title']).to eq "WIKI Page"
|
||||
end
|
||||
|
||||
it 'Create a Course' do
|
||||
it 'should Create a Course' do
|
||||
canvas_lms_api.given('a site admin').
|
||||
upon_receiving('Create a Course').
|
||||
with(
|
||||
|
@ -499,7 +497,7 @@ describe 'Courses', :pact do
|
|||
expect(response["name"]).to eq "new course"
|
||||
end
|
||||
|
||||
it 'Update a Course' do
|
||||
it 'should Update a Course' do
|
||||
canvas_lms_api.given('a teacher enrolled in a course').
|
||||
upon_receiving('Update a Course').
|
||||
with(
|
||||
|
|
|
@ -26,7 +26,7 @@ PactConfig::Consumers::ALL.each do |consumer|
|
|||
# Assignment ID: 1
|
||||
provider_state 'a student in a course with an assignment' do
|
||||
set_up do
|
||||
course = Pact::Canvas:base_state.course
|
||||
course = Pact::Canvas.base_state.course
|
||||
Assignment.create!(context: course, title: "Assignment1")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue