diff --git a/tests/portchannel_test.py b/tests/portchannel_test.py index dcdc000584..f1aecd88ac 100644 --- a/tests/portchannel_test.py +++ b/tests/portchannel_test.py @@ -162,21 +162,33 @@ def test_delete_portchannel_which_is_member_of_a_vlan(self): db = Db() obj = {'db':db.cfgdb} + # add a portchannel + result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0005"], obj=obj) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + # add portchannel to a vlan - result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["add"], ["2000", "PortChannel0001"]) + result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["add"], ["2000", "PortChannel0005"]) print(result.exit_code) print(result.output) assert result.exit_code == 0 # try to delete the portchannel - result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0001"], obj=obj) + result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0005"], obj=obj) print(result.exit_code) print(result.output) assert result.exit_code != 0 - assert "PortChannel0001 has vlan Vlan2000 configured, remove vlan membership to proceed" in result.output + assert "PortChannel0005 has vlan Vlan2000 configured, remove vlan membership to proceed" in result.output # remove portchannel from vlan - result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["del"], ["2000", "PortChannel0001"]) + result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["del"], ["2000", "PortChannel0005"]) + print(result.exit_code) + print(result.output) + assert result.exit_code == 0 + + # delete the portchannel + result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0005"], obj=obj) print(result.exit_code) print(result.output) assert result.exit_code == 0