Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikek committed Dec 1, 2024
1 parent 2c81826 commit 165549a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ESSArch_Core/ip/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_no_writeable_target(self, mock_preserve):
@TaskRunner()
@mock.patch.object(InformationPackage, 'preserve')
def test_success(self, mock_preserve):
mock_preserve.return_value = '123'
mock_preserve.return_value = ('123', 'medium_id_4', 5, 6, 7)
storage_method = StorageMethod.objects.create()
storage_target = StorageTarget.objects.create()
StorageMethodTargetRelation.objects.create(
Expand Down
10 changes: 6 additions & 4 deletions ESSArch_Core/storage/tape.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,12 @@ def robot_inventory(robot):
slot_id = dt_el[7]
medium_id = dt_el[10][:6]
backend.identify_tape(medium_id)

StorageMedium.objects.filter(
tape_slot__robot=robot, tape_slot__slot_id=slot_id, medium_id=medium_id
).update(tape_drive=drive)
slot, created = TapeSlot.objects.update_or_create(
robot=robot, slot_id=slot_id, defaults={'medium_id': medium_id, 'status': 20}
)
StorageMedium.objects.filter(medium_id=medium_id).update(
tape_slot=slot, tape_drive=drive, last_changed_local=timezone.now(),
)
else:
StorageMedium.objects.filter(tape_drive=drive).update(
tape_drive=None, last_changed_local=timezone.now(),
Expand Down

0 comments on commit 165549a

Please sign in to comment.