add mock input in test_proxmox_backup_schedule.py

This commit is contained in:
raoufnezhad 2025-03-30 13:12:49 +03:30 committed by GitHub
parent 06f469e38a
commit 1b22c92ae8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -189,6 +189,7 @@ class TestProxmoxBackupScheduleModule(ModuleTestCase):
assert result["msg"] == "missing required arguments: api_host, api_user, state"
def test_update_vmid_in_backup(self):
with patch('builtins.input', return_value='mocked input'):
with pytest.raises(AnsibleExitJson) as exc_info:
set_module_args({
'api_host': 'proxmoxhost',
@ -199,10 +200,12 @@ class TestProxmoxBackupScheduleModule(ModuleTestCase):
'state': 'present'
})
self.module.main()
result = exc_info.value.args[0]
assert result['changed'] is True
def test_delete_vmid_from_backup(self):
with patch('builtins.input', return_value='mocked input'):
with pytest.raises(AnsibleExitJson) as exc_info:
set_module_args({
'api_host': 'proxmoxhost',
@ -212,6 +215,7 @@ class TestProxmoxBackupScheduleModule(ModuleTestCase):
'state': 'absent'
})
self.module.main()
result = exc_info.value.args[0]
assert result['changed'] is True