-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e0ea2a
commit ba7f66f
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Copyright: (c) 2018, Frederic Bor <[email protected]> | ||
# Copyright: (c) 2023, Orion Poplawski <[email protected]> | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
|
@@ -55,6 +56,14 @@ def do_alias_deletion_test(self, alias, command=None): | |
self.assert_has_xml_tag('aliases', dict(name=alias['name'], type=alias['type']), absent=True) | ||
self.assertEqual(result['commands'], [command]) | ||
|
||
def do_alias_deletion_referenced_test(self, alias, command=None): | ||
""" test deletion of a referenced alias """ | ||
set_module_args(self.args_from_var(alias, 'absent')) | ||
result = self.execute_module(changed=False) | ||
|
||
self.assert_has_xml_tag('aliases', dict(name=alias['name'], type=alias['type']), absent=True) | ||
self.assertEqual(result['commands'], [command]) | ||
|
||
def do_alias_update_noop_test(self, alias): | ||
""" test not updating an alias """ | ||
set_module_args(self.args_from_var(alias)) | ||
|
@@ -94,6 +103,11 @@ def test_host_delete(self): | |
command = "delete alias 'ad_poc1'" | ||
self.do_alias_deletion_test(alias, command=command) | ||
|
||
def test_host_delete_referenced(self): | ||
""" test deletion of a referenced host alias """ | ||
alias = dict(name='srv_admin', state='absent') | ||
self.do_module_test(alias, failed=True, msg="Alias 'srv_admin' is referenced by rule") | ||
|
||
def test_host_update_noop(self): | ||
""" test not updating an host alias """ | ||
alias = dict(name='ad_poc1', address='192.168.1.3', descr='', type='host', detail='') | ||
|