Skip to content

Commit

Permalink
[PR #6041/a7e8e95b backport][stable-6] onepassword lookup: fix unit t…
Browse files Browse the repository at this point in the history
…ests (#6042)

onepassword lookup: fix unit tests (#6041)

Fix unit tests.

(cherry picked from commit a7e8e95)

Co-authored-by: Felix Fontein <[email protected]>
  • Loading branch information
patchback[bot] and felixfontein authored Feb 22, 2023
1 parent 1fc53ee commit 86b19a2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/unit/plugins/lookup/onepassword/test_onepassword_cli_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@


@pytest.mark.parametrize(
("args", "out", "expected_call_args", "expected"),
("args", "out", "expected_call_args", "expected_call_kwargs", "expected"),
(
([], "list of accounts", ["account", "get"], True,),
(["acme"], "list of accounts", ["account", "get", "--account", "acme.1password.com"], True,),
([], "", ["account", "list"], False,),
([], "list of accounts", ["account", "get"], {"ignore_errors": True}, True,),
(["acme"], "list of accounts", ["account", "get", "--account", "acme.1password.com"], {"ignore_errors": True}, True,),
([], "", ["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, ""])
op_cli = OnePassCLIv2(*args)
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


Expand Down

0 comments on commit 86b19a2

Please sign in to comment.