Skip to content

Commit

Permalink
fixed argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sabakram committed May 7, 2024
1 parent 55ded95 commit a4194c3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/vlan_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from click.testing import CliRunner

import config.main as config
import config.vlan as vlan

import show.main as show
from utilities_common.db import Db
Expand Down Expand Up @@ -693,31 +694,31 @@ def test_config_switchport_mode_with_mirror_destintion_port(self):
assert result.exit_code != 0
assert "Error: Ethernet44 is configured as mirror destination port" in result.output


@patch("config.validated_config_db_connector.validated_set_entry", mock.Mock(side_effect=JsonPatchConflict))
@patch("validated_config_db_connector.device_info.is_yang_config_validation_enabled", mock.Mock(return_value=True))
def test_config_vlan_add_member_yang_validation(self):

config.ADHOC_VALIDATION = False
vlan.ADHOC_VALIDATION = False
runner = CliRunner()
db = Db()
obj = {'db': db.cfgdb}
result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["add"],
["1000", "Ethernet1"], obj=obj)
print(result.exit_code)
assert result.exit_code != 0
assert "Error: Vlan1000 invalid or does not exist, or Ethernet1 invalid or does not exist" in result.output

@patch("validated_config_db_connector.device_info.is_yang_config_validation_enabled", mock.Mock(return_value=True))
@patch("config.validated_config_db_connector.ValidatedConfigDBConnector.validated_set_entry", mock.Mock(side_effect=ValueError))
@patch("config.validated_config_db_connector.ValidatedConfigDBConnector.validated_set_entry",
mock.Mock(side_effect=ValueError))
def test_config_vlan_del_member_yang_validation(self):
config.ADHOC_VALIDATION = False
vlan.ADHOC_VALIDATION = False
runner = CliRunner()
db = Db()
obj = {'db': db.cfgdb}
result = runner.invoke(config.config.commands["vlan"].commands["member"].commands["del"],
["1000", "Ethernet1"], obj=obj)
print(result.exit_code)
assert result.exit_code != 0
assert "Error: Vlan1000 invalid or does not exist, or Ethernet1 invalid or does not exist" in result.output

def test_config_vlan_add_portchannel_member_with_switchport_modes(self):
Expand Down

0 comments on commit a4194c3

Please sign in to comment.