Test Failed
Pull Request — master (#404)
by
unknown
01:18
created

TestHeader.test_random_xid()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
1
"""Testing Header structure."""
2
import unittest
3
4
from pyof.foundation.exceptions import PackException
5
from pyof.v0x01.common.header import Header, Type
6
from tests.test_struct import TestStructDump
7
8
9
class TestHeader(TestStructDump):
10
    """Test the message Header."""
11
12
    dump = b'\x01\x00\x00\x08\x00\x00\x00\x01'
13
    obj = Header(message_type=Type.OFPT_HELLO,
14
                 xid=1,
15
                 length=8)
16
17
    @unittest.expectedFailure
18
    def test_pack_empty(self):
19
        """[Common/Header] - packing empty header."""
20
        self.assertRaises(PackException,
21
                          Header().pack())
22
23
    # @patch('pyof.v0x01.common.header.randint')
24
    # def test_random_xid(self, m):
25
    #     """Each Header instantiations without xid should call randint."""
26
    #     Header(), Header()  # noqa
27
    #     self.assertEqual(m.call_count, 2)
28