Passed
Push — master ( 4940e6...c07b6a )
by Humberto
02:16
created

tests.unit.v0x01.test_symmetric.test_vendor_header   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestVendorHeader.test_unpack() 0 7 1
A TestVendorHeader.setUpClass() 0 3 1
1
"""Testing VendorHeader message."""
2
from pyof.v0x01.symmetric.vendor_header import VendorHeader
3
from tests.unit.test_struct import TestStruct
4
5
6
class TestVendorHeader(TestStruct):
7
    """Vendor message tests (also those in :class:`.TestDump`)."""
8
9
    @classmethod
10
    def setUpClass(cls):
11
        super().set_minimum_size(8)
12
13
    def test_unpack(self):
14
        """Test unpack VendorHeader message."""
15
        message = b'My custom vendor extra data.'
16
        vendor_header = VendorHeader(xid=4, vendor=128,
17
                                     data=message)
18
        data = b'\x01\x04\x00(\x00\x00\x00\x04\x00\x00\x00\x80' + message
19
        self._test_unpack(vendor_header, bytes2unpack=data)
20