| Conditions | 3 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | """Module to test the utls.py file.""" |
||
| 12 | def test_compare_endpoint_trace(self): |
||
| 13 | """Test method compare_endpoint_trace""" |
||
| 14 | |||
| 15 | trace = {"dpid": "1234", "port": 2, "vlan": 123} |
||
| 16 | |||
| 17 | switch1 = MagicMock() |
||
| 18 | switch1.dpid = "1234" |
||
| 19 | switch2 = MagicMock() |
||
| 20 | switch2.dpid = "2345" |
||
| 21 | |||
| 22 | endpoint = MagicMock() |
||
| 23 | endpoint.port_number = 2 |
||
| 24 | vlan = 123 |
||
| 25 | |||
| 26 | for switch, expected in ((switch1, True), (switch2, False)): |
||
| 27 | with self.subTest(switch=switch, expected=expected): |
||
| 28 | endpoint.switch = switch |
||
| 29 | self.assertEqual( |
||
| 30 | compare_endpoint_trace(endpoint, vlan, trace), expected |
||
| 31 | ) |
||
| 32 |