Skip to content

Commit

Permalink
Add parametrization
Browse files Browse the repository at this point in the history
  • Loading branch information
Myron Sosyak committed Jul 13, 2022
1 parent cb88ec8 commit f266dfb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/portchannel_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pytest
import traceback

from click.testing import CliRunner
Expand Down Expand Up @@ -61,24 +62,26 @@ def test_delete_non_existing_portchannel(self):
assert result.exit_code != 0
assert "Error: PortChannel0005 is not present." in result.output

def test_add_portchannel_with_fast_rate(self):
@pytest.mark.parametrize("fast_rate", ["False", "True", "false", "true"])
def test_add_portchannel_with_fast_rate(self, fast_rate):
runner = CliRunner()
db = Db()
obj = {'db':db.cfgdb}

# add a portchannel with fats rate
result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0005", "--fast-rate", "True"], obj=obj)
result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0005", "--fast-rate", fast_rate], obj=obj)
print(result.exit_code)
print(result.output)
assert result.exit_code == 0

@pytest.mark.parametrize("fast_rate", ["Fls", "tru"])
def test_add_portchannel_with_invalid_fast_rate(self):
runner = CliRunner()
db = Db()
obj = {'db':db.cfgdb}

# add a portchannel with invalid fats rate
result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0005", "--fast-rate", "Tru"], obj=obj)
result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0005", "--fast-rate", fast_rate], obj=obj)
print(result.exit_code)
print(result.output)
assert result.exit_code != 0
Expand Down

0 comments on commit f266dfb

Please sign in to comment.