コード例 #1
0
 def test_scp_raises(self):
     """Test that ServiceClass.SCP raises exception"""
     service = ServiceClass(None)
     msg = (r"No service class has been implemented for the "
            r"SOP Class UID '1.2.3'")
     with pytest.raises(NotImplementedError, match=msg):
         service.SCP(None, build_context('1.2.3'))
コード例 #2
0
 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
コード例 #3
0
 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()
コード例 #4
0
 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