| Total Complexity | 4 | 
| Total Lines | 31 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | """Test utils module."""  | 
            ||
| 2 | from unittest import TestCase  | 
            ||
| 3 | |||
| 4 | from napps.kytos.of_lldp.utils import get_cookie, int_dpid  | 
            ||
| 5 | |||
| 6 | |||
| 7 | class TestUtils(TestCase):  | 
            ||
| 8 | """Tests for the utils module."""  | 
            ||
| 9 | |||
| 10 | def test_int_dpid(self):  | 
            ||
| 11 | """Test int dpid."""  | 
            ||
| 12 | test_data = [  | 
            ||
| 13 | (  | 
            ||
| 14 | "21:00:10:00:00:00:00:02",  | 
            ||
| 15 | 0x2100100000000002,  | 
            ||
| 16 | ),  | 
            ||
| 17 | (  | 
            ||
| 18 | "00:00:00:00:00:00:00:07",  | 
            ||
| 19 | 0x0000000000000007,  | 
            ||
| 20 | ),  | 
            ||
| 21 | ]  | 
            ||
| 22 | for dpid, expected_dpid in test_data:  | 
            ||
| 23 | with self.subTest(dpid=dpid, expected_dpid=expected_dpid):  | 
            ||
| 24 | assert int_dpid(dpid) == expected_dpid  | 
            ||
| 25 | |||
| 26 | @staticmethod  | 
            ||
| 27 | def test_get_cookie():  | 
            ||
| 28 | """Test get_cookie."""  | 
            ||
| 29 | dpid = "00:00:00:00:00:00:00:01"  | 
            ||
| 30 | assert hex(get_cookie(dpid)) == hex(0xab00000000000001)  | 
            ||
| 31 |