forked from expertiza/reimplementation-back-end
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kmalick
committed
Jan 22, 2025
1 parent
fb7b800
commit 53a04d8
Showing
3 changed files
with
77 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,41 +11,39 @@ | |
@student = Role.find_or_create_by(name: 'Student', parent_id: @ta.id) | ||
end | ||
|
||
let(:prof) { User.create( | ||
name: "profa", | ||
password_digest: "password", | ||
role_id: @instructor.id, | ||
full_name: "Prof A", | ||
email: "[email protected]", | ||
mru_directory_path: "/home/testuser", | ||
) } | ||
let(:prof) { | ||
User.create( | ||
name: "profa", | ||
password_digest: "password", | ||
role_id: @instructor.id, | ||
full_name: "Prof A", | ||
email: "[email protected]", | ||
mru_directory_path: "/home/testuser", | ||
) | ||
} | ||
|
||
let(:token) { JsonWebToken.encode({id: prof.id}) } | ||
let(:token) { JsonWebToken.encode({ id: prof.id }) } | ||
let(:Authorization) { "Bearer #{token}" } | ||
|
||
|
||
# GET /courses/{id}/add_ta/{ta_id} | ||
path '/api/v1/courses/{id}/add_ta/{ta_id}' do | ||
parameter name: :id, in: :path, type: :integer, required: true | ||
parameter name: :ta_id, in: :path, type: :integer, required: true | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:prof) { User.create( | ||
name: "profa", | ||
password_digest: "password", | ||
role_id: 4, | ||
fullname: "Prof A", | ||
email: "[email protected]", | ||
mru_directory_path: "/home/testuser", | ||
) } | ||
let(:ta) { User.create( | ||
name: "taa", | ||
password_digest: "password", | ||
role_id: 3, | ||
fullname: "TA A", | ||
email: "[email protected]", | ||
mru_directory_path: "/home/testuser", | ||
) } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:ta) { | ||
User.create( | ||
name: "taa", | ||
password_digest: "password", | ||
role_id: @ta.id, | ||
full_name: "TA A", | ||
email: "[email protected]", | ||
mru_directory_path: "/home/testuser", | ||
) | ||
} | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
let(:ta_id) { ta.id } | ||
get('add_ta course') do | ||
|
@@ -82,7 +80,10 @@ | |
path '/api/v1/courses/{id}/tas' do | ||
parameter name: 'id', in: :path, type: :string, description: 'id' | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
get('view_tas course') do | ||
tags 'Courses' | ||
|
@@ -104,16 +105,21 @@ | |
parameter name: 'id', in: :path, type: :string, description: 'id' | ||
parameter name: 'ta_id', in: :path, type: :string, description: 'ta_id' | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
let(:ta) { User.create( | ||
name: "taa", | ||
password_digest: "password", | ||
role_id: 3, | ||
fullname: "TA A", | ||
email: "[email protected]", | ||
mru_directory_path: "/home/testuser", | ||
) } | ||
let(:ta) { | ||
User.create( | ||
name: "taa", | ||
password_digest: "password", | ||
role_id: @ta.id, | ||
full_name: "TA A", | ||
email: "[email protected]", | ||
mru_directory_path: "/home/testuser", | ||
) | ||
} | ||
let(:ta_id) { ta.id } | ||
let(:ta_mapping) { TaMapping.create(course_id: course.id, ta_id: ta.id) } | ||
get('remove_ta course') do | ||
|
@@ -140,7 +146,10 @@ | |
path '/api/v1/courses/{id}/copy' do | ||
parameter name: 'id', in: :path, type: :string, description: 'id' | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
get('copy course') do | ||
tags 'Courses' | ||
|
@@ -190,7 +199,10 @@ | |
} | ||
response(201, 'successful') do | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { { institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank' } } | ||
let(:course) { | ||
{ institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank' } | ||
} | ||
after do |example| | ||
example.metadata[:response][:content] = { | ||
'application/json' => { | ||
|
@@ -207,7 +219,10 @@ | |
path '/api/v1/courses/{id}' do | ||
parameter name: 'id', in: :path, type: :string, description: 'id' | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
get('show course') do | ||
tags 'Courses' | ||
|
@@ -239,7 +254,10 @@ | |
required: %w[] | ||
} | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
response(200, 'successful') do | ||
after do |example| | ||
|
@@ -269,7 +287,10 @@ | |
required: %w[] | ||
} | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
response(200, 'successful') do | ||
after do |example| | ||
|
@@ -287,7 +308,10 @@ | |
delete('delete course') do | ||
tags 'Courses' | ||
let(:institution) { Institution.create(name: "NC State") } | ||
let(:course) { Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', info: 'blank') } | ||
let(:course) { | ||
Course.create(institution_id: institution.id, instructor_id: prof.id, directory_path: 'samplepath', name: 'OODD', | ||
info: 'blank') | ||
} | ||
let(:id) { course.id } | ||
response(204, 'successful') do | ||
after do |example| | ||
|