mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 23:21:22 -07:00
Update test_proxmox_backup_schedule.py
This commit is contained in:
parent
2b58f5518b
commit
8c3ff95648
1 changed files with 26 additions and 24 deletions
|
@ -132,7 +132,7 @@ RESOURCE_LIST = [
|
||||||
]
|
]
|
||||||
|
|
||||||
BACKUP_JOBS = [
|
BACKUP_JOBS = [
|
||||||
{
|
{
|
||||||
"type": "vzdump",
|
"type": "vzdump",
|
||||||
"id": "backup-001",
|
"id": "backup-001",
|
||||||
"storage": "local",
|
"storage": "local",
|
||||||
|
@ -200,33 +200,35 @@ class TestProxmoxBackupScheduleModule(ModuleTestCase):
|
||||||
assert result["msg"] == "missing required arguments: api_host, api_user, state"
|
assert result["msg"] == "missing required arguments: api_host, api_user, state"
|
||||||
|
|
||||||
def test_update_vmid_in_backup(self):
|
def test_update_vmid_in_backup(self):
|
||||||
with pytest.raises(AnsibleExitJson) as exc_info:
|
with patch('builtins.input', return_value='mocked input'):
|
||||||
set_module_args({
|
with pytest.raises(AnsibleExitJson) as exc_info:
|
||||||
'api_host': 'proxmoxhost',
|
set_module_args({
|
||||||
'api_user': 'root@pam',
|
'api_host': 'proxmoxhost',
|
||||||
'api_password': 'supersecret',
|
'api_user': 'root@pam',
|
||||||
'vm_name': 'test05',
|
'api_password': 'supersecret',
|
||||||
'backup_id': 'backup-001',
|
'vm_name': 'test05',
|
||||||
'state': 'present'
|
'backup_id': 'backup-001',
|
||||||
})
|
'state': 'present'
|
||||||
self.module.main()
|
})
|
||||||
|
self.module.main()
|
||||||
|
|
||||||
result = exc_info.value.args[0]
|
result = exc_info.value.args[0]
|
||||||
assert result['changed'] is True
|
assert result['changed'] is True
|
||||||
|
|
||||||
def test_delete_vmid_from_backup(self):
|
def test_delete_vmid_from_backup(self):
|
||||||
with pytest.raises(AnsibleExitJson) as exc_info:
|
with patch('builtins.input', return_value='mocked input'):
|
||||||
set_module_args({
|
with pytest.raises(AnsibleExitJson) as exc_info:
|
||||||
'api_host': 'proxmoxhost',
|
set_module_args({
|
||||||
'api_user': 'root@pam',
|
'api_host': 'proxmoxhost',
|
||||||
'api_password': 'supersecret',
|
'api_user': 'root@pam',
|
||||||
'vm_id': '101',
|
'api_password': 'supersecret',
|
||||||
'state': 'absent'
|
'vm_id': '101',
|
||||||
})
|
'state': 'absent'
|
||||||
self.module.main()
|
})
|
||||||
|
self.module.main()
|
||||||
|
|
||||||
result = exc_info.value.args[0]
|
result = exc_info.value.args[0]
|
||||||
assert result['changed'] is True
|
assert result['changed'] is True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue