Esempio n. 1
0
    def test_action_type(self):
        """Test with action_type."""
        request = N_ACTION()
        request.ActionTypeID = 2
        event = Event(None, evt.EVT_N_ACTION, {
            'request': request,
            'context': self.context.as_tuple
        })

        assert event.action_type == 2
Esempio n. 2
0
    def test_action_information(self):
        """Test Event.action_information."""
        request = N_ACTION()
        request.ActionInformation = self.bytestream
        event = Event(None, evt.EVT_N_ACTION, {
            'request': request,
            'context': self.context.as_tuple
        })

        assert event._hash is None
        assert event._decoded is None
        ds = event.action_information
        assert event._hash == hash(request.ActionInformation)
        assert isinstance(ds, Dataset)
        assert ds.PatientName == 'TEST^Test'

        ds.PatientID = '1234567'
        assert event.action_information.PatientID == '1234567'

        # Test hash mismatch
        event._hash = None
        assert 'PatientID' not in event.action_information
Esempio n. 3
0
    def test_action_information(self):
        """Test Event.action_information."""
        request = N_ACTION()
        request.ActionInformation = self.bytestream
        event = Event(
            None,
            evt.EVT_N_ACTION,
            {"request": request, "context": self.context.as_tuple},
        )

        assert event._hash is None
        assert event._decoded is None
        ds = event.action_information
        assert event._hash == hash(request.ActionInformation)
        assert isinstance(ds, Dataset)
        assert ds.PatientName == "TEST^Test"

        ds.PatientID = "1234567"
        assert event.action_information.PatientID == "1234567"

        # Test hash mismatch
        event._hash = None
        assert "PatientID" not in event.action_information