summaryrefslogtreecommitdiffstats
path: root/tests/test_xmlrpc/test_hbac_plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_xmlrpc/test_hbac_plugin.py')
-rw-r--r--tests/test_xmlrpc/test_hbac_plugin.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_hbac_plugin.py b/tests/test_xmlrpc/test_hbac_plugin.py
index 58265dc07..bd50a585e 100644
--- a/tests/test_xmlrpc/test_hbac_plugin.py
+++ b/tests/test_xmlrpc/test_hbac_plugin.py
@@ -50,6 +50,8 @@ class test_hbac(XMLRPC_test):
test_service = u'sshd'
test_host_external = u'notfound.example.com'
+ test_invalid_sourcehost = u'inv+alid#srchost.nonexist.com'
+
def test_0_hbacrule_add(self):
"""
Test adding a new HBAC rule using `xmlrpc.hbacrule_add`.
@@ -284,6 +286,17 @@ class test_hbac(XMLRPC_test):
assert_attr_equal(entry, 'sourcehost_host', self.test_host)
assert_attr_equal(entry, 'sourcehost_hostgroup', self.test_hostgroup)
+ def test_a_hbacrule_add_invalid_sourcehost(self):
+ """
+ Test adding invalid source host to HBAC rule using `xmlrpc.hbacrule_add_host`.
+ """
+ try:
+ api.Command['hbacrule_add_sourcehost'](
+ self.rule_name, host=self.test_invalid_sourcehost, hostgroup=self.test_hostgroup
+ )
+ except errors.ValidationError:
+ pass
+
def test_a_hbacrule_add_service(self):
"""
Test adding service to HBAC rule using `xmlrpc.hbacrule_add_service`.