Skip to content

Commit

Permalink
Test for the nonexistance of other methods too
Browse files Browse the repository at this point in the history
  • Loading branch information
Qalthos committed Jul 25, 2023
1 parent 297e92a commit 1f281fd
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/unit/plugins/cliconf/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,15 @@ def test_get_capabilities(cliconf):
)


def test_get_config(cliconf):
with pytest.raises(AnsibleConnectionFailure):
cliconf.get_config()


def test_edit_config(cliconf):
with pytest.raises(AnsibleConnectionFailure):
cliconf.edit_config()
@pytest.mark.parametrize("method", ["get_config", "edit_config", "commit", "discard_changes"])
def test_unsupported_method(cliconf, method):
cliconf._play_context = MagicMock()
cliconf._play_context.network_os = "default"

with pytest.raises(
AnsibleConnectionFailure, match=f"{method} is not supported by network_os default"
):
getattr(cliconf, method)()


def test_get(cliconf):
Expand Down

0 comments on commit 1f281fd

Please sign in to comment.