On 03/08/2016 12:59 PM, Petr Vobornik wrote:
On 03/07/2016 04:29 PM, Pavel Vomacka wrote:


On 02/25/2016 03:08 PM, Lenka Doudova wrote:
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


Hi,

ACK, works well.

Pavel^3 Vomacka


NACK, don't use naked except, specify at least 'Exception'
  +        except:


Thanks, patch fixed according to Petr's review attached.

Lenka
From 9d7ffe59b752675b666c7c16158c7caa0b7ef09f 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..5a3c1e46d3b9239b19ee7822faa1976a8fbedfe0 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 Exception:
+            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