mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #6041/a7e8e95b backport][stable-6] onepassword lookup: fix unit tests (#6042)
onepassword lookup: fix unit tests (#6041)
Fix unit tests.
(cherry picked from commit a7e8e95b50
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
1fc53eea22
commit
86b19a2bf4
1 changed files with 6 additions and 6 deletions
|
@ -12,19 +12,19 @@ from ansible_collections.community.general.plugins.lookup.onepassword import One
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("args", "out", "expected_call_args", "expected"),
|
("args", "out", "expected_call_args", "expected_call_kwargs", "expected"),
|
||||||
(
|
(
|
||||||
([], "list of accounts", ["account", "get"], True,),
|
([], "list of accounts", ["account", "get"], {"ignore_errors": True}, True,),
|
||||||
(["acme"], "list of accounts", ["account", "get", "--account", "acme.1password.com"], True,),
|
(["acme"], "list of accounts", ["account", "get", "--account", "acme.1password.com"], {"ignore_errors": True}, True,),
|
||||||
([], "", ["account", "list"], False,),
|
([], "", ["account", "list"], {}, False,),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
def test_assert_logged_in(mocker, args, out, expected_call_args, expected):
|
def test_assert_logged_in(mocker, args, out, expected_call_args, expected_call_kwargs, expected):
|
||||||
mocker.patch.object(OnePassCLIv2, "_run", return_value=[0, out, ""])
|
mocker.patch.object(OnePassCLIv2, "_run", return_value=[0, out, ""])
|
||||||
op_cli = OnePassCLIv2(*args)
|
op_cli = OnePassCLIv2(*args)
|
||||||
result = op_cli.assert_logged_in()
|
result = op_cli.assert_logged_in()
|
||||||
|
|
||||||
op_cli._run.assert_called_with(expected_call_args)
|
op_cli._run.assert_called_with(expected_call_args, **expected_call_kwargs)
|
||||||
assert result == expected
|
assert result == expected
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue