Debian Codegraph @

ansible_collections/community/general/tests/unit/plugins/lookup/conftest.py

raw
1 # Copyright (c) 2020 Ansible Project
2 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 from __future__ import annotations
6
7 import pytest
8
9 from ansible_collections.community.general.plugins.lookup.onepassword import OnePass
10
11
12 @pytest.fixture
13 def fake_op(mocker):
14 def _fake_op(version):
15 mocker.patch(
16 "ansible_collections.community.general.plugins.lookup.onepassword.OnePassCLIBase.get_current_version",
17 return_value=version,
18 )
19 op = OnePass()
20 op._config._config_file_path = "/home/jin/.op/config"
21 mocker.patch.object(op._cli, "_run")
22
23 return op
24
25 return _fake_op
26
27
28 @pytest.fixture
29 def opv1(fake_op):
30 return fake_op("1.17.2")
31
32
33 @pytest.fixture
34 def opv2(fake_op):
35 return fake_op("2.27.2")