Skip to content

Commit 4e6736d

Browse files
Make test_existing_sop_instance_uid better match implementation
1 parent 4101945 commit 4e6736d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/services/dicom/test_c_store.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from services.dicom import FAILURE, SUCCESS
99
from services.dicom.c_store import CStore
1010
from services.dicom.image_compressor import ImageCompressor
11+
from services.storage import InstanceExistsError
1112

1213

1314
class TestCStore:
@@ -47,10 +48,11 @@ def test_no_patient_id_fails(self, mock_storage, mock_event):
4748
assert subject.call(mock_event) == FAILURE
4849

4950
def test_existing_sop_instance_uid(self, mock_storage, mock_event):
50-
mock_storage.instance_exists.return_value = True
51+
mock_storage.store_instance.side_effect = InstanceExistsError("1.2.3.4.5.6") # gitleaks:allow
5152
subject = CStore(mock_storage)
5253

5354
assert subject.call(mock_event) == SUCCESS
55+
mock_storage.store_instance.assert_called_once()
5456

5557
def test_valid_event_is_stored(self, mock_storage, mock_event):
5658
mock_storage.instance_exists.return_value = False

0 commit comments

Comments
 (0)