def test_is_cancelled_match(self): """Test is_cancelled with matching C-CANCEL.""" assoc = DummyAssoc() cancel = C_CANCEL() cancel.MessageIDBeingRespondedTo = 5 assoc.dimse.cancel_req[4] = C_GET() assoc.dimse.cancel_req[3] = cancel service = ServiceClass(assoc) assert service.is_cancelled(1) is False assert service.is_cancelled(2) is False assert service.is_cancelled(3) is True service = ServiceClass(assoc) assert service.is_cancelled(1) is False assert service.is_cancelled(2) is False assert service.is_cancelled(3) is False assert cancel not in assoc.dimse.cancel_req.values()
def test_is_cancelled_no_match(self): """Test is_cancelled with no matching C-CANCEL.""" assoc = DummyAssoc() cancel = C_CANCEL() cancel.MessageIDBeingRespondedTo = 5 assoc.dimse.cancel_req[5] = cancel assoc.dimse.cancel_req[3] = cancel service = ServiceClass(assoc) assert service.is_cancelled(1) is False assert service.is_cancelled(2) is False
def test_is_cancelled_no_msg(self): """Test is_cancelled with no DIMSE messages in the queue.""" assoc = DummyAssoc() service = ServiceClass(assoc) assert service.is_cancelled(1) is False assert service.is_cancelled(2) is False