mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 11:10:21 -07:00
Unit tests: make set_module_args() a context manager, and remove copies of it in some tests (#9838)
Make set_module_args() a context manager, and remove copies of set_module_args(). Prepares for Data Tagging.
This commit is contained in:
parent
402f725424
commit
a1781d09dd
84 changed files with 4043 additions and 4302 deletions
|
@ -48,7 +48,7 @@ class TestProxmoxTemplateModule(ModuleTestCase):
|
|||
def test_module_fail_when_toolbelt_not_installed_and_file_size_is_big(self, mock_stat):
|
||||
self.module.HAS_REQUESTS_TOOLBELT = False
|
||||
mock_stat.return_value.st_size = 268435460
|
||||
set_module_args(
|
||||
with set_module_args(
|
||||
{
|
||||
"api_host": "host",
|
||||
"api_user": "user",
|
||||
|
@ -57,9 +57,9 @@ class TestProxmoxTemplateModule(ModuleTestCase):
|
|||
"src": "/tmp/mock.iso",
|
||||
"content_type": "iso"
|
||||
}
|
||||
)
|
||||
with pytest.raises(AnsibleFailJson) as exc_info:
|
||||
self.module.main()
|
||||
):
|
||||
with pytest.raises(AnsibleFailJson) as exc_info:
|
||||
self.module.main()
|
||||
|
||||
result = exc_info.value.args[0]
|
||||
assert result["failed"] is True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue