|
@@ 689-702 (lines=14) @@
|
| 686 |
|
assert intf.id not in self.napp.liveness_manager.interfaces |
| 687 |
|
assert self.napp.liveness_controller.delete_interfaces.call_count == 1 |
| 688 |
|
|
| 689 |
|
def test_on_switch_deleted_not_loaded(self): |
| 690 |
|
"""Test on switch deleted not loaded""" |
| 691 |
|
intf_id = "00:00:00:00:00:00:00:01" |
| 692 |
|
switch = MagicMock() |
| 693 |
|
intf = MagicMock() |
| 694 |
|
intf.id = intf_id |
| 695 |
|
switch.interfaces = {intf_id: intf} |
| 696 |
|
self.napp.liveness_manager.interfaces["some_id"] = intf |
| 697 |
|
content = {"switch": switch} |
| 698 |
|
event = KytosEvent(content=content) |
| 699 |
|
self.napp.on_switch_deleted(event) |
| 700 |
|
assert "some_id" in self.napp.liveness_manager.interfaces |
| 701 |
|
assert intf.id not in self.napp.liveness_manager.interfaces |
| 702 |
|
assert not self.napp.liveness_controller.delete_interfaces.call_count |
| 703 |
|
|
|
@@ 675-687 (lines=13) @@
|
| 672 |
|
assert intf.id not in self.napp.liveness_manager.interfaces |
| 673 |
|
assert not self.napp.liveness_controller.delete_interface.call_count |
| 674 |
|
|
| 675 |
|
def test_on_switch_deleted(self): |
| 676 |
|
"""Test on switch deleted""" |
| 677 |
|
intf_id = "00:00:00:00:00:00:00:01" |
| 678 |
|
switch = MagicMock() |
| 679 |
|
intf = MagicMock() |
| 680 |
|
intf.id = intf_id |
| 681 |
|
switch.interfaces = {intf_id: intf} |
| 682 |
|
self.napp.liveness_manager.interfaces[intf_id] = intf |
| 683 |
|
content = {"switch": switch} |
| 684 |
|
event = KytosEvent(content=content) |
| 685 |
|
self.napp.on_switch_deleted(event) |
| 686 |
|
assert intf.id not in self.napp.liveness_manager.interfaces |
| 687 |
|
assert self.napp.liveness_controller.delete_interfaces.call_count == 1 |
| 688 |
|
|
| 689 |
|
def test_on_switch_deleted_not_loaded(self): |
| 690 |
|
"""Test on switch deleted not loaded""" |