Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
fixed file size bug on work item restore requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kelly-croswell committed Sep 19, 2019
1 parent 331838e commit e957237
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/work_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def self.create_restore_request_for_file(generic_file, requested_by)
restore_item.node = nil
restore_item.pid = 0
restore_item.needs_admin_review = false
restore_item.size = item.size
restore_item.size = generic_file.size
restore_item.stage_started_at = nil
restore_item.queued_at = nil
restore_item.save!
Expand Down
5 changes: 5 additions & 0 deletions spec/models/work_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ def setup_item(subject)
before do
test_obj = FactoryBot.create(:intellectual_object, identifier: 'abc/123')
FactoryBot.create(:generic_file, identifier: 'abc/123/doc.pdf', intellectual_object_id: test_obj.id)
FactoryBot.create(:generic_file, identifier: 'abc/123/txt.pdf', intellectual_object_id: test_obj.id)
FactoryBot.create(:generic_file, identifier: 'abc/123/ppt.pdf', intellectual_object_id: test_obj.id)
3.times do
ingest_date = ingest_date + 1.days
FactoryBot.create(:work_item, object_identifier: 'abc/123',
Expand All @@ -224,6 +226,7 @@ def setup_item(subject)
end

it 'should create a restoration request when asked' do
test_obj = IntellectualObject.where(identifier: 'abc/123').first
wi = WorkItem.create_restore_request('abc/123', '[email protected]')
wi.work_item_state = FactoryBot.build(:work_item_state, work_item: wi)
wi.action.should == Pharos::Application::PHAROS_ACTIONS['restore']
Expand All @@ -238,6 +241,7 @@ def setup_item(subject)
wi.pid.should == 0
wi.needs_admin_review.should == false
wi.id.should_not be_nil
wi.size.should == test_obj.gf_size
end

it 'should create a file restoration request when asked' do
Expand All @@ -257,6 +261,7 @@ def setup_item(subject)
wi.needs_admin_review.should == false
wi.id.should_not be_nil
wi.generic_file_identifier.should == test_file.identifier
wi.size.should == test_file.size
end

it 'should create a glacier restoration request when asked' do
Expand Down

0 comments on commit e957237

Please sign in to comment.