summaryrefslogtreecommitdiffstats
path: root/ipatests/test_webui
diff options
context:
space:
mode:
authorLenka Doudova <ldoudova@redhat.com>2016-02-25 15:00:49 +0100
committerMartin Basti <mbasti@redhat.com>2016-04-15 10:17:20 +0200
commit6468a398504d8e4aae94488047f2dafe5b895e1d (patch)
tree47eeb3f5b01e27c5b588dc10f1e6df8fe632a4ec /ipatests/test_webui
parent70fd78928cb874006f218ae4e7aca00e0babf99a (diff)
downloadfreeipa-6468a398504d8e4aae94488047f2dafe5b895e1d.tar.gz
freeipa-6468a398504d8e4aae94488047f2dafe5b895e1d.tar.xz
freeipa-6468a398504d8e4aae94488047f2dafe5b895e1d.zip
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/5804 Reviewed-By: Pavel Vomacka <pvomacka@redhat.com>
Diffstat (limited to 'ipatests/test_webui')
-rw-r--r--ipatests/test_webui/data_group.py10
-rw-r--r--ipatests/test_webui/data_user.py24
-rw-r--r--ipatests/test_webui/test_user.py38
-rw-r--r--ipatests/test_webui/ui_driver.py31
4 files changed, 90 insertions, 13 deletions
diff --git a/ipatests/test_webui/data_group.py b/ipatests/test_webui/data_group.py
index 2b32b2f32..9d79d18a1 100644
--- a/ipatests/test_webui/data_group.py
+++ b/ipatests/test_webui/data_group.py
@@ -68,3 +68,13 @@ DATA5 = {
('textarea', 'description', 'test-group5 desc'),
]
}
+
+PKEY6 = 'itest-group6'
+DATA6 = {
+ 'pkey': PKEY6,
+ 'add': [
+ ('textbox', 'cn', PKEY6),
+ ('textarea', 'description', 'test-group6 desc'),
+ ('textbox', 'gidnumber', '77777'),
+ ]
+}
diff --git a/ipatests/test_webui/data_user.py b/ipatests/test_webui/data_user.py
index 79a538980..c5ed796c7 100644
--- a/ipatests/test_webui/data_user.py
+++ b/ipatests/test_webui/data_user.py
@@ -17,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
ENTITY = 'user'
PKEY = 'itest-user'
@@ -63,3 +62,26 @@ DATA2 = {
('textbox', 'sn', 'OtherSurname2'),
],
}
+
+PKEY3 = 'itest-user3'
+DATA3 = {
+ 'pkey': PKEY3,
+ 'add': [
+ ('textbox', 'uid', PKEY3),
+ ('textbox', 'givenname', 'Name3'),
+ ('textbox', 'sn', 'Surname3'),
+ ('checkbox', 'noprivate', None),
+ ]
+}
+
+PKEY4 = 'itest-user4'
+DATA4 = {
+ 'pkey': PKEY4,
+ 'add': [
+ ('textbox', 'uid', PKEY4),
+ ('textbox', 'givenname', 'Name4'),
+ ('textbox', 'sn', 'Surname4'),
+ ('checkbox', 'noprivate', None),
+ ('combobox', 'gidnumber', '77777'),
+ ]
+}
diff --git a/ipatests/test_webui/test_user.py b/ipatests/test_webui/test_user.py
index b216125b2..5b509d18c 100644
--- a/ipatests/test_webui/test_user.py
+++ b/ipatests/test_webui/test_user.py
@@ -261,3 +261,41 @@ class test_user(UI_driver):
self.dialog_button_click('confirm')
self.wait_for_request(n=3)
self.assert_no_error_dialog()
+
+
+@pytest.mark.tier1
+class test_user_no_private_group(UI_driver):
+
+ @screenshot
+ def test_noprivate_nonposix(self):
+ """
+ User without private group and without specified GID
+ """
+ self.init_app()
+
+ with pytest.raises(AssertionError) as e:
+ self.add_record(user.ENTITY, user.DATA3)
+ assert e.value.message == u'Unexpected error: Default group for new users is not POSIX'
+
+ @screenshot
+ def test_noprivate_posix(self):
+ """
+ User without private group and specified existing posix GID
+ """
+ self.init_app()
+ self.add_record(group.ENTITY, group.DATA6)
+
+ self.add_record(user.ENTITY, user.DATA4)
+ self.delete(user.ENTITY, [user.DATA4])
+
+ self.delete(group.ENTITY, [group.DATA6])
+
+ @screenshot
+ def test_noprivate_gidnumber(self):
+ """
+ User without private group and specified unused GID
+ """
+ self.init_app()
+
+ self.add_record(user.ENTITY, user.DATA4, combobox_input='gidnumber')
+ self.delete(user.ENTITY, [user.DATA4])
diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py
index 8611ad3ca..40cdad3c7 100644
--- a/ipatests/test_webui/ui_driver.py
+++ b/ipatests/test_webui/ui_driver.py
@@ -778,7 +778,7 @@ class UI_driver(object):
assert label is not None, "Option not found: %s" % name
label.click()
- def select_combobox(self, name, value, parent=None):
+ def select_combobox(self, name, value, parent=None, combobox_input=None):
"""
Select value in a combobox. Search if not found.
"""
@@ -795,15 +795,20 @@ class UI_driver(object):
search_btn = self.find('a[name=search] i', By.CSS_SELECTOR, cb, strict=True)
opt_s = "select[name=list] option[value='%s']" % value
option = self.find(opt_s, By.CSS_SELECTOR, cb)
- if not option:
- # try to search
- self.fill_textbox('filter', value, cb)
- search_btn.click()
- self.wait_for_request()
- option = self.find(opt_s, By.CSS_SELECTOR, cb, strict=True)
+ if combobox_input:
+ if not option:
+ self.fill_textbox(combobox_input, value, cb)
+ else:
+ if not option:
+ # try to search
+ self.fill_textbox('filter', value, cb)
+
+ search_btn.click()
+ self.wait_for_request()
+ option = self.find(opt_s, By.CSS_SELECTOR, cb, strict=True)
- option.click()
+ option.click()
# Chrome does not close search area on click
if list_cnt.is_displayed():
@@ -1025,7 +1030,8 @@ class UI_driver(object):
fields = data.get('del')
self.delete_record(pkey, fields)
- def fill_fields(self, fields, parent=None, undo=False):
+ def fill_fields(
+ self, fields, parent=None, undo=False, combobox_input=None):
"""
Fill dialog or facet inputs with give data.
@@ -1060,7 +1066,8 @@ class UI_driver(object):
elif widget_type == 'selectbox':
self.select('select[name=%s]' % key, val, parent)
elif widget_type == 'combobox':
- self.select_combobox(key, val, parent)
+ self.select_combobox(
+ key, val, parent, combobox_input=combobox_input)
elif widget_type == 'add_table_record':
self.add_table_record(key, val, parent)
elif widget_type == 'add_table_association':
@@ -1149,7 +1156,7 @@ class UI_driver(object):
def add_record(self, entity, data, facet='search', facet_btn='add',
dialog_btn='add', delete=False, pre_delete=True,
- dialog_name='add', navigate=True):
+ dialog_name='add', navigate=True, combobox_input=None):
"""
Add records.
@@ -1184,7 +1191,7 @@ class UI_driver(object):
self.assert_dialog(dialog_name)
# fill dialog
- self.fill_fields(data['add'])
+ self.fill_fields(data['add'], combobox_input=combobox_input)
# confirm dialog
self.dialog_button_click(dialog_btn)