Ejemplo n.º 1
0
class TestIPBusControlPacket:
    @pytest.mark.parametrize("data", [
        TESTPACKETS['big-endian'][PacketHeaderStruct.sizeof():i]
        for i in range(PacketHeaderStruct.sizeof(),
                       ControlHeaderStruct.sizeof() + 4)
    ])
    def test_bad_control_packet_header(self, data):
        """ This test just runs over a technically valid, yet incomplete control transaction header
        """
        with pytest.raises(StreamError) as e:
            ControlHeaderStruct.parse(data)
Ejemplo n.º 2
0
class TestIPBusPacketHeader:
    @pytest.mark.parametrize("data", [
        TESTPACKETS['big-endian'][:i]
        for i in range(PacketHeaderStruct.sizeof())
    ])
    def test_bad_ipbus_packet_header(self, data):
        """ This test just runs over a technically valid, yet incomplete ipbus packet header
        """
        with pytest.raises(StreamError) as e:
            PacketHeaderStruct.parse(data)

    def test_bad_ipbus_version(self):
        with pytest.raises(ValidationError) as e:
            PacketHeaderStruct.parse(TESTPACKETS['wrong protocol version'])
Ejemplo n.º 3
0
 def test_bad_ipbus_version(self):
     with pytest.raises(ValidationError) as e:
         PacketHeaderStruct.parse(TESTPACKETS['wrong protocol version'])
Ejemplo n.º 4
0
 def test_bad_ipbus_packet_header(self, data):
     """ This test just runs over a technically valid, yet incomplete ipbus packet header
     """
     with pytest.raises(FieldError) as e:
         PacketHeaderStruct.parse(data)
Ejemplo n.º 5
0
 def test_bad_ipbus_version(self):
     with pytest.raises(ValidationError) as e:
         PacketHeaderStruct.parse(TESTPACKETS['wrong protocol version'])
Ejemplo n.º 6
0
 def test_bad_ipbus_packet_header(self, data):
     """ This test just runs over a technically valid, yet incomplete ipbus packet header
     """
     with pytest.raises(StreamError) as e:
         PacketHeaderStruct.parse(data)