Debian Codegraph @

ansible_collections/community/general/tests/unit/plugins/modules/test_terraform.py

raw
1 # Copyright (c) 2019, Ansible Project
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 from __future__ import annotations
5
6 import json
7
8 import pytest
9 from ansible_collections.community.internal_test_tools.tests.unit.plugins.modules.utils import set_module_args
10
11 from ansible_collections.community.general.plugins.modules import terraform
12
13
14 def test_terraform_without_argument(capfd):
15 with set_module_args({}):
16 with pytest.raises(SystemExit):
17 terraform.main()
18
19 out, err = capfd.readouterr()
20 assert not err
21 assert json.loads(out)["failed"]
22 assert "project_path" in json.loads(out)["msg"]