Passed
Push — master ( b50e97...feedcb )
by Humberto
01:28 queued 14s
created

TestHello.setUpClass()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
"""Hello message tests."""
2
from pyof.v0x04.symmetric.hello import (
3
    Hello, HelloElemHeader, HelloElemType, ListOfHelloElements)
4
from tests.unit.test_struct import TestStruct
5
6
7
class TestHello(TestStruct):
8
    """Hello message tests (also those in :class:`.TestDump`)."""
9
10
    @classmethod
11
    def setUpClass(cls):
12
        """Configure raw file and its object in parent class (TestDump)."""
13
        super().setUpClass()
14
        super().set_raw_dump_file('v0x04', 'ofpt_hello')
15
        super().set_raw_dump_object(Hello, xid=62,
16
                                    elements=_new_list_of_elements())
17
        super().set_minimum_size(8)
18
19
20
def _new_list_of_elements():
21
    """Crate new ListOfHelloElements."""
22
    hello_elem = HelloElemHeader(HelloElemType.OFPHET_VERSIONBITMAP,
23
                                 length=8, content=b'\x00\x00\x00\x10')
24
    elements = ListOfHelloElements()
25
    elements.append(hello_elem)
26
    return elements
27