| Conditions | 3 |
| Total Lines | 24 |
| Code Lines | 18 |
| 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 = { |
||
| 16 | "dpid": "1234", |
||
| 17 | "port": 2, |
||
| 18 | "vlan": 123 |
||
| 19 | } |
||
| 20 | |||
| 21 | switch1 = MagicMock() |
||
| 22 | switch1.dpid = "1234" |
||
| 23 | switch2 = MagicMock() |
||
| 24 | switch2.dpid = "2345" |
||
| 25 | |||
| 26 | endpoint = MagicMock() |
||
| 27 | endpoint.port_number = 2 |
||
| 28 | vlan = 123 |
||
| 29 | |||
| 30 | for switch, expected in ((switch1, True), (switch2, False)): |
||
| 31 | with self.subTest(switch=switch, expected=expected): |
||
| 32 | endpoint.switch = switch |
||
| 33 | self.assertEqual( |
||
| 34 | compare_endpoint_trace(endpoint, vlan, trace), |
||
| 35 | expected |
||
| 36 | ) |
||
| 37 |