URL: https://github.com/freeipa/freeipa/pull/3566
Author: miskopo
 Title: #3566: Add test for PG2018 - hostname length limit enforced to 64
Action: opened

PR body:
"""
Implemented test for https://pagure.io/freeipa/issue/2018 regarding
hostname length limit enforcment.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/3566/head:pr3566
git checkout pr3566
From 3b70a0b30b2c4ed3294713c3c855e56bdc9557e0 Mon Sep 17 00:00:00 2001
From: Michal Polovka <mpolo...@redhat.com>
Date: Tue, 20 Aug 2019 09:13:05 +0200
Subject: [PATCH] Add test for PG2018 - hostname length limit enforced to 64

Implemented test for https://pagure.io/freeipa/issue/2018 regarding
hostname length limit enforcment.
---
 ipatests/test_xmlrpc/test_host_plugin.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/ipatests/test_xmlrpc/test_host_plugin.py b/ipatests/test_xmlrpc/test_host_plugin.py
index 1bcc90b0c4..621ce51f4c 100644
--- a/ipatests/test_xmlrpc/test_host_plugin.py
+++ b/ipatests/test_xmlrpc/test_host_plugin.py
@@ -337,6 +337,20 @@ def test_add_host_with_null_password(self, host):
         host.track_create()
         host.check_create(result)
 
+    def test_try_illegal_hostname_length(self, host):
+        host.ensure_exists()
+        max_valid_len_hostname = 63 * "x"
+        illegal_len_hostname = 64 * "x"
+        command = host.make_update_command(
+            updates=dict(name=u'%s' % max_valid_len_hostname))
+        command()
+
+        command = host.make_update_command(
+            updates=dict(name=u'%s' % illegal_len_hostname))
+        with raises_exact(errors.ValidationError(
+                name='name', error=u'hostname too long')):
+            command()
+
 
 @pytest.mark.tier1
 class TestMultipleMatches(XMLRPC_test):
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to