Merge pull request #939 from openHPI/refactor_proforma_import_export
Refactor Proforma Import/Export
This commit is contained in:
@ -403,7 +403,7 @@ describe ExercisesController do
|
||||
|
||||
let(:post_request) { post :export_external_check, params: {id: exercise.id} }
|
||||
let!(:codeharbor_link) { create(:codeharbor_link, user: user) }
|
||||
let(:external_check_hash) { {message: message, exercise_found: true, update_right: update_right, error: error} }
|
||||
let(:external_check_hash) { {message: message, uuid_found: true, update_right: update_right, error: error} }
|
||||
let(:message) { 'message' }
|
||||
let(:update_right) { true }
|
||||
let(:error) { nil }
|
||||
@ -452,7 +452,7 @@ describe ExercisesController do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#export_external_confirm' do
|
||||
describe 'POST #export_external_confirm' do
|
||||
render_views
|
||||
|
||||
let!(:codeharbor_link) { create(:codeharbor_link, user: user) }
|
||||
@ -489,7 +489,7 @@ describe ExercisesController do
|
||||
end
|
||||
end
|
||||
|
||||
describe '#import_uuid_check' do
|
||||
describe 'POST #import_uuid_check' do
|
||||
let(:exercise) { create(:dummy, uuid: SecureRandom.uuid) }
|
||||
let!(:codeharbor_link) { create(:codeharbor_link, user: user) }
|
||||
let(:uuid) { exercise.reload.uuid }
|
||||
@ -502,7 +502,7 @@ describe ExercisesController do
|
||||
post_request
|
||||
expect(response).to have_http_status(:success)
|
||||
|
||||
expect(JSON.parse(response.body).symbolize_keys[:exercise_found]).to be true
|
||||
expect(JSON.parse(response.body).symbolize_keys[:uuid_found]).to be true
|
||||
expect(JSON.parse(response.body).symbolize_keys[:update_right]).to be true
|
||||
end
|
||||
|
||||
@ -522,7 +522,7 @@ describe ExercisesController do
|
||||
post_request
|
||||
expect(response).to have_http_status(:success)
|
||||
|
||||
expect(JSON.parse(response.body).symbolize_keys[:exercise_found]).to be true
|
||||
expect(JSON.parse(response.body).symbolize_keys[:uuid_found]).to be true
|
||||
expect(JSON.parse(response.body).symbolize_keys[:update_right]).to be false
|
||||
end
|
||||
end
|
||||
@ -534,15 +534,15 @@ describe ExercisesController do
|
||||
post_request
|
||||
expect(response).to have_http_status(:success)
|
||||
|
||||
expect(JSON.parse(response.body).symbolize_keys[:exercise_found]).to be false
|
||||
expect(JSON.parse(response.body).symbolize_keys[:uuid_found]).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #import_exercise' do
|
||||
describe 'POST #import_task' do
|
||||
let(:codeharbor_link) { create(:codeharbor_link, user: user) }
|
||||
let!(:imported_exercise) { create(:fibonacci) }
|
||||
let(:post_request) { post :import_exercise, body: zip_file_content }
|
||||
let(:post_request) { post :import_task, body: zip_file_content }
|
||||
let(:zip_file_content) { 'zipped task xml' }
|
||||
let(:headers) { {'Authorization' => "Bearer #{codeharbor_link.api_key}"} }
|
||||
|
||||
|
Reference in New Issue
Block a user