Hi,

here's a patch for webUI tests that provides test for creating user without private group.
Related to ticket https://fedorahosted.org/freeipa/ticket/4986

Since the option to specify GID when creating a user is not available https://fedorahosted.org/freeipa/ticket/5505 the test creates a new posix group, makes it a default user group instead of 'ipausers' and then attemps to create the user without private group. Returning default user group value to 'ipausers' is provided even for cases when the test fails so it would not block other tests from performing properly.

Lenka
From b9d0d7d5887e339de24d9878b733b45a0618bb9b Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Thu, 25 Feb 2016 15:00:49 +0100
Subject: [PATCH] WebUI: Test creating user without private group

Test for option to create a user without private group in web UI.

Covers ticket https://fedorahosted.org/freeipa/ticket/4986
---
 ipatests/test_webui/data_user.py | 11 +++++++++++
 ipatests/test_webui/test_user.py | 31 +++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/ipatests/test_webui/data_user.py b/ipatests/test_webui/data_user.py
index 79a53898035a2723c1e79c459ba4aef3ffa67723..50945c1e95634654ca3a8f0dabd09e6d7e2d0452 100644
--- a/ipatests/test_webui/data_user.py
+++ b/ipatests/test_webui/data_user.py
@@ -63,3 +63,14 @@ DATA2 = {
         ('textbox', 'sn', 'OtherSurname2'),
     ],
 }
+
+PKEY3 = 'itest-user3'
+DATA3 = {
+    'pkey': PKEY3,
+    'add': [
+        ('textbox', 'uid', PKEY3),
+        ('textbox', 'givenname', 'Name3'),
+        ('textbox', 'sn', 'Surname3'),
+        ('checkbox', 'noprivate', None),
+    ]
+}
diff --git a/ipatests/test_webui/test_user.py b/ipatests/test_webui/test_user.py
index b216125b226230ab268de3f86ec7ac6f785c6e16..713df5dc929c0b4e1761cab5c1a1a1675cc00669 100644
--- a/ipatests/test_webui/test_user.py
+++ b/ipatests/test_webui/test_user.py
@@ -222,6 +222,37 @@ class test_user(UI_driver):
         self.delete(user.ENTITY, [user.DATA])
         self.delete(group.ENTITY, [group.DATA])
 
+    @screenshot
+    def test_noprivate(self):
+        """
+        User without private group
+        """
+        self.init_app()
+        self.add_record(group.ENTITY, group.DATA2)
+
+        try:
+            self.set_ipadefaultprimarygroup(group.PKEY2)
+            self.add_record(user.ENTITY, user.DATA3)
+            self.delete(user.ENTITY, [user.DATA3])
+        except:
+            self.dialog_button_click('cancel')  # exit error dialog
+            self.dialog_button_click('cancel')  # exit add user dialog
+            raise
+        finally:
+            self.set_ipadefaultprimarygroup('ipausers')
+            self.delete(group.ENTITY, [group.DATA2])
+
+    def set_ipadefaultprimarygroup(self, group):
+        """
+        Set ipa config "Default users group" field
+        """
+        self.navigate_to_entity('config')
+        self.mod_record('config', {
+            'mod': [
+                ('combobox', 'ipadefaultprimarygroup', group),
+            ]
+        })
+
     def set_ipapwdexpadvnotify(self, days):
         """
         Set ipa config "Password Expiration Notification (days)" field
-- 
2.5.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to