handle permissions for progress on sis_batch
fixes CORE-1735 test plan - restore a sis import - it should return a progress - check the progress - it should work Change-Id: I8e39685ab0835de0bb0fb5f8ad8c2e14b075d3b8 Reviewed-on: https://gerrit.instructure.com/161178 Tested-by: Jenkins Reviewed-by: James Williams <jamesw@instructure.com> Product-Review: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
parent
c3d8cf0431
commit
803833e703
|
@ -51,6 +51,11 @@ class SisBatch < ActiveRecord::Base
|
|||
}
|
||||
end
|
||||
|
||||
set_policy do
|
||||
given { |user| self.account.grants_any_right?(user, :manage_sis, :import_sis) }
|
||||
can :read
|
||||
end
|
||||
|
||||
# If you are going to change any settings on the batch before it's processed,
|
||||
# do it in the block passed into this method, so that the changes are saved
|
||||
# before the batch is marked created and eligible for processing.
|
||||
|
|
|
@ -179,13 +179,16 @@ describe SisImportsApiController, type: :request do
|
|||
expect(json).to eq expected_data
|
||||
end
|
||||
|
||||
it 'should restore batch on restore_states' do
|
||||
it 'should restore batch on restore_states and return progress' do
|
||||
batch = @account.sis_batches.create
|
||||
api_call(:put, "/api/v1/accounts/#{@account.id}/sis_imports/#{batch.id}/restore_states",
|
||||
{controller: 'sis_imports_api', action: 'restore_states', format: 'json',
|
||||
account_id: @account.id.to_s, id: batch.id.to_s})
|
||||
json = api_call(:put, "/api/v1/accounts/#{@account.id}/sis_imports/#{batch.id}/restore_states",
|
||||
{controller: 'sis_imports_api', action: 'restore_states', format: 'json',
|
||||
account_id: @account.id.to_s, id: batch.id.to_s})
|
||||
run_jobs
|
||||
expect(batch.reload.workflow_state).to eq 'restored'
|
||||
|
||||
params = {controller: 'progress', action: 'show', id: json['id'].to_param, format: 'json'}
|
||||
api_call(:get, "/api/v1/progress/#{json['id']}", params, {}, {}, expected_status: 200)
|
||||
end
|
||||
|
||||
it 'should abort batch on abort' do
|
||||
|
|
Loading…
Reference in New Issue