Imported Upstream version 4.6.2
This commit is contained in:
1
ipatests/test_webui/README
Normal file
1
ipatests/test_webui/README
Normal file
@@ -0,0 +1 @@
|
||||
http://www.freeipa.org/page/Web_UI_Integration_Tests
|
||||
27
ipatests/test_webui/__init__.py
Normal file
27
ipatests/test_webui/__init__.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Sub-package containing Web UI integration tests
|
||||
"""
|
||||
import ipatests.util
|
||||
|
||||
|
||||
ipatests.util.check_ipaclient_unittests()
|
||||
ipatests.util.check_no_ipaapi() # also ignore in make fasttest
|
||||
80
ipatests/test_webui/data_group.py
Normal file
80
ipatests/test_webui/data_group.py
Normal file
@@ -0,0 +1,80 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# 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 = 'group'
|
||||
DEFAULT_FACET = 'member_user'
|
||||
|
||||
PKEY = 'itest-group'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY),
|
||||
('textarea', 'description', 'test-group desc'),
|
||||
('radio', 'type', 'nonposix'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-group desc modified'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY2 = 'itest-group2'
|
||||
DATA2 = {
|
||||
'pkey': PKEY2,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY2),
|
||||
('textarea', 'description', 'test-group2 desc'),
|
||||
]
|
||||
}
|
||||
|
||||
PKEY3 = 'itest-group3'
|
||||
DATA3 = {
|
||||
'pkey': PKEY3,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY3),
|
||||
('textarea', 'description', 'test-group3 desc'),
|
||||
]
|
||||
}
|
||||
|
||||
PKEY4 = 'itest-group4'
|
||||
DATA4 = {
|
||||
'pkey': PKEY4,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY4),
|
||||
('textarea', 'description', 'test-group4 desc'),
|
||||
]
|
||||
}
|
||||
|
||||
PKEY5 = 'itest-group5'
|
||||
DATA5 = {
|
||||
'pkey': PKEY5,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY5),
|
||||
('textarea', 'description', 'test-group5 desc'),
|
||||
]
|
||||
}
|
||||
|
||||
PKEY6 = 'itest-group6'
|
||||
DATA6 = {
|
||||
'pkey': PKEY6,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY6),
|
||||
('textarea', 'description', 'test-group6 desc'),
|
||||
('textbox', 'gidnumber', '77777'),
|
||||
]
|
||||
}
|
||||
57
ipatests/test_webui/data_hbac.py
Normal file
57
ipatests/test_webui/data_hbac.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
RULE_ENTITY = 'hbacrule'
|
||||
RULE_PKEY = 'itesthbacrule'
|
||||
RULE_DATA = {
|
||||
'pkey': RULE_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', RULE_PKEY),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'testhbacrulec desc'),
|
||||
],
|
||||
}
|
||||
|
||||
SVC_ENTITY = 'hbacsvc'
|
||||
SVC_PKEY = 'itesthbacsvc'
|
||||
SVC_DATA = {
|
||||
'pkey': SVC_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', SVC_PKEY),
|
||||
('textarea', 'description', 'testhbacsvc desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'testhbacsvc desc mod'),
|
||||
],
|
||||
}
|
||||
|
||||
SVCGROUP_ENTITY = 'hbacsvcgroup'
|
||||
SVCGROUP_DEF_FACET = 'member_hbacsvc'
|
||||
SVCGROUP_PKEY = 'itesthbaccvcgroup'
|
||||
SVCGROUP_DATA = {
|
||||
'pkey': SVCGROUP_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', SVCGROUP_PKEY),
|
||||
('textarea', 'description', 'testhbaccvcgroup desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'testhbaccvcgroup desc mod'),
|
||||
],
|
||||
}
|
||||
81
ipatests/test_webui/data_hostgroup.py
Normal file
81
ipatests/test_webui/data_hostgroup.py
Normal file
@@ -0,0 +1,81 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# 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 = 'hostgroup'
|
||||
DEFAULT_FACET = 'member_host'
|
||||
|
||||
PKEY = 'itest-hostgroup'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY),
|
||||
('textarea', 'description', 'test-hostgroup desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-hostgroup desc modified'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY2 = 'itest-hostgroup2'
|
||||
DATA2 = {
|
||||
'pkey': PKEY2,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY2),
|
||||
('textarea', 'description', 'test-hostgroup2 desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-hostgroup2 desc modified'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY3 = 'itest-hostgroup3'
|
||||
DATA3 = {
|
||||
'pkey': PKEY3,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY3),
|
||||
('textarea', 'description', 'test-hostgroup3 desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-hostgroup3 desc modified'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY4 = 'itest-hostgroup4'
|
||||
DATA4 = {
|
||||
'pkey': PKEY4,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY4),
|
||||
('textarea', 'description', 'test-hostgroup4 desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-hostgroup4 desc modified'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY5 = 'itest-hostgroup5'
|
||||
DATA5 = {
|
||||
'pkey': PKEY5,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY5),
|
||||
('textarea', 'description', 'test-hostgroup5 desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-hostgroup5 desc modified'),
|
||||
],
|
||||
}
|
||||
20
ipatests/test_webui/data_idviews.py
Normal file
20
ipatests/test_webui/data_idviews.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
|
||||
ENTITY = 'idview'
|
||||
USER_FACET = 'idoverrideuser'
|
||||
GROUP_FACET = 'idoverridegroup'
|
||||
HOST_FACET = 'appliedtohosts'
|
||||
|
||||
PKEY = 'itest-view'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY),
|
||||
('textarea', 'description', 'Description of ID view'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'Different description'),
|
||||
],
|
||||
}
|
||||
43
ipatests/test_webui/data_netgroup.py
Normal file
43
ipatests/test_webui/data_netgroup.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# 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 = 'netgroup'
|
||||
PKEY = 'itest-netgroup'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY),
|
||||
('textarea', 'description', 'test-netgroup desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-netgroup desc modified'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY2 = 'itest-netgroup2'
|
||||
DATA2 = {
|
||||
'pkey': PKEY2,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY2),
|
||||
('textarea', 'description', 'test-netgroup2 desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'test-netgroup2 desc modified'),
|
||||
],
|
||||
}
|
||||
82
ipatests/test_webui/data_sudo.py
Normal file
82
ipatests/test_webui/data_sudo.py
Normal file
@@ -0,0 +1,82 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
RULE_ENTITY = 'sudorule'
|
||||
CMDENTITY = 'sudocmd'
|
||||
CMDGROUP_ENTITY = 'sudocmdgroup'
|
||||
CMDGROUP_DEF_FACET = 'member_sudocmd'
|
||||
|
||||
RULE_PKEY = 'itestsudorule'
|
||||
RULE_DATA = {
|
||||
'pkey': RULE_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', RULE_PKEY),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'itestsudorule desc'),
|
||||
],
|
||||
}
|
||||
|
||||
CMD_PKEY = 'itestsudocmd'
|
||||
CMD_DATA = {
|
||||
'pkey': CMD_PKEY,
|
||||
'add': [
|
||||
('textbox', 'sudocmd', CMD_PKEY),
|
||||
('textarea', 'description', 'itestsudocmd desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'itestsudocmd desc mod'),
|
||||
],
|
||||
}
|
||||
|
||||
CMD_PKEY2 = 'itestsudocmd2'
|
||||
CMD_DATA2 = {
|
||||
'pkey': CMD_PKEY2,
|
||||
'add': [
|
||||
('textbox', 'sudocmd', CMD_PKEY2),
|
||||
('textarea', 'description', 'itestsudocmd2 desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'itestsudocmd2 desc mod'),
|
||||
],
|
||||
}
|
||||
|
||||
CMD_GROUP_PKEY = 'itestsudocmdgroup'
|
||||
CMDGROUP_DATA = {
|
||||
'pkey': CMD_GROUP_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', CMD_GROUP_PKEY),
|
||||
('textarea', 'description', 'itestsudocmdgroup desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'itestsudocmdgroup desc mod'),
|
||||
],
|
||||
}
|
||||
|
||||
CMD_GROUP_PKEY2 = 'itestsudocmdgroup2'
|
||||
CMDGROUP_DATA2 = {
|
||||
'pkey': CMD_GROUP_PKEY2,
|
||||
'add': [
|
||||
('textbox', 'cn', CMD_GROUP_PKEY2),
|
||||
('textarea', 'description', 'itestsudocmdgroup2 desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'itestsudocmdgroup2 desc mod'),
|
||||
],
|
||||
}
|
||||
87
ipatests/test_webui/data_user.py
Normal file
87
ipatests/test_webui/data_user.py
Normal file
@@ -0,0 +1,87 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# 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'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'uid', PKEY),
|
||||
('textbox', 'givenname', 'Name'),
|
||||
('textbox', 'sn', 'Surname'),
|
||||
],
|
||||
'add_v': [
|
||||
('textbox', 'givenname', 'Name'),
|
||||
('textbox', 'sn', 'Surname'),
|
||||
('label', 'uid', PKEY),
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'givenname', 'OtherName'),
|
||||
('textbox', 'sn', 'OtherSurname'),
|
||||
('multivalued', 'telephonenumber', [
|
||||
('add', '123456789'),
|
||||
('add', '987654321'),
|
||||
]),
|
||||
('combobox', 'manager', 'admin'),
|
||||
],
|
||||
'mod_v': [
|
||||
('textbox', 'givenname', 'OtherName'),
|
||||
('textbox', 'sn', 'OtherSurname'),
|
||||
('multivalued', 'telephonenumber', ['123456789', '987654321']),
|
||||
('combobox', 'manager', 'admin'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY2 = 'itest-user2'
|
||||
DATA2 = {
|
||||
'pkey': PKEY2,
|
||||
'add': [
|
||||
('textbox', 'uid', PKEY2),
|
||||
('textbox', 'givenname', 'Name2'),
|
||||
('textbox', 'sn', 'Surname2'),
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'givenname', 'OtherName2'),
|
||||
('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'),
|
||||
]
|
||||
}
|
||||
63
ipatests/test_webui/data_vault.py
Normal file
63
ipatests/test_webui/data_vault.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# Authors:
|
||||
# Pavel Vomacka <pvomacka@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2016 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# 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 = 'vault'
|
||||
|
||||
PKEY = 'itest-user-vault'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'facet': 'user_search',
|
||||
'add': [
|
||||
('radio', 'type', 'user'),
|
||||
('textbox', 'cn', PKEY),
|
||||
('textbox', 'description', 'test-desc')
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'description', 'test-desc-mod'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY2 = 'itest-service-vault'
|
||||
DATA2 = {
|
||||
'pkey': PKEY2,
|
||||
'facet': 'service_search',
|
||||
'add': [
|
||||
('radio', 'type', 'service'),
|
||||
# service
|
||||
('textbox', 'cn', PKEY2),
|
||||
('textbox', 'description', 'test-desc')
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'description', 'test-desc-mod'),
|
||||
],
|
||||
}
|
||||
|
||||
PKEY3 = 'itest-shared-vault'
|
||||
DATA3 = {
|
||||
'pkey': PKEY3,
|
||||
'facet': 'shared_search',
|
||||
'add': [
|
||||
('radio', 'type', 'shared'),
|
||||
('textbox', 'cn', PKEY3),
|
||||
('textbox', 'description', 'test-desc')
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'description', 'test-desc-mod'),
|
||||
],
|
||||
}
|
||||
116
ipatests/test_webui/task_range.py
Normal file
116
ipatests/test_webui/task_range.py
Normal file
@@ -0,0 +1,116 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Range tasks
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
|
||||
|
||||
class range_tasks(UI_driver):
|
||||
|
||||
def get_shifts(self, idranges=None):
|
||||
|
||||
if not idranges:
|
||||
result = self.execute_api_from_ui('idrange_find', [], {})
|
||||
idranges = result['result']['result']
|
||||
|
||||
max_id = 0
|
||||
max_rid = 0
|
||||
|
||||
for idrange in idranges:
|
||||
size = int(idrange['ipaidrangesize'][0])
|
||||
base_id = int(idrange['ipabaseid'][0])
|
||||
|
||||
id_end = base_id + size
|
||||
rid_end = 0
|
||||
|
||||
if 'ipabaserid' in idrange:
|
||||
base_rid = int(idrange['ipabaserid'][0])
|
||||
rid_end = base_rid + size
|
||||
|
||||
if 'ipasecondarybaserid' in idrange:
|
||||
secondary_base_rid = int(idrange['ipasecondarybaserid'][0])
|
||||
rid_end = max(base_rid, secondary_base_rid) + size
|
||||
|
||||
if max_id < id_end:
|
||||
max_id = id_end + 1000000
|
||||
|
||||
if max_rid < rid_end:
|
||||
max_rid = rid_end + 1000000
|
||||
|
||||
self.max_id = max_id
|
||||
self.max_rid = max_rid
|
||||
|
||||
def get_domain(self):
|
||||
result = self.execute_api_from_ui('trust_find', [], {})
|
||||
trusts = result['result']['result']
|
||||
domain = None
|
||||
if trusts:
|
||||
domain = trusts[0]['cn']
|
||||
return domain
|
||||
|
||||
def get_data(self, pkey, size=50, add_data=None):
|
||||
|
||||
if not add_data:
|
||||
add_data = self.get_add_data(pkey, size=size)
|
||||
|
||||
data = {
|
||||
'pkey': pkey,
|
||||
'add': add_data,
|
||||
'mod': [
|
||||
('textbox', 'ipaidrangesize', str(size + 1)),
|
||||
],
|
||||
}
|
||||
return data
|
||||
|
||||
def get_add_data(self, pkey, range_type='ipa-local', size=50, shift=100, domain=None):
|
||||
|
||||
base_id = self.max_id + shift
|
||||
self.max_id = base_id + size
|
||||
|
||||
base_rid = self.max_rid + shift
|
||||
self.max_rid = base_rid + size
|
||||
|
||||
add = [
|
||||
('textbox', 'cn', pkey),
|
||||
('textbox', 'ipabaseid', str(base_id)),
|
||||
('textbox', 'ipaidrangesize', str(size)),
|
||||
('textbox', 'ipabaserid', str(base_rid)),
|
||||
('radio', 'iparangetype', range_type),
|
||||
('callback', self.check_range_type_mod, range_type)
|
||||
]
|
||||
|
||||
if not domain:
|
||||
base_rid = self.max_rid + shift
|
||||
self.max_rid = base_rid + size
|
||||
add.append(('textbox', 'ipasecondarybaserid', str(base_rid)))
|
||||
if domain:
|
||||
add.append(('textbox', 'ipanttrusteddomainname', domain))
|
||||
|
||||
return add
|
||||
|
||||
def check_range_type_mod(self, range_type):
|
||||
if range_type == 'ipa-local':
|
||||
self.assert_disabled("[name=ipanttrusteddomainname]")
|
||||
self.assert_disabled("[name=ipasecondarybaserid]", negative=True)
|
||||
elif range_type == 'ipa-ad-trust':
|
||||
self.assert_disabled("[name=ipanttrusteddomainname]", negative=True)
|
||||
self.assert_disabled("[name=ipasecondarybaserid]")
|
||||
271
ipatests/test_webui/test_automember.py
Normal file
271
ipatests/test_webui/test_automember.py
Normal file
@@ -0,0 +1,271 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Automember tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
from ipatests.test_webui.test_host import host_tasks
|
||||
import pytest
|
||||
|
||||
ENTITY = 'automember'
|
||||
|
||||
USER_GROUP_PKEY = 'admins'
|
||||
USER_GROUP_DATA = {
|
||||
'pkey': USER_GROUP_PKEY,
|
||||
'add': [
|
||||
('combobox', 'cn', USER_GROUP_PKEY),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'user group rule description'),
|
||||
],
|
||||
}
|
||||
|
||||
HOST_GROUP_DATA = {
|
||||
'pkey': hostgroup.PKEY,
|
||||
'add': [
|
||||
('combobox', 'cn', hostgroup.PKEY),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'host group rule description'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_automember(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: automember
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# user group rule
|
||||
self.basic_crud(ENTITY, USER_GROUP_DATA,
|
||||
search_facet='searchgroup',
|
||||
default_facet='usergrouprule',
|
||||
details_facet='usergrouprule',
|
||||
)
|
||||
|
||||
# prepare host group
|
||||
self.basic_crud(hostgroup.ENTITY, hostgroup.DATA,
|
||||
default_facet=hostgroup.DEFAULT_FACET,
|
||||
delete=False)
|
||||
|
||||
# host group rule
|
||||
self.navigate_by_menu('identity/automember/amhostgroup')
|
||||
|
||||
self.basic_crud(ENTITY, HOST_GROUP_DATA,
|
||||
search_facet='searchhostgroup',
|
||||
default_facet='hostgrouprule',
|
||||
details_facet='hostgrouprule',
|
||||
navigate=False,
|
||||
breadcrumb='Host group rules',
|
||||
)
|
||||
|
||||
# cleanup
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA])
|
||||
|
||||
@screenshot
|
||||
def test_rebuild_membership_hosts(self):
|
||||
"""
|
||||
Test automember rebuild membership feature for hosts
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
host_util = host_tasks()
|
||||
host_util.setup(self.driver, self.config)
|
||||
domain = self.config.get('ipa_domain')
|
||||
host1 = 'web1.%s' % domain
|
||||
host2 = 'web2.%s' % domain
|
||||
|
||||
# Add a hostgroup
|
||||
self.add_record('hostgroup', {
|
||||
'pkey': 'webservers',
|
||||
'add': [
|
||||
('textbox', 'cn', 'webservers'),
|
||||
('textarea', 'description', 'webservers'),
|
||||
]
|
||||
})
|
||||
|
||||
# Add hosts
|
||||
self.add_record('host', host_util.get_data("web1", domain))
|
||||
self.add_record('host', host_util.get_data("web2", domain))
|
||||
|
||||
# Add an automember rule
|
||||
self.add_record(
|
||||
'automember',
|
||||
{'pkey': 'webservers', 'add': [('combobox', 'cn', 'webservers')]},
|
||||
facet='searchhostgroup'
|
||||
)
|
||||
|
||||
# Add a condition for automember rule
|
||||
self.navigate_to_record('webservers')
|
||||
self.add_table_record(
|
||||
'automemberinclusiveregex',
|
||||
{'fields': [
|
||||
('selectbox', 'key', 'fqdn'),
|
||||
('textbox', 'automemberinclusiveregex', '^web[1-9]+')
|
||||
]}
|
||||
)
|
||||
|
||||
# Assert that hosts are not members of hostgroup
|
||||
self.navigate_to_record('webservers', entity='hostgroup')
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record(host1, negative=True)
|
||||
self.assert_record(host2, negative=True)
|
||||
|
||||
# Rebuild membership for first host, using action on host details facet
|
||||
self.navigate_to_record(host1, entity='host')
|
||||
self.action_list_action('automember_rebuild')
|
||||
|
||||
# Assert that host is now a member of hostgroup
|
||||
self.navigate_to_record('webservers', entity='hostgroup')
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record(host1)
|
||||
self.assert_record(host2, negative=True)
|
||||
|
||||
# Remove host from hostgroup
|
||||
self.delete_record(host1)
|
||||
|
||||
# Assert that host is not a member of hostgroup
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record(host1, negative=True)
|
||||
self.assert_record(host2, negative=True)
|
||||
|
||||
# Rebuild membership for all hosts, using action on hosts search facet
|
||||
self.navigate_by_menu('identity/host')
|
||||
self.action_list_action('automember_rebuild')
|
||||
|
||||
# Assert that hosts are now members of hostgroup
|
||||
self.navigate_to_record('webservers', entity='hostgroup')
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record(host1)
|
||||
self.assert_record(host2)
|
||||
|
||||
# Delete hostgroup, hosts and automember rule
|
||||
self.delete('hostgroup', [{'pkey': 'webservers'}])
|
||||
self.delete('host', [{'pkey': host1}, {'pkey': host2}])
|
||||
self.delete('automember', [{'pkey': 'webservers'}],
|
||||
facet='searchhostgroup')
|
||||
|
||||
@screenshot
|
||||
def test_rebuild_membership_users(self):
|
||||
"""
|
||||
Test automember rebuild membership feature for users
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# Add a group
|
||||
self.add_record('group', {
|
||||
'pkey': 'devel',
|
||||
'add': [
|
||||
('textbox', 'cn', 'devel'),
|
||||
('textarea', 'description', 'devel'),
|
||||
]
|
||||
})
|
||||
|
||||
# Add a user
|
||||
self.add_record('user', {
|
||||
'pkey': 'dev1',
|
||||
'add': [
|
||||
('textbox', 'uid', 'dev1'),
|
||||
('textbox', 'givenname', 'Dev'),
|
||||
('textbox', 'sn', 'One'),
|
||||
]
|
||||
})
|
||||
|
||||
# Add another user
|
||||
self.add_record('user', {
|
||||
'pkey': 'dev2',
|
||||
'add': [
|
||||
('textbox', 'uid', 'dev2'),
|
||||
('textbox', 'givenname', 'Dev'),
|
||||
('textbox', 'sn', 'Two'),
|
||||
]
|
||||
})
|
||||
|
||||
# Add an automember rule
|
||||
self.add_record(
|
||||
'automember',
|
||||
{'pkey': 'devel', 'add': [('combobox', 'cn', 'devel')]},
|
||||
facet='searchgroup'
|
||||
)
|
||||
|
||||
# Add a condition for automember rule
|
||||
self.navigate_to_record('devel')
|
||||
self.add_table_record(
|
||||
'automemberinclusiveregex',
|
||||
{'fields': [
|
||||
('selectbox', 'key', 'uid'),
|
||||
('textbox', 'automemberinclusiveregex', '^dev[1-9]+')
|
||||
]}
|
||||
)
|
||||
|
||||
# Assert that users are not members of group
|
||||
self.navigate_to_record('devel', entity='group')
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record('dev1', negative=True)
|
||||
self.assert_record('dev2', negative=True)
|
||||
|
||||
# Rebuild membership for first user, using action on user details facet
|
||||
self.navigate_to_record('dev1', entity='user')
|
||||
self.action_list_action('automember_rebuild')
|
||||
|
||||
# Assert that user is now a member of group
|
||||
self.navigate_to_record('devel', entity='group')
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record('dev1')
|
||||
self.assert_record('dev2', negative=True)
|
||||
|
||||
# Remove user from group
|
||||
self.delete_record('dev1')
|
||||
|
||||
# Assert that user is not a member of group
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record('dev1', negative=True)
|
||||
self.assert_record('dev2', negative=True)
|
||||
|
||||
# Rebuild membership for all users, using action on users search facet
|
||||
self.navigate_by_menu('identity/user_search')
|
||||
self.action_list_action('automember_rebuild')
|
||||
|
||||
# Assert that users are now members of group
|
||||
self.navigate_to_record('devel', entity='group')
|
||||
self.facet_button_click('refresh')
|
||||
self.wait_for_request()
|
||||
self.assert_record('dev1')
|
||||
self.assert_record('dev2')
|
||||
|
||||
# Delete group, users and automember rule
|
||||
self.delete('group', [{'pkey': 'devel'}])
|
||||
self.delete('user', [{'pkey': 'dev1'}, {'pkey': 'dev2'}])
|
||||
self.delete('automember', [{'pkey': 'devel'}], facet='searchgroup')
|
||||
145
ipatests/test_webui/test_automount.py
Normal file
145
ipatests/test_webui/test_automount.py
Normal file
@@ -0,0 +1,145 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Automount tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
LOC_ENTITY = 'automountlocation'
|
||||
MAP_ENTITY = 'automountmap'
|
||||
KEY_ENTITY = 'automountkey'
|
||||
|
||||
LOC_PKEY = 'itestloc'
|
||||
LOC_DATA = {
|
||||
'pkey': LOC_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', LOC_PKEY),
|
||||
],
|
||||
}
|
||||
|
||||
MAP_PKEY = 'itestmap'
|
||||
MAP_DATA = {
|
||||
'pkey': MAP_PKEY,
|
||||
'add': [
|
||||
('textbox', 'automountmapname', MAP_PKEY),
|
||||
('textarea', 'description', 'map desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'map desc mod'),
|
||||
]
|
||||
}
|
||||
|
||||
KEY_PKEY = 'itestkey'
|
||||
KEY_DATA = {
|
||||
'pkey': KEY_PKEY,
|
||||
'add': [
|
||||
('textbox', 'automountkey', KEY_PKEY),
|
||||
('textbox', 'automountinformation', '/itest/key'),
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'automountinformation', '/itest/key2'),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_automount(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: automount
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# location
|
||||
self.basic_crud(LOC_ENTITY, LOC_DATA,
|
||||
default_facet='maps',
|
||||
delete=False,
|
||||
breadcrumb='Automount Locations'
|
||||
)
|
||||
|
||||
# map
|
||||
self.navigate_to_record(LOC_PKEY)
|
||||
|
||||
self.basic_crud(MAP_ENTITY, MAP_DATA,
|
||||
parent_entity=LOC_ENTITY,
|
||||
search_facet='maps',
|
||||
default_facet='keys',
|
||||
delete=False,
|
||||
navigate=False,
|
||||
breadcrumb=LOC_PKEY,
|
||||
)
|
||||
|
||||
# key
|
||||
self.navigate_to_record(MAP_PKEY)
|
||||
|
||||
self.basic_crud(KEY_ENTITY, KEY_DATA,
|
||||
parent_entity=MAP_ENTITY,
|
||||
search_facet='keys',
|
||||
navigate=False,
|
||||
breadcrumb=MAP_PKEY,
|
||||
)
|
||||
|
||||
# delete
|
||||
self.navigate_by_breadcrumb(LOC_PKEY)
|
||||
self.delete_record(MAP_PKEY)
|
||||
|
||||
## test indirect maps
|
||||
direct_pkey = 'itest-direct'
|
||||
indirect_pkey = 'itest-indirect'
|
||||
|
||||
self.add_record(LOC_ENTITY,
|
||||
{
|
||||
'pkey': direct_pkey,
|
||||
'add': [
|
||||
('radio', 'method', 'add'),
|
||||
('textbox', 'automountmapname', direct_pkey),
|
||||
('textarea', 'description', 'foobar'),
|
||||
],
|
||||
},
|
||||
facet='maps',
|
||||
navigate=False)
|
||||
|
||||
self.add_record(LOC_ENTITY,
|
||||
{
|
||||
'pkey': indirect_pkey,
|
||||
'add': [
|
||||
('radio', 'method', 'add_indirect'),
|
||||
('textbox', 'automountmapname', indirect_pkey),
|
||||
('textarea', 'description', 'foobar'),
|
||||
('textbox', 'key', 'baz'),
|
||||
('textbox', 'parentmap', direct_pkey),
|
||||
],
|
||||
},
|
||||
facet='maps',
|
||||
navigate=False)
|
||||
|
||||
self.assert_record(direct_pkey)
|
||||
self.assert_record(indirect_pkey)
|
||||
|
||||
# delete
|
||||
self.delete_record(direct_pkey)
|
||||
self.delete_record(indirect_pkey)
|
||||
self.navigate_by_breadcrumb('Automount Locations')
|
||||
self.delete_record(LOC_PKEY)
|
||||
51
ipatests/test_webui/test_cert.py
Normal file
51
ipatests/test_webui/test_cert.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Cert tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'cert'
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_cert(UI_driver):
|
||||
|
||||
def setup(self, *args, **kwargs):
|
||||
super(test_cert, self).setup(*args, **kwargs)
|
||||
|
||||
if not self.has_ca():
|
||||
self.skip('CA not configured')
|
||||
|
||||
@screenshot
|
||||
def test_read(self):
|
||||
"""
|
||||
Basic read: cert
|
||||
|
||||
Certs don't have standard mod, add and delete methods.
|
||||
"""
|
||||
self.init_app()
|
||||
self.navigate_to_entity(ENTITY)
|
||||
rows = self.get_rows()
|
||||
self.navigate_to_row_record(rows[0])
|
||||
self.navigate_by_breadcrumb("Certificates")
|
||||
57
ipatests/test_webui/test_config.py
Normal file
57
ipatests/test_webui/test_config.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Config tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'config'
|
||||
|
||||
DATA = {
|
||||
'mod': [
|
||||
('textbox', 'ipasearchrecordslimit', '200'),
|
||||
('textbox', 'ipasearchtimelimit', '3'),
|
||||
],
|
||||
}
|
||||
|
||||
DATA2 = {
|
||||
'mod': [
|
||||
('textbox', 'ipasearchrecordslimit', '100'),
|
||||
('textbox', 'ipasearchtimelimit', '2'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_config(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_mod(self):
|
||||
"""
|
||||
Config mod tests
|
||||
"""
|
||||
self.init_app()
|
||||
self.navigate_to_entity(ENTITY)
|
||||
|
||||
self.mod_record(ENTITY, DATA)
|
||||
self.mod_record(ENTITY, DATA2)
|
||||
55
ipatests/test_webui/test_delegation.py
Normal file
55
ipatests/test_webui/test_delegation.py
Normal file
@@ -0,0 +1,55 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Delegation tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'delegation'
|
||||
PKEY = 'itest-delegation-rule'
|
||||
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'aciname', PKEY),
|
||||
('combobox', 'group', 'editors'),
|
||||
('combobox', 'memberof', 'ipausers'),
|
||||
('checkbox', 'attrs', 'audio'),
|
||||
('checkbox', 'attrs', 'businesscategory'),
|
||||
],
|
||||
'mod': [
|
||||
('checkbox', 'attrs', 'businesscategory'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_delegation(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: delegation
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(ENTITY, DATA)
|
||||
170
ipatests/test_webui/test_dns.py
Normal file
170
ipatests/test_webui/test_dns.py
Normal file
@@ -0,0 +1,170 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
DNS tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ZONE_ENTITY = 'dnszone'
|
||||
FORWARD_ZONE_ENTITY = 'dnsforwardzone'
|
||||
RECORD_ENTITY = 'dnsrecord'
|
||||
CONFIG_ENTITY = 'dnsconfig'
|
||||
|
||||
ZONE_DEFAULT_FACET = 'records'
|
||||
|
||||
ZONE_PKEY = 'foo.itest.'
|
||||
|
||||
ZONE_DATA = {
|
||||
'pkey': ZONE_PKEY,
|
||||
'add': [
|
||||
('textbox', 'idnsname', ZONE_PKEY),
|
||||
],
|
||||
'mod': [
|
||||
('checkbox', 'idnsallowsyncptr', 'checked'),
|
||||
],
|
||||
}
|
||||
|
||||
FORWARD_ZONE_PKEY = 'forward.itest.'
|
||||
|
||||
FORWARD_ZONE_DATA = {
|
||||
'pkey': FORWARD_ZONE_PKEY,
|
||||
'add': [
|
||||
('textbox', 'idnsname', FORWARD_ZONE_PKEY),
|
||||
('multivalued', 'idnsforwarders', [
|
||||
('add', '192.168.2.1'),
|
||||
]),
|
||||
('radio', 'idnsforwardpolicy', 'only'),
|
||||
],
|
||||
'mod': [
|
||||
('multivalued', 'idnsforwarders', [
|
||||
('add', '192.168.3.1'),
|
||||
]),
|
||||
('checkbox', 'idnsforwardpolicy', 'first'),
|
||||
],
|
||||
}
|
||||
|
||||
RECORD_PKEY = 'itest'
|
||||
A_IP = '192.168.1.10'
|
||||
RECORD_ADD_DATA = {
|
||||
'pkey': RECORD_PKEY,
|
||||
'add': [
|
||||
('textbox', 'idnsname', RECORD_PKEY),
|
||||
('textbox', 'a_part_ip_address', A_IP),
|
||||
]
|
||||
}
|
||||
|
||||
RECORD_MOD_DATA = {
|
||||
'fields': [
|
||||
('textbox', 'a_part_ip_address', '192.168.1.11'),
|
||||
]
|
||||
}
|
||||
|
||||
CONFIG_MOD_DATA = {
|
||||
'mod': [
|
||||
('checkbox', 'idnsallowsyncptr', 'checked'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_dns(UI_driver):
|
||||
|
||||
def setup(self, *args, **kwargs):
|
||||
super(test_dns, self).setup(*args, **kwargs)
|
||||
|
||||
if not self.has_dns():
|
||||
self.skip('DNS not configured')
|
||||
|
||||
@screenshot
|
||||
def test_zone_record_crud(self):
|
||||
"""
|
||||
Basic CRUD: dns
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# add and mod zone
|
||||
self.basic_crud(ZONE_ENTITY, ZONE_DATA,
|
||||
default_facet=ZONE_DEFAULT_FACET, delete=False)
|
||||
|
||||
# add and mod record
|
||||
self.navigate_to_record(ZONE_PKEY)
|
||||
self.add_record(ZONE_ENTITY, RECORD_ADD_DATA,
|
||||
facet=ZONE_DEFAULT_FACET, navigate=False)
|
||||
self.navigate_to_record(RECORD_PKEY)
|
||||
self.add_table_record('arecord', RECORD_MOD_DATA)
|
||||
|
||||
# del record, del zone
|
||||
self.navigate_by_breadcrumb(ZONE_PKEY)
|
||||
self.delete_record(RECORD_PKEY)
|
||||
self.navigate_by_breadcrumb("DNS Zones")
|
||||
self.delete_record(ZONE_PKEY)
|
||||
|
||||
@screenshot
|
||||
def test_forward_zone(self):
|
||||
"""
|
||||
Forward DNS zones
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# add and mod zone
|
||||
self.basic_crud(FORWARD_ZONE_ENTITY, FORWARD_ZONE_DATA, delete=False)
|
||||
|
||||
# enable/disable
|
||||
self.navigate_to_record(FORWARD_ZONE_PKEY)
|
||||
|
||||
self.disable_action()
|
||||
self.enable_action()
|
||||
self.action_list_action('add_permission')
|
||||
self.action_list_action('remove_permission')
|
||||
|
||||
# del zone
|
||||
self.navigate_by_breadcrumb("DNS Forward Zones")
|
||||
self.delete_record(FORWARD_ZONE_PKEY)
|
||||
|
||||
@screenshot
|
||||
def test_last_entry_deletion(self):
|
||||
"""
|
||||
Test last entry deletion
|
||||
"""
|
||||
self.init_app()
|
||||
self.add_record(ZONE_ENTITY, ZONE_DATA)
|
||||
self.navigate_to_record(ZONE_PKEY)
|
||||
self.add_record(ZONE_ENTITY, RECORD_ADD_DATA,
|
||||
facet=ZONE_DEFAULT_FACET)
|
||||
self.navigate_to_record(RECORD_PKEY)
|
||||
self.delete_record(A_IP, parent=self.get_facet(), table_name='arecord')
|
||||
self.assert_dialog('message_dialog')
|
||||
self.dialog_button_click('ok')
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_facet(ZONE_ENTITY, ZONE_DEFAULT_FACET)
|
||||
self.navigate_by_breadcrumb("DNS Zones")
|
||||
self.delete_record(ZONE_PKEY)
|
||||
|
||||
@screenshot
|
||||
def test_config_crud(self):
|
||||
"""
|
||||
Basic CRUD: dnsconfig
|
||||
"""
|
||||
self.init_app()
|
||||
self.navigate_by_menu('network_services/dns/dnsconfig')
|
||||
self.mod_record(CONFIG_ENTITY, CONFIG_MOD_DATA)
|
||||
231
ipatests/test_webui/test_group.py
Normal file
231
ipatests/test_webui/test_group.py
Normal file
@@ -0,0 +1,231 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Group tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_group as group
|
||||
import ipatests.test_webui.data_user as user
|
||||
import ipatests.test_webui.data_netgroup as netgroup
|
||||
import ipatests.test_webui.data_hbac as hbac
|
||||
import ipatests.test_webui.test_rbac as rbac
|
||||
import ipatests.test_webui.data_sudo as sudo
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_group(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: group
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(group.ENTITY, group.DATA,
|
||||
default_facet=group.DEFAULT_FACET)
|
||||
|
||||
@screenshot
|
||||
def test_group_types(self):
|
||||
"""
|
||||
Test group types in adder dialog
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
pkey = 'itest-group'
|
||||
data = {
|
||||
'pkey': pkey,
|
||||
'add': [
|
||||
('callback', self.check_posix_enabled, True),
|
||||
('textbox', 'cn', pkey),
|
||||
('textarea', 'description', 'test-group desc'),
|
||||
('radio', 'type', 'normal'),
|
||||
('callback', self.check_posix_enabled, False),
|
||||
('radio', 'type', 'posix'),
|
||||
('callback', self.check_posix_enabled, True),
|
||||
('radio', 'type', 'external'),
|
||||
('callback', self.check_posix_enabled, False),
|
||||
('radio', 'type', 'posix'),
|
||||
('callback', self.check_posix_enabled, True),
|
||||
],
|
||||
}
|
||||
|
||||
self.add_record(group.ENTITY, data)
|
||||
self.delete(group.ENTITY, [data], navigate=False)
|
||||
|
||||
def check_posix_enabled(self, enabled):
|
||||
self.assert_disabled("[name=gidnumber]", negative=enabled)
|
||||
|
||||
@screenshot
|
||||
def test_actions(self):
|
||||
"""
|
||||
Test group actions
|
||||
"""
|
||||
|
||||
self.init_app()
|
||||
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.navigate_to_record(group.PKEY)
|
||||
self.switch_to_facet('details')
|
||||
self.make_posix_action()
|
||||
self.delete_action()
|
||||
|
||||
self.add_record(group.ENTITY, group.DATA, navigate=False)
|
||||
self.navigate_to_record(group.PKEY)
|
||||
self.switch_to_facet('details')
|
||||
self.facet_button_click('refresh') # workaround for BUG: #3702
|
||||
self.make_external_action()
|
||||
self.delete_action()
|
||||
|
||||
def make_external_action(self):
|
||||
self.action_list_action('make_external')
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_no_error_dialog()
|
||||
self.assert_text_field('external', 'External', element='span')
|
||||
|
||||
def make_posix_action(self):
|
||||
self.action_list_action('make_posix')
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_no_error_dialog()
|
||||
self.assert_text_field('external', 'POSIX', element='span')
|
||||
|
||||
def delete_action(self, entity=group.ENTITY, pkey=group.PKEY):
|
||||
self.action_list_action('delete')
|
||||
self.wait_for_request(n=4)
|
||||
self.assert_no_error_dialog()
|
||||
self.assert_facet(entity, 'search')
|
||||
self.assert_record(pkey, negative=True)
|
||||
|
||||
@screenshot
|
||||
def test_associations(self):
|
||||
"""
|
||||
Test group associations
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# prepare
|
||||
# -------
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.add_record(group.ENTITY, group.DATA2, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA3, navigate=False)
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
|
||||
# add & remove associations
|
||||
# -------------------------
|
||||
self.navigate_to_record(group.PKEY, entity=group.ENTITY)
|
||||
|
||||
# members
|
||||
self.add_associations([group.PKEY2], facet='member_group', delete=True)
|
||||
self.add_associations([user.PKEY], facet='member_user', delete=True)
|
||||
# TODO: external
|
||||
|
||||
# member of
|
||||
self.add_associations([group.PKEY3], facet='memberof_group', delete=True)
|
||||
self.add_associations([netgroup.PKEY], facet='memberof_netgroup', delete=True)
|
||||
self.add_associations([rbac.ROLE_PKEY], facet='memberof_role', delete=True)
|
||||
self.add_associations([hbac.RULE_PKEY], facet='memberof_hbacrule', delete=True)
|
||||
self.navigate_to_record(group.PKEY, entity=group.ENTITY)
|
||||
self.add_associations([sudo.RULE_PKEY], facet='memberof_sudorule', delete=True)
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(group.ENTITY, [group.DATA, group.DATA2, group.DATA3])
|
||||
self.delete(user.ENTITY, [user.DATA])
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA])
|
||||
self.delete(rbac.ROLE_ENTITY, [rbac.ROLE_DATA])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
|
||||
@screenshot
|
||||
def test_indirect_associations(self):
|
||||
"""
|
||||
Group indirect associations
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# add
|
||||
# ---
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.add_record(group.ENTITY, group.DATA2, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA3, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA4, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA5, navigate=False)
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
|
||||
# prepare indirect member
|
||||
self.navigate_to_entity(group.ENTITY, 'search')
|
||||
self.navigate_to_record(group.PKEY2)
|
||||
self.add_associations([user.PKEY])
|
||||
self.add_associations([group.PKEY3], 'member_group')
|
||||
|
||||
self.navigate_to_entity(group.ENTITY, 'search')
|
||||
self.navigate_to_record(group.PKEY)
|
||||
self.add_associations([group.PKEY2], 'member_group')
|
||||
|
||||
# prepare indirect memberof
|
||||
self.navigate_to_entity(group.ENTITY, 'search')
|
||||
self.navigate_to_record(group.PKEY4)
|
||||
self.add_associations([group.PKEY], 'member_group')
|
||||
self.add_associations([group.PKEY5], 'memberof_group')
|
||||
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
self.navigate_to_record(netgroup.PKEY)
|
||||
self.add_table_associations('memberuser_group', [group.PKEY4])
|
||||
|
||||
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
|
||||
self.navigate_to_record(rbac.ROLE_PKEY)
|
||||
self.add_associations([group.PKEY4], facet='member_group')
|
||||
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.navigate_to_record(hbac.RULE_PKEY)
|
||||
self.add_table_associations('memberuser_group', [group.PKEY4])
|
||||
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
self.navigate_to_record(sudo.RULE_PKEY)
|
||||
self.add_table_associations('memberuser_group', [group.PKEY4])
|
||||
|
||||
# check indirect associations
|
||||
# ---------------------------
|
||||
self.navigate_to_entity(group.ENTITY, 'search')
|
||||
self.navigate_to_record(group.PKEY)
|
||||
|
||||
self.assert_indirect_record(user.PKEY, group.ENTITY, 'member_user')
|
||||
self.assert_indirect_record(group.PKEY3, group.ENTITY, 'member_group')
|
||||
|
||||
self.assert_indirect_record(group.PKEY5, group.ENTITY, 'memberof_group')
|
||||
self.assert_indirect_record(netgroup.PKEY, group.ENTITY, 'memberof_netgroup')
|
||||
self.assert_indirect_record(rbac.ROLE_PKEY, group.ENTITY, 'memberof_role')
|
||||
self.assert_indirect_record(hbac.RULE_PKEY, group.ENTITY, 'memberof_hbacrule')
|
||||
self.assert_indirect_record(sudo.RULE_PKEY, group.ENTITY, 'memberof_sudorule')
|
||||
|
||||
## cleanup
|
||||
## -------
|
||||
self.delete(group.ENTITY, [group.DATA, group.DATA2, group.DATA3, group.DATA4, group.DATA5])
|
||||
self.delete(user.ENTITY, [user.DATA])
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA])
|
||||
self.delete(rbac.ROLE_ENTITY, [rbac.ROLE_DATA])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
166
ipatests/test_webui/test_hbac.py
Normal file
166
ipatests/test_webui/test_hbac.py
Normal file
@@ -0,0 +1,166 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
HBAC tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_hbac as hbac
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_hbac(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: hbac
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.basic_crud(hbac.SVC_ENTITY, hbac.SVC_DATA)
|
||||
self.basic_crud(hbac.SVCGROUP_ENTITY, hbac.SVCGROUP_DATA,
|
||||
default_facet=hbac.SVCGROUP_DEF_FACET)
|
||||
|
||||
@screenshot
|
||||
def test_mod(self):
|
||||
"""
|
||||
Mod: hbac
|
||||
"""
|
||||
self.init_app()
|
||||
host_key = self.config.get('ipa_server').strip()
|
||||
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
|
||||
self.navigate_to_record(hbac.RULE_PKEY)
|
||||
|
||||
tables = [
|
||||
['memberuser_user', ['admin'], ],
|
||||
['memberuser_group', ['editors'], ],
|
||||
['memberhost_host', [host_key], ],
|
||||
['memberhost_hostgroup', [hostgroup.PKEY], ],
|
||||
['memberservice_hbacsvc', ['ftp'], ],
|
||||
['memberservice_hbacsvcgroup', ['Sudo'], ],
|
||||
]
|
||||
|
||||
categories = [
|
||||
'usercategory',
|
||||
'hostcategory',
|
||||
'servicecategory',
|
||||
]
|
||||
|
||||
self.mod_rule_tables(tables, categories, [])
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA])
|
||||
|
||||
@screenshot
|
||||
def test_actions(self):
|
||||
"""
|
||||
Test hbac rule actions
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.navigate_to_record(hbac.RULE_PKEY)
|
||||
|
||||
self.disable_action()
|
||||
self.enable_action()
|
||||
self.delete_action(hbac.RULE_ENTITY, hbac.RULE_PKEY)
|
||||
|
||||
@screenshot
|
||||
def test_hbac_test(self):
|
||||
"""
|
||||
Test HBAC test UI
|
||||
|
||||
Test:
|
||||
* basic functionality
|
||||
* navigation by next/prev buttons
|
||||
* navigation by facet tabs
|
||||
* resetting test
|
||||
"""
|
||||
|
||||
self.init_app()
|
||||
host_key = self.config.get('ipa_server').strip()
|
||||
|
||||
self.navigate_to_entity('hbactest', 'user')
|
||||
self.assert_facet('hbactest', 'user')
|
||||
self.select_record('admin')
|
||||
self.button_click('next')
|
||||
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_facet('hbactest', 'targethost')
|
||||
self.select_record(host_key)
|
||||
self.button_click('prev')
|
||||
self.assert_facet('hbactest', 'user')
|
||||
self.switch_to_facet('targethost')
|
||||
self.button_click('next')
|
||||
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_facet('hbactest', 'service')
|
||||
self.select_record('ftp')
|
||||
self.button_click('prev')
|
||||
self.assert_facet('hbactest', 'targethost')
|
||||
self.switch_to_facet('service')
|
||||
self.button_click('next')
|
||||
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_facet('hbactest', 'rules')
|
||||
self.select_record('allow_all')
|
||||
self.button_click('prev')
|
||||
self.assert_facet('hbactest', 'service')
|
||||
self.switch_to_facet('rules')
|
||||
self.button_click('next')
|
||||
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_facet('hbactest', 'run_test')
|
||||
self.button_click('run_test')
|
||||
self.wait_for_request(n=2)
|
||||
self.assert_text("div.hbac-test-result-panel p", 'Access Granted'.upper())
|
||||
self.button_click('prev')
|
||||
self.assert_facet('hbactest', 'rules')
|
||||
self.switch_to_facet('run_test')
|
||||
self.button_click('new_test')
|
||||
self.assert_facet('hbactest', 'user')
|
||||
|
||||
# test pre-run validation and navigation to related facet
|
||||
self.switch_to_facet('run_test')
|
||||
self.button_click('run_test')
|
||||
self.assert_dialog('message_dialog')
|
||||
self.click_on_link('User name')
|
||||
self.assert_facet('hbactest', 'user')
|
||||
|
||||
self.switch_to_facet('run_test')
|
||||
self.button_click('run_test')
|
||||
self.assert_dialog('message_dialog')
|
||||
self.click_on_link('Target host')
|
||||
self.assert_facet('hbactest', 'targethost')
|
||||
|
||||
self.switch_to_facet('run_test')
|
||||
self.button_click('run_test')
|
||||
self.assert_dialog('message_dialog')
|
||||
self.click_on_link('Service')
|
||||
self.assert_facet('hbactest', 'service')
|
||||
416
ipatests/test_webui/test_host.py
Normal file
416
ipatests/test_webui/test_host.py
Normal file
@@ -0,0 +1,416 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Host tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
import ipatests.test_webui.data_netgroup as netgroup
|
||||
import ipatests.test_webui.data_hbac as hbac
|
||||
import ipatests.test_webui.test_rbac as rbac
|
||||
import ipatests.test_webui.data_sudo as sudo
|
||||
import pytest
|
||||
|
||||
ENTITY = 'host'
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class host_tasks(UI_driver):
|
||||
|
||||
def setup(self, *args, **kwargs):
|
||||
super(host_tasks, self).setup(*args, **kwargs)
|
||||
self.prep_data()
|
||||
self.prep_data2()
|
||||
|
||||
def prep_data(self):
|
||||
host = 'itest'
|
||||
domain = self.config.get('ipa_domain')
|
||||
ip = self.get_ip()
|
||||
self.data = self.get_data(host, domain, ip)
|
||||
self.pkey = self.data['pkey']
|
||||
return self.data
|
||||
|
||||
def prep_data2(self):
|
||||
host = 'itest2'
|
||||
domain = self.config.get('ipa_domain')
|
||||
self.data2 = self.get_data(host, domain)
|
||||
self.pkey2 = self.data2['pkey']
|
||||
return self.data2
|
||||
|
||||
def get_data(self, host, domain, ip=None):
|
||||
if self.has_dns():
|
||||
add_data = [
|
||||
('textbox', 'hostname', host),
|
||||
('combobox', 'dnszone', domain+'.'),
|
||||
]
|
||||
if ip:
|
||||
add_data.append(('textbox', 'ip_address', ip))
|
||||
add_data.append(('checkbox', 'force', None))
|
||||
del_data = [
|
||||
('checkbox', 'updatedns', None)
|
||||
]
|
||||
else:
|
||||
add_data = [
|
||||
('textbox', 'fqdn', '%s.%s' % (host, domain)),
|
||||
('checkbox', 'force', None),
|
||||
]
|
||||
del_data = None
|
||||
|
||||
data = {
|
||||
'pkey': '%s.%s' % (host, domain),
|
||||
'add': add_data,
|
||||
'mod': [
|
||||
('textarea', 'description', 'Desc'),
|
||||
],
|
||||
'del': del_data,
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
def get_ip(self):
|
||||
"""
|
||||
Get next IP
|
||||
"""
|
||||
ip = self.config.get('ipa_ip')
|
||||
if not ip:
|
||||
self.skip('FreeIPA Server IP address not configured')
|
||||
ip = ip.split('.')
|
||||
last = int(ip.pop())
|
||||
ip.append(str(last + 1))
|
||||
return '.'.join(ip)
|
||||
|
||||
def load_file(self, path):
|
||||
with open(path, 'r') as file_d:
|
||||
content = file_d.read()
|
||||
return content
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_host(host_tasks):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: host
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(ENTITY, self.data)
|
||||
|
||||
@screenshot
|
||||
def test_certificates(self):
|
||||
"""
|
||||
Test host certificate actions
|
||||
|
||||
Requires to have CA installed and 'host_csr_path' configuration option
|
||||
set.
|
||||
"""
|
||||
|
||||
if not self.has_ca():
|
||||
self.skip('CA is not configured')
|
||||
|
||||
csr_path = self.config.get('host_csr_path')
|
||||
if not csr_path:
|
||||
self.skip('CSR file is not configured')
|
||||
|
||||
self.init_app()
|
||||
# ENHANCEMENT: generate csr dynamically
|
||||
csr = self.load_file(csr_path)
|
||||
cert_widget_sel = "div.certificate-widget"
|
||||
|
||||
self.add_record(ENTITY, self.data)
|
||||
self.navigate_to_record(self.pkey)
|
||||
|
||||
# cert request
|
||||
self.action_list_action('request_cert', confirm=False)
|
||||
self.assert_dialog()
|
||||
self.fill_text("textarea[name='csr']", csr)
|
||||
self.dialog_button_click('issue')
|
||||
self.wait_for_request(n=2, d=3)
|
||||
self.assert_visible(cert_widget_sel)
|
||||
|
||||
# cert view
|
||||
self.action_list_action('view', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert get
|
||||
self.action_list_action('get', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
# check that the textarea is not empty
|
||||
self.assert_empty_value('textarea.certificate', negative=True)
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert download - we can only try to click the download action
|
||||
self.action_list_action('download', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
|
||||
# check that revoke action is enabled
|
||||
self.assert_action_list_action('revoke',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action('remove_hold', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cert revoke
|
||||
self.action_list_action('revoke', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.wait()
|
||||
self.select('select', '6')
|
||||
self.dialog_button_click('ok')
|
||||
self.wait_for_request(n=2, d=3)
|
||||
self.assert_visible(cert_widget_sel + " div.watermark")
|
||||
|
||||
# check that revoke action is not enabled
|
||||
self.assert_action_list_action('revoke', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is enabled
|
||||
self.assert_action_list_action('remove_hold',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cert remove hold
|
||||
self.action_list_action('remove_hold', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.wait()
|
||||
self.dialog_button_click('ok')
|
||||
self.wait_for_request(n=2)
|
||||
|
||||
# check that revoke action is enabled
|
||||
self.assert_action_list_action('revoke',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action('remove_hold', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cleanup
|
||||
self.navigate_to_entity(ENTITY, 'search')
|
||||
self.delete_record(self.pkey, self.data.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_arbitrary_certificates(self):
|
||||
"""
|
||||
Test managing host arbitrary certificate.
|
||||
|
||||
Requires to have 'arbitrary_cert_path' configuration set.
|
||||
"""
|
||||
cert_path = self.config.get('arbitrary_cert_path')
|
||||
if not cert_path:
|
||||
self.skip('Arbitrary certificate file is not configured')
|
||||
|
||||
self.init_app()
|
||||
cert = self.load_file(cert_path)
|
||||
self.add_record(ENTITY, self.data)
|
||||
|
||||
self.navigate_to_record(self.pkey)
|
||||
|
||||
# check whether certificate section is present
|
||||
self.assert_visible("div[name='certificate']")
|
||||
|
||||
# add certificate
|
||||
self.button_click('add', parents_css_sel="div[name='certificate']")
|
||||
self.assert_dialog()
|
||||
self.fill_textarea('new_cert', cert)
|
||||
self.dialog_button_click('add')
|
||||
|
||||
self.assert_visible("div.certificate-widget")
|
||||
|
||||
# cert view
|
||||
self.action_list_action('view', confirm=False,
|
||||
parents_css_sel="div.certificate-widget")
|
||||
self.assert_dialog()
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert get
|
||||
self.action_list_action('get', confirm=False,
|
||||
parents_css_sel="div.certificate-widget")
|
||||
self.assert_dialog()
|
||||
|
||||
# check that the textarea is not empty
|
||||
self.assert_empty_value('textarea.certificate', negative=True)
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert download - we can only try to click the download action
|
||||
self.action_list_action('download', confirm=False,
|
||||
parents_css_sel="div.certificate-widget")
|
||||
|
||||
# check that revoke action is not enabled
|
||||
self.assert_action_list_action(
|
||||
'revoke', enabled=False,
|
||||
parents_css_sel="div.certificate-widget",
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action(
|
||||
'remove_hold', enabled=False,
|
||||
parents_css_sel="div.certificate-widget",
|
||||
facet_actions=False)
|
||||
|
||||
# cleanup
|
||||
self.navigate_to_entity(ENTITY, 'search')
|
||||
self.delete_record(self.pkey, self.data.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_ca_less(self):
|
||||
"""
|
||||
Test host certificate actions in CA-less install
|
||||
http://www.freeipa.org/page/V3/CA-less_install
|
||||
"""
|
||||
if self.has_ca():
|
||||
self.skip('CA is installed')
|
||||
|
||||
self.init_app()
|
||||
self.add_record(ENTITY, self.data)
|
||||
self.navigate_to_record(self.pkey)
|
||||
|
||||
self.assert_action_list_action('request_cert', visible=False)
|
||||
|
||||
self.navigate_by_breadcrumb('Hosts')
|
||||
self.delete_record(self.pkey, self.data.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_kerberos_flags(self):
|
||||
"""
|
||||
Test Kerberos flags
|
||||
http://www.freeipa.org/page/V3/Kerberos_Flags
|
||||
"""
|
||||
name = 'ipakrbokasdelegate'
|
||||
mod = {'mod': [('checkbox', name, None)]}
|
||||
checked = ['checked']
|
||||
|
||||
self.init_app()
|
||||
self.add_record(ENTITY, self.data)
|
||||
self.navigate_to_record(self.pkey)
|
||||
|
||||
if self.get_field_checked(name) == checked:
|
||||
self.mod_record(ENTITY, mod) # uncheck
|
||||
|
||||
self.mod_record(ENTITY, mod)
|
||||
self.validate_fields([('checkbox', name, checked)])
|
||||
self.mod_record(ENTITY, mod)
|
||||
self.validate_fields([('checkbox', name, [])])
|
||||
self.delete_record(self.pkey, self.data.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_associations(self):
|
||||
"""
|
||||
Host direct associations
|
||||
"""
|
||||
|
||||
self.init_app()
|
||||
|
||||
# prepare
|
||||
# -------
|
||||
self.add_record(ENTITY, self.data)
|
||||
self.add_record(ENTITY, self.data2, navigate=False)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
|
||||
# add & remove associations
|
||||
# -------------------------
|
||||
self.navigate_to_entity(ENTITY)
|
||||
self.navigate_to_record(self.pkey)
|
||||
|
||||
self.add_associations([hostgroup.PKEY], facet='memberof_hostgroup', delete=True)
|
||||
self.add_associations([netgroup.PKEY], facet='memberof_netgroup', delete=True)
|
||||
self.add_associations([rbac.ROLE_PKEY], facet='memberof_role', delete=True)
|
||||
self.add_associations([hbac.RULE_PKEY], facet='memberof_hbacrule', delete=True)
|
||||
self.add_associations([sudo.RULE_PKEY], facet='memberof_sudorule', delete=True)
|
||||
self.add_associations([self.pkey2], facet='managedby_host', delete=True)
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(ENTITY, [self.data, self.data2])
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA])
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA])
|
||||
self.delete(rbac.ROLE_ENTITY, [rbac.ROLE_DATA])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
|
||||
@screenshot
|
||||
def test_indirect_associations(self):
|
||||
"""
|
||||
Host indirect associations
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# add
|
||||
# ---
|
||||
self.add_record(ENTITY, self.data)
|
||||
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.navigate_to_record(hostgroup.PKEY)
|
||||
self.add_associations([self.pkey])
|
||||
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA2)
|
||||
self.navigate_to_record(hostgroup.PKEY2)
|
||||
self.switch_to_facet('member_hostgroup')
|
||||
self.add_associations([hostgroup.PKEY])
|
||||
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
self.navigate_to_record(netgroup.PKEY)
|
||||
self.add_table_associations('memberhost_hostgroup', [hostgroup.PKEY2])
|
||||
|
||||
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
|
||||
self.navigate_to_record(rbac.ROLE_PKEY)
|
||||
self.switch_to_facet('member_hostgroup')
|
||||
self.add_associations([hostgroup.PKEY2])
|
||||
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.navigate_to_record(hbac.RULE_PKEY)
|
||||
self.add_table_associations('memberhost_hostgroup', [hostgroup.PKEY2])
|
||||
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
self.navigate_to_record(sudo.RULE_PKEY)
|
||||
self.add_table_associations('memberhost_hostgroup', [hostgroup.PKEY2])
|
||||
|
||||
# check indirect associations
|
||||
# ---------------------------
|
||||
self.navigate_to_entity(ENTITY, 'search')
|
||||
self.navigate_to_record(self.pkey)
|
||||
|
||||
self.assert_indirect_record(hostgroup.PKEY2, ENTITY, 'memberof_hostgroup')
|
||||
self.assert_indirect_record(netgroup.PKEY, ENTITY, 'memberof_netgroup')
|
||||
self.assert_indirect_record(rbac.ROLE_PKEY, ENTITY, 'memberof_role')
|
||||
self.assert_indirect_record(hbac.RULE_PKEY, ENTITY, 'memberof_hbacrule')
|
||||
self.assert_indirect_record(sudo.RULE_PKEY, ENTITY, 'memberof_sudorule')
|
||||
|
||||
## cleanup
|
||||
## -------
|
||||
self.delete(ENTITY, [self.data])
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2])
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA])
|
||||
self.delete(rbac.ROLE_ENTITY, [rbac.ROLE_DATA])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
148
ipatests/test_webui/test_hostgroup.py
Normal file
148
ipatests/test_webui/test_hostgroup.py
Normal file
@@ -0,0 +1,148 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Hostgroup tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
from ipatests.test_webui.test_host import host_tasks, ENTITY as HOST_ENTITY
|
||||
import ipatests.test_webui.data_netgroup as netgroup
|
||||
import ipatests.test_webui.data_hbac as hbac
|
||||
import ipatests.test_webui.data_sudo as sudo
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_hostgroup(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: hostgroup
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(hostgroup.ENTITY, hostgroup.DATA,
|
||||
default_facet=hostgroup.DEFAULT_FACET)
|
||||
|
||||
@screenshot
|
||||
def test_associations(self):
|
||||
"""
|
||||
Hostgroup associations
|
||||
"""
|
||||
self.init_app()
|
||||
host = host_tasks()
|
||||
host.setup(self.driver, self.config)
|
||||
|
||||
# prepare
|
||||
# -------
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA2, navigate=False)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA3, navigate=False)
|
||||
self.add_record(HOST_ENTITY, host.data2)
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
|
||||
# add & remove associations
|
||||
# -------------------------
|
||||
self.navigate_to_entity(hostgroup.ENTITY)
|
||||
self.navigate_to_record(hostgroup.PKEY)
|
||||
|
||||
# members
|
||||
self.add_associations([hostgroup.PKEY2], facet='member_hostgroup', delete=True)
|
||||
self.add_associations([host.pkey2], facet='member_host', delete=True)
|
||||
|
||||
# member of
|
||||
self.add_associations([hostgroup.PKEY3], facet='memberof_hostgroup', delete=True)
|
||||
self.add_associations([netgroup.PKEY], facet='memberof_netgroup', delete=True)
|
||||
self.add_associations([hbac.RULE_PKEY], facet='memberof_hbacrule', delete=True)
|
||||
self.add_associations([sudo.RULE_PKEY], facet='memberof_sudorule', delete=True)
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2, hostgroup.DATA3])
|
||||
self.delete(HOST_ENTITY, [host.data2])
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
|
||||
@screenshot
|
||||
def test_indirect_associations(self):
|
||||
"""
|
||||
Hostgroup indirect associations
|
||||
"""
|
||||
self.init_app()
|
||||
host = host_tasks()
|
||||
host.setup(self.driver, self.config)
|
||||
|
||||
# add
|
||||
# ---
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA2, navigate=False)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA3, navigate=False)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA4, navigate=False)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA5, navigate=False)
|
||||
self.add_record(HOST_ENTITY, host.data2)
|
||||
|
||||
# prepare indirect member
|
||||
self.navigate_to_entity(hostgroup.ENTITY, 'search')
|
||||
self.navigate_to_record(hostgroup.PKEY2)
|
||||
self.add_associations([host.pkey2])
|
||||
self.add_associations([hostgroup.PKEY3], 'member_hostgroup')
|
||||
|
||||
self.navigate_to_entity(hostgroup.ENTITY, 'search')
|
||||
self.navigate_to_record(hostgroup.PKEY)
|
||||
self.add_associations([hostgroup.PKEY2], 'member_hostgroup')
|
||||
|
||||
# prepare indirect memberof
|
||||
self.navigate_to_entity(hostgroup.ENTITY, 'search')
|
||||
self.navigate_to_record(hostgroup.PKEY4)
|
||||
self.add_associations([hostgroup.PKEY], 'member_hostgroup')
|
||||
self.add_associations([hostgroup.PKEY5], 'memberof_hostgroup')
|
||||
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.navigate_to_record(hbac.RULE_PKEY)
|
||||
self.add_table_associations('memberhost_hostgroup', [hostgroup.PKEY4])
|
||||
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
self.navigate_to_record(sudo.RULE_PKEY)
|
||||
self.add_table_associations('memberhost_hostgroup', [hostgroup.PKEY4])
|
||||
|
||||
# check indirect associations
|
||||
# ---------------------------
|
||||
self.navigate_to_entity(hostgroup.ENTITY, 'search')
|
||||
self.navigate_to_record(hostgroup.PKEY)
|
||||
|
||||
self.assert_indirect_record(hostgroup.PKEY3, hostgroup.ENTITY, 'member_hostgroup')
|
||||
self.assert_indirect_record(host.pkey2, hostgroup.ENTITY, 'member_host')
|
||||
|
||||
self.assert_indirect_record(hostgroup.PKEY5, hostgroup.ENTITY, 'memberof_hostgroup')
|
||||
self.assert_indirect_record(hbac.RULE_PKEY, hostgroup.ENTITY, 'memberof_hbacrule')
|
||||
self.assert_indirect_record(sudo.RULE_PKEY, hostgroup.ENTITY, 'memberof_sudorule')
|
||||
|
||||
## cleanup
|
||||
## -------
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2,
|
||||
hostgroup.DATA3, hostgroup.DATA4, hostgroup.DATA5])
|
||||
self.delete(HOST_ENTITY, [host.data2])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
126
ipatests/test_webui/test_idviews.py
Normal file
126
ipatests/test_webui/test_idviews.py
Normal file
@@ -0,0 +1,126 @@
|
||||
#
|
||||
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_idviews as idview
|
||||
import ipatests.test_webui.data_user as user
|
||||
import ipatests.test_webui.data_group as group
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
from ipatests.test_webui.test_host import host_tasks, ENTITY as HOST_ENTITY
|
||||
import pytest
|
||||
|
||||
DATA_USER = {
|
||||
'pkey': user.PKEY,
|
||||
'add': [
|
||||
('combobox', 'ipaanchoruuid', user.PKEY),
|
||||
('textbox', 'uid', 'iduser'),
|
||||
('textbox', 'gecos', 'id user'),
|
||||
('textbox', 'uidnumber', 1),
|
||||
('textbox', 'gidnumber', 1),
|
||||
('textbox', 'loginshell', 'shell'),
|
||||
('textbox', 'homedirectory', 'home'),
|
||||
('textarea', 'description', 'desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'uid', 'moduser'),
|
||||
('textbox', 'uidnumber', 3),
|
||||
],
|
||||
}
|
||||
|
||||
DATA_GROUP = {
|
||||
'pkey': group.PKEY,
|
||||
'add': [
|
||||
('combobox', 'ipaanchoruuid', group.PKEY),
|
||||
('textbox', 'cn', 'idgroup'),
|
||||
('textbox', 'gidnumber', 2),
|
||||
('textarea', 'description', 'desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'cn', 'modgroup'),
|
||||
('textbox', 'gidnumber', 3),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_idviews(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: ID view
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(
|
||||
idview.ENTITY, idview.DATA, default_facet=idview.USER_FACET)
|
||||
|
||||
@screenshot
|
||||
def test_overrides(self):
|
||||
"""
|
||||
User and group overrides
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
self.add_record(user.ENTITY, user.DATA, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.add_record(idview.ENTITY, idview.DATA)
|
||||
|
||||
self.navigate_to_record(idview.PKEY)
|
||||
parent_entity = 'idview'
|
||||
|
||||
# user override
|
||||
self.add_record(parent_entity, DATA_USER, facet=idview.USER_FACET)
|
||||
self.navigate_to_record(user.PKEY)
|
||||
self.mod_record(idview.USER_FACET, DATA_USER)
|
||||
self.delete_action(idview.ENTITY, user.PKEY)
|
||||
|
||||
# group override
|
||||
self.navigate_to_record(idview.PKEY)
|
||||
self.switch_to_facet(idview.GROUP_FACET)
|
||||
self.add_record(parent_entity, DATA_GROUP, facet=idview.GROUP_FACET)
|
||||
self.navigate_to_record(group.PKEY)
|
||||
self.mod_record(idview.GROUP_FACET, DATA_GROUP)
|
||||
self.delete_action(idview.ENTITY, group.PKEY)
|
||||
|
||||
# cleanup
|
||||
self.delete(idview.ENTITY, [idview.DATA])
|
||||
self.delete(user.ENTITY, [user.DATA])
|
||||
self.delete(group.ENTITY, [group.DATA])
|
||||
|
||||
@screenshot
|
||||
def test_hosts(self):
|
||||
"""
|
||||
Apply to hosts and host groups
|
||||
"""
|
||||
self.init_app()
|
||||
host = host_tasks()
|
||||
host.setup(self.driver, self.config)
|
||||
|
||||
self.add_record(HOST_ENTITY, host.data)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.navigate_to_record(hostgroup.PKEY)
|
||||
self.add_associations([host.pkey])
|
||||
self.add_record(idview.ENTITY, idview.DATA)
|
||||
|
||||
self.navigate_to_record(idview.PKEY)
|
||||
self.switch_to_facet(idview.HOST_FACET)
|
||||
|
||||
# apply to host
|
||||
self.add_associations(
|
||||
[host.pkey], facet='appliedtohosts', facet_btn='idview_apply')
|
||||
self.delete_record([host.pkey], facet_btn='idview_unapply')
|
||||
|
||||
# apply to hostgroup
|
||||
self.add_associations(
|
||||
[hostgroup.PKEY], facet_btn='idview_apply_hostgroups',
|
||||
member_pkeys=[host.pkey])
|
||||
self.delete_associations(
|
||||
[hostgroup.PKEY], facet_btn='idview_unapply_hostgroups',
|
||||
member_pkeys=[host.pkey])
|
||||
|
||||
# cleanup
|
||||
self.delete(idview.ENTITY, [idview.DATA])
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA])
|
||||
self.delete(HOST_ENTITY, [host.data])
|
||||
57
ipatests/test_webui/test_krbtpolicy.py
Normal file
57
ipatests/test_webui/test_krbtpolicy.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Kerberos policy tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'krbtpolicy'
|
||||
|
||||
DATA = {
|
||||
'mod': [
|
||||
('textbox', 'krbmaxrenewableage', '599000'),
|
||||
('textbox', 'krbmaxticketlife', '79800'),
|
||||
],
|
||||
}
|
||||
|
||||
DATA2 = {
|
||||
'mod': [
|
||||
('textbox', 'krbmaxrenewableage', '604800'),
|
||||
('textbox', 'krbmaxticketlife', '86400'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_krbtpolicy(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_mod(self):
|
||||
"""
|
||||
Kerberos policy mod test
|
||||
"""
|
||||
self.init_app()
|
||||
self.navigate_to_entity(ENTITY)
|
||||
|
||||
self.mod_record(ENTITY, DATA)
|
||||
self.mod_record(ENTITY, DATA2)
|
||||
179
ipatests/test_webui/test_navigation.py
Normal file
179
ipatests/test_webui/test_navigation.py
Normal file
@@ -0,0 +1,179 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Basic ui tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
|
||||
ENTITIES = [
|
||||
'group',
|
||||
'user',
|
||||
'host',
|
||||
'hostgroup',
|
||||
'netgroup',
|
||||
'service',
|
||||
'dnszone',
|
||||
'dnsforwardzone',
|
||||
# TODO: dnsrecord
|
||||
'dnsconfig',
|
||||
'cert',
|
||||
'otptoken',
|
||||
'radiusproxy',
|
||||
'realmdomains',
|
||||
'hbacrule',
|
||||
'hbacsvc',
|
||||
'hbacsvcgroup',
|
||||
'hbactest',
|
||||
'sudorule',
|
||||
'sudocmd',
|
||||
'sudocmdgroup',
|
||||
'automountlocation',
|
||||
# TODO: add nested maps, keys
|
||||
'pwpolicy',
|
||||
'krbtpolicy',
|
||||
'selinuxusermap',
|
||||
'automember',
|
||||
# TODO: add different types
|
||||
'role',
|
||||
'privilege',
|
||||
'permission',
|
||||
'selfservice',
|
||||
'delegation',
|
||||
'idrange',
|
||||
'config',
|
||||
# TODO: add conditional
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_navigation(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_url_navigation(self):
|
||||
"""
|
||||
Navigation test: direct url change
|
||||
"""
|
||||
|
||||
self.init_app()
|
||||
|
||||
unsupported = []
|
||||
if not self.has_dns():
|
||||
unsupported.extend([
|
||||
'dnszone',
|
||||
'dnsforwardzone',
|
||||
'dnsconfig',
|
||||
])
|
||||
if not self.has_ca():
|
||||
unsupported.append('cert')
|
||||
|
||||
entities = [e for e in ENTITIES if e not in unsupported]
|
||||
|
||||
for e in entities:
|
||||
self.wait_for_request()
|
||||
self.navigate_to_entity(e)
|
||||
self.assert_facet(e)
|
||||
url = self.get_url(e)
|
||||
self.assert_e_url(url, e)
|
||||
|
||||
@screenshot
|
||||
def test_menu_navigation(self):
|
||||
"""
|
||||
Navigation test: menu items
|
||||
"""
|
||||
|
||||
self.init_app()
|
||||
|
||||
# Identity
|
||||
# don't start by users (default)
|
||||
self.navigate_by_menu('identity/group', False)
|
||||
self.navigate_by_menu('identity/user_search', False)
|
||||
self.navigate_by_menu('identity/host', False)
|
||||
self.navigate_by_menu('identity/hostgroup', False)
|
||||
self.navigate_by_menu('identity/netgroup', False)
|
||||
self.navigate_by_menu('identity/service', False)
|
||||
self.navigate_by_menu('identity/automember', False)
|
||||
self.navigate_by_menu('identity/automember/amhostgroup')
|
||||
self.navigate_by_menu('identity/automember/amgroup')
|
||||
|
||||
# Policy
|
||||
self.navigate_by_menu('policy')
|
||||
self.navigate_by_menu('policy/hbac', False)
|
||||
self.navigate_by_menu('policy/hbac/hbacsvc', False)
|
||||
self.navigate_by_menu('policy/hbac/hbacrule')
|
||||
self.navigate_by_menu('policy/hbac/hbacsvcgroup')
|
||||
self.navigate_by_menu('policy/hbac/hbactest')
|
||||
self.navigate_by_menu('policy/sudo', False)
|
||||
self.navigate_by_menu('policy/sudo/sudorule', False)
|
||||
self.navigate_by_menu('policy/sudo/sudocmd')
|
||||
self.navigate_by_menu('policy/sudo/sudocmdgroup')
|
||||
self.navigate_by_menu('policy/selinuxusermap', False)
|
||||
self.navigate_by_menu('policy/pwpolicy', False)
|
||||
self.navigate_by_menu('policy/krbtpolicy', False)
|
||||
|
||||
# Authentication
|
||||
self.navigate_by_menu('authentication')
|
||||
self.navigate_by_menu('authentication/radiusproxy', False)
|
||||
self.navigate_by_menu('authentication/otptoken', False)
|
||||
if self.has_ca():
|
||||
self.navigate_by_menu('authentication/cert_search', False)
|
||||
else:
|
||||
self.assert_menu_item('authentication/cert_search', False)
|
||||
|
||||
# Network Services
|
||||
self.navigate_by_menu('network_services')
|
||||
self.navigate_by_menu('network_services/automount')
|
||||
if self.has_dns():
|
||||
self.navigate_by_menu('network_services/dns/dnsconfig', True)
|
||||
self.navigate_by_menu('network_services/dns', False)
|
||||
self.navigate_by_menu('network_services/dns/dnszone', False)
|
||||
self.navigate_by_menu('network_services/dns/dnsforwardzone')
|
||||
else:
|
||||
self.assert_menu_item('network_services/dns', False)
|
||||
|
||||
# IPA Server
|
||||
self.navigate_by_menu('ipaserver')
|
||||
self.navigate_by_menu('ipaserver/rbac', False)
|
||||
self.navigate_by_menu('ipaserver/rbac/privilege', False)
|
||||
self.navigate_by_menu('ipaserver/rbac/role')
|
||||
self.navigate_by_menu('ipaserver/rbac/permission')
|
||||
self.navigate_by_menu('ipaserver/rbac/selfservice')
|
||||
self.navigate_by_menu('ipaserver/rbac/delegation')
|
||||
self.navigate_by_menu('ipaserver/idrange', False)
|
||||
self.navigate_by_menu('ipaserver/realmdomains', False)
|
||||
if self.has_trusts():
|
||||
self.navigate_by_menu('ipaserver/trusts', False)
|
||||
self.navigate_by_menu('ipaserver/trusts/trust', False)
|
||||
self.navigate_by_menu('ipaserver/trusts/trustconfig')
|
||||
else:
|
||||
self.assert_menu_item('ipaserver/trusts', False)
|
||||
self.navigate_by_menu('ipaserver/config', False)
|
||||
|
||||
|
||||
def assert_e_url(self, url, e):
|
||||
"""
|
||||
Assert correct url for entity
|
||||
"""
|
||||
if not self.driver.current_url.startswith(url):
|
||||
msg = 'Invalid url for: %s' % e
|
||||
raise AssertionError(msg)
|
||||
87
ipatests/test_webui/test_netgroup.py
Normal file
87
ipatests/test_webui/test_netgroup.py
Normal file
@@ -0,0 +1,87 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Netgroup tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_netgroup as netgroup
|
||||
import ipatests.test_webui.data_user as user
|
||||
import ipatests.test_webui.data_group as group
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
from ipatests.test_webui.test_host import host_tasks, ENTITY as HOST_ENTITY
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_netgroup(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: netgroup
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(netgroup.ENTITY, netgroup.DATA)
|
||||
|
||||
@screenshot
|
||||
def test_mod(self):
|
||||
"""
|
||||
Mod: netgroup
|
||||
"""
|
||||
self.init_app()
|
||||
host = host_tasks()
|
||||
host.setup(self.driver, self.config)
|
||||
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA2)
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
self.add_record(user.ENTITY, user.DATA2, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.add_record(group.ENTITY, group.DATA2, navigate=False)
|
||||
self.add_record(HOST_ENTITY, host.data)
|
||||
self.add_record(HOST_ENTITY, host.data2, navigate=False)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA2, navigate=False)
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
|
||||
self.navigate_to_record(netgroup.PKEY, entity=netgroup.ENTITY)
|
||||
|
||||
tables = [
|
||||
['memberuser_user', [user.PKEY, user.PKEY2], ],
|
||||
['memberuser_group', [group.PKEY, group.PKEY2], ],
|
||||
['memberhost_host', [host.pkey, host.pkey2], ],
|
||||
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2], ],
|
||||
]
|
||||
|
||||
categories = [
|
||||
'usercategory',
|
||||
'hostcategory',
|
||||
]
|
||||
|
||||
self.mod_rule_tables(tables, categories, [])
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA, netgroup.DATA2])
|
||||
self.delete(user.ENTITY, [user.DATA, user.DATA2])
|
||||
self.delete(group.ENTITY, [group.DATA, group.DATA2])
|
||||
self.delete(HOST_ENTITY, [host.data, host.data2])
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2])
|
||||
57
ipatests/test_webui/test_pwpolicy.py
Normal file
57
ipatests/test_webui/test_pwpolicy.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Password policy tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'pwpolicy'
|
||||
DATA = {
|
||||
'pkey': 'admins',
|
||||
'add': [
|
||||
('combobox', 'cn', 'admins'),
|
||||
('textbox', 'cospriority', '364'),
|
||||
],
|
||||
'mod': [
|
||||
('textbox', 'krbmaxpwdlife', '3000'),
|
||||
('textbox', 'krbminpwdlife', '1'),
|
||||
('textbox', 'krbpwdhistorylength', '0'),
|
||||
('textbox', 'krbpwdmindiffchars', '2'),
|
||||
('textbox', 'krbpwdminlength', '2'),
|
||||
('textbox', 'krbpwdmaxfailure', '15'),
|
||||
('textbox', 'krbpwdfailurecountinterval', '5'),
|
||||
('textbox', 'krbpwdlockoutduration', '3600'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_pwpolicy(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: pwpolicy
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(ENTITY, DATA)
|
||||
89
ipatests/test_webui/test_range.py
Normal file
89
ipatests/test_webui/test_range.py
Normal file
@@ -0,0 +1,89 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Range tests
|
||||
"""
|
||||
|
||||
import ipatests.test_webui.test_trust as trust_mod
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
from ipatests.test_webui.task_range import range_tasks
|
||||
import pytest
|
||||
|
||||
ENTITY = 'idrange'
|
||||
PKEY = 'itest-range'
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_range(range_tasks):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: range
|
||||
"""
|
||||
self.init_app()
|
||||
self.get_shifts()
|
||||
self.basic_crud(ENTITY, self.get_data(PKEY))
|
||||
|
||||
@screenshot
|
||||
def test_types(self):
|
||||
"""
|
||||
Test range types
|
||||
|
||||
Only 'local' and 'ipa-ad-trust' types are tested since range validation
|
||||
made quite hard to test the other types:
|
||||
|
||||
- 'ipa-ad-trust-posix' can be tested only with subdomains.
|
||||
- 'ipa-ad-winsync' and 'ipa-ipa-trust' and are not supported yet
|
||||
https://fedorahosted.org/freeipa/ticket/4323
|
||||
"""
|
||||
self.init_app()
|
||||
self.get_shifts()
|
||||
|
||||
pkey_local = 'itest-local'
|
||||
pkey_ad = 'itest-ad'
|
||||
column = 'iparangetype'
|
||||
|
||||
add = self.get_add_data(pkey_local)
|
||||
data = self.get_data(pkey_local, add_data=add)
|
||||
self.add_record(ENTITY, data)
|
||||
self.assert_record_value('local domain range', pkey_local, column)
|
||||
|
||||
if self.has_trusts():
|
||||
|
||||
trust_tasks = trust_mod.trust_tasks()
|
||||
trust_data = trust_tasks.get_data()
|
||||
|
||||
self.add_record(trust_mod.ENTITY, trust_data)
|
||||
|
||||
domain = self.get_domain()
|
||||
|
||||
self.navigate_to_entity(ENTITY)
|
||||
|
||||
add = self.get_add_data(pkey_ad, range_type='ipa-ad-trust', domain=domain)
|
||||
data = self.get_data(pkey_ad, add_data=add)
|
||||
self.add_record(ENTITY, data, navigate=False)
|
||||
self.assert_record_value('Active Directory domain range', pkey_ad, column)
|
||||
|
||||
self.delete(trust_mod.ENTITY, [trust_data])
|
||||
self.navigate_to_entity(ENTITY)
|
||||
self.delete_record(pkey_ad)
|
||||
|
||||
self.delete_record(pkey_local)
|
||||
91
ipatests/test_webui/test_rbac.py
Normal file
91
ipatests/test_webui/test_rbac.py
Normal file
@@ -0,0 +1,91 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
RBAC tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ROLE_ENTITY = 'role'
|
||||
ROLE_DEF_FACET = 'member_user'
|
||||
ROLE_PKEY = 'AAtest_role'
|
||||
ROLE_DATA = {
|
||||
'pkey': ROLE_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', ROLE_PKEY),
|
||||
('textarea', 'description', 'role desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'role desc mod'),
|
||||
],
|
||||
}
|
||||
|
||||
PRIVILEGE_ENTITY = 'privilege'
|
||||
PRIVILEGE_DEF_FACET = 'memberof_permission'
|
||||
PRIVILEGE_PKEY = 'AAtest_privilege'
|
||||
PRIVILEGE_DATA = {
|
||||
'pkey': PRIVILEGE_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', PRIVILEGE_PKEY),
|
||||
('textarea', 'description', 'privilege desc'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'privilege desc mod'),
|
||||
],
|
||||
}
|
||||
|
||||
PERMISSION_ENTITY = 'permission'
|
||||
PERMISSION_PKEY = 'AAtest_perm'
|
||||
PERMISSION_DATA = {
|
||||
'pkey': PERMISSION_PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', PERMISSION_PKEY),
|
||||
('checkbox', 'ipapermright', 'write'),
|
||||
('checkbox', 'ipapermright', 'read'),
|
||||
('selectbox', 'type', 'user'),
|
||||
('checkbox', 'attrs', 'audio'),
|
||||
('checkbox', 'attrs', 'cn'),
|
||||
],
|
||||
'mod': [
|
||||
('checkbox', 'attrs', 'carlicense'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_rbac(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: RBAC
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(ROLE_ENTITY, ROLE_DATA,
|
||||
default_facet=ROLE_DEF_FACET
|
||||
)
|
||||
|
||||
self.basic_crud(PRIVILEGE_ENTITY, PRIVILEGE_DATA,
|
||||
default_facet=PRIVILEGE_DEF_FACET
|
||||
)
|
||||
|
||||
self.basic_crud(PERMISSION_ENTITY, PERMISSION_DATA)
|
||||
53
ipatests/test_webui/test_realmdomains.py
Normal file
53
ipatests/test_webui/test_realmdomains.py
Normal file
@@ -0,0 +1,53 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Realm domains tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'realmdomains'
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_realmdomains(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_read(self):
|
||||
"""
|
||||
Realm domains mod tests
|
||||
"""
|
||||
self.init_app()
|
||||
self.navigate_to_entity(ENTITY)
|
||||
|
||||
# add
|
||||
self.add_multivalued('associateddomain', 'itest.bar')
|
||||
self.facet_button_click('save')
|
||||
self.dialog_button_click('force')
|
||||
self.wait_for_request()
|
||||
|
||||
# delete
|
||||
self.del_multivalued('associateddomain', 'itest.bar')
|
||||
self.facet_button_click('save')
|
||||
self.dialog_button_click('force')
|
||||
self.wait_for_request()
|
||||
self.wait_for_request()
|
||||
52
ipatests/test_webui/test_selfservice.py
Normal file
52
ipatests/test_webui/test_selfservice.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Selfservice tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'selfservice'
|
||||
PKEY = 'itest-selfservice-rule'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'aciname', PKEY),
|
||||
('checkbox', 'attrs', 'audio'),
|
||||
('checkbox', 'attrs', 'businesscategory'),
|
||||
],
|
||||
'mod': [
|
||||
('checkbox', 'attrs', 'businesscategory'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_selfservice(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: selfservice entity
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(ENTITY, DATA)
|
||||
112
ipatests/test_webui/test_selinuxusermap.py
Normal file
112
ipatests/test_webui/test_selinuxusermap.py
Normal file
@@ -0,0 +1,112 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
SELinux user map tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_user as user
|
||||
import ipatests.test_webui.data_group as group
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
from ipatests.test_webui.test_host import host_tasks, ENTITY as HOST_ENTITY
|
||||
import pytest
|
||||
|
||||
ENTITY = 'selinuxusermap'
|
||||
PKEY = 'itest-selinuxusermap'
|
||||
DATA = {
|
||||
'pkey': PKEY,
|
||||
'add': [
|
||||
('textbox', 'cn', PKEY),
|
||||
('textbox', 'ipaselinuxuser', 'user_u:s0'),
|
||||
],
|
||||
'mod': [
|
||||
('textarea', 'description', 'itest-selinuxusermap desc'),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_selinuxusermap(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: selinuxusermap
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(ENTITY, DATA)
|
||||
|
||||
@screenshot
|
||||
def test_mod(self):
|
||||
"""
|
||||
Mod: selinuxusermap
|
||||
"""
|
||||
self.init_app()
|
||||
host = host_tasks()
|
||||
host.setup(self.driver, self.config)
|
||||
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
self.add_record(user.ENTITY, user.DATA2, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.add_record(group.ENTITY, group.DATA2, navigate=False)
|
||||
self.add_record(HOST_ENTITY, host.data)
|
||||
self.add_record(HOST_ENTITY, host.data2, navigate=False)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA2, navigate=False)
|
||||
self.add_record(ENTITY, DATA)
|
||||
|
||||
self.navigate_to_record(PKEY)
|
||||
|
||||
tables = [
|
||||
['memberuser_user', [user.PKEY, user.PKEY2], ],
|
||||
['memberuser_group', [group.PKEY, group.PKEY2], ],
|
||||
['memberhost_host', [host.pkey, host.pkey2], ],
|
||||
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2], ],
|
||||
]
|
||||
|
||||
categories = [
|
||||
'usercategory',
|
||||
'hostcategory',
|
||||
]
|
||||
|
||||
self.mod_rule_tables(tables, categories, [])
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(ENTITY, [DATA])
|
||||
self.delete(user.ENTITY, [user.DATA, user.DATA2])
|
||||
self.delete(group.ENTITY, [group.DATA, group.DATA2])
|
||||
self.delete(HOST_ENTITY, [host.data, host.data2])
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2])
|
||||
|
||||
@screenshot
|
||||
def test_actions(self):
|
||||
"""
|
||||
Test SELinux user map actions
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
self.add_record(ENTITY, DATA)
|
||||
self.navigate_to_record(PKEY)
|
||||
|
||||
self.disable_action()
|
||||
self.enable_action()
|
||||
self.delete_action(ENTITY, PKEY)
|
||||
282
ipatests/test_webui/test_service.py
Normal file
282
ipatests/test_webui/test_service.py
Normal file
@@ -0,0 +1,282 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Service tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import pytest
|
||||
|
||||
ENTITY = 'service'
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class sevice_tasks(UI_driver):
|
||||
|
||||
def prep_data(self):
|
||||
|
||||
host = self.config.get('ipa_server')
|
||||
realm = self.config.get('ipa_realm')
|
||||
pkey = 'itest'
|
||||
|
||||
return {
|
||||
'pkey': '%s/%s@%s' % (pkey, host, realm),
|
||||
'add': [
|
||||
('textbox', 'service', pkey),
|
||||
('combobox', 'host', host)
|
||||
],
|
||||
'mod': [
|
||||
('checkbox', 'ipakrbokasdelegate', None),
|
||||
],
|
||||
}
|
||||
|
||||
def load_file(self, path):
|
||||
# ENHANCEMENT: generate csr dynamically
|
||||
with open(path, 'r') as file_d:
|
||||
content = file_d.read()
|
||||
return content
|
||||
|
||||
def get_http_pkey(self):
|
||||
host = self.config.get('ipa_server')
|
||||
realm = self.config.get('ipa_realm')
|
||||
pkey = 'HTTP/%s@%s' % (host, realm)
|
||||
return pkey
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_service(sevice_tasks):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: service
|
||||
"""
|
||||
self.init_app()
|
||||
data = self.prep_data()
|
||||
self.basic_crud(ENTITY, data)
|
||||
|
||||
@screenshot
|
||||
def test_certificates(self):
|
||||
"""
|
||||
Test service certificate actions
|
||||
|
||||
Requires to have CA installed and 'service_csr_path' configuration option
|
||||
set.
|
||||
"""
|
||||
|
||||
if not self.has_ca():
|
||||
self.skip('CA is not configured')
|
||||
|
||||
csr_path = self.config.get('service_csr_path')
|
||||
if not csr_path:
|
||||
self.skip('CSR file is not configured')
|
||||
|
||||
self.init_app()
|
||||
data = self.prep_data()
|
||||
pkey = data.get('pkey')
|
||||
csr = self.load_file(csr_path)
|
||||
cert_widget_sel = "div.certificate-widget"
|
||||
|
||||
self.add_record(ENTITY, data)
|
||||
self.navigate_to_record(pkey)
|
||||
|
||||
# cert request
|
||||
self.action_list_action('request_cert', confirm=False)
|
||||
self.assert_dialog()
|
||||
self.fill_text("textarea[name='csr'", csr)
|
||||
self.dialog_button_click('issue')
|
||||
self.wait_for_request(n=2, d=3)
|
||||
self.assert_visible(cert_widget_sel)
|
||||
|
||||
# cert view
|
||||
self.action_list_action('view', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert get
|
||||
self.action_list_action('get', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
# check that text area is not empty
|
||||
self.assert_empty_value('textarea.certificate', negative=True)
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert download - we can only try to click the download action
|
||||
self.action_list_action('download', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
# check that revoke action is enabled
|
||||
self.assert_action_list_action('revoke',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action('remove_hold', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cert revoke
|
||||
self.action_list_action('revoke', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.wait()
|
||||
self.select('select', '6')
|
||||
self.dialog_button_click('ok')
|
||||
self.wait_for_request(n=2, d=3)
|
||||
self.assert_visible(cert_widget_sel + " div.watermark")
|
||||
|
||||
# check that revoke action is not enabled
|
||||
self.assert_action_list_action('revoke', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is enabled
|
||||
self.assert_action_list_action('remove_hold',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cert remove hold
|
||||
self.action_list_action('remove_hold', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.wait()
|
||||
self.dialog_button_click('ok')
|
||||
self.wait_for_request(n=2)
|
||||
|
||||
# check that revoke action is enabled
|
||||
self.assert_action_list_action('revoke',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action('remove_hold', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cleanup
|
||||
self.navigate_to_entity(ENTITY, 'search')
|
||||
self.delete_record(pkey, data.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_arbitrary_certificates(self):
|
||||
"""
|
||||
Test managing service arbitrary certificate.
|
||||
|
||||
Requires to have 'arbitrary_cert_path' configuration set.
|
||||
"""
|
||||
cert_path = self.config.get('arbitrary_cert_path')
|
||||
if not cert_path:
|
||||
self.skip('Arbitrary certificate file is not configured')
|
||||
|
||||
self.init_app()
|
||||
data = self.prep_data()
|
||||
pkey = data.get('pkey')
|
||||
cert = self.load_file(cert_path)
|
||||
cert_widget_sel = "div.certificate-widget"
|
||||
|
||||
self.add_record(ENTITY, data)
|
||||
self.navigate_to_record(pkey)
|
||||
|
||||
# check whether certificate section is present
|
||||
self.assert_visible("div[name='certificate']")
|
||||
|
||||
# add certificate
|
||||
self.button_click('add', parents_css_sel="div[name='certificate']")
|
||||
self.assert_dialog()
|
||||
self.fill_textarea('new_cert', cert)
|
||||
self.dialog_button_click('add')
|
||||
|
||||
self.assert_visible(cert_widget_sel)
|
||||
|
||||
# cert view
|
||||
self.action_list_action('view', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert get
|
||||
self.action_list_action('get', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
|
||||
# check that the textarea is not empty
|
||||
self.assert_empty_value('textarea.certificate', negative=True)
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert download - we can only try to click the download action
|
||||
self.action_list_action('download', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
|
||||
# check that revoke action is not enabled
|
||||
self.assert_action_list_action('revoke', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action('remove_hold', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cleanup
|
||||
self.navigate_to_entity(ENTITY, 'search')
|
||||
self.delete_record(pkey, data.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_ca_less(self):
|
||||
"""
|
||||
Test service certificate actions in CA-less install
|
||||
http://www.freeipa.org/page/V3/CA-less_install
|
||||
"""
|
||||
if self.has_ca():
|
||||
self.skip('CA is installed')
|
||||
|
||||
self.init_app()
|
||||
|
||||
data = self.prep_data()
|
||||
pkey = data.get('pkey')
|
||||
|
||||
self.add_record(ENTITY, data)
|
||||
self.navigate_to_record(pkey)
|
||||
|
||||
self.assert_action_list_action('request_cert', visible=False)
|
||||
|
||||
self.navigate_by_breadcrumb('Services')
|
||||
self.delete_record(pkey, data.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_kerberos_flags(self):
|
||||
"""
|
||||
Test Kerberos flags
|
||||
http://www.freeipa.org/page/V3/Kerberos_Flags
|
||||
"""
|
||||
pkey = self.get_http_pkey()
|
||||
name = 'ipakrbokasdelegate'
|
||||
mod = {'mod': [('checkbox', name, None)]}
|
||||
checked = ['checked']
|
||||
|
||||
self.init_app()
|
||||
self.navigate_to_record(pkey, entity=ENTITY)
|
||||
|
||||
if self.get_field_checked(name) == checked:
|
||||
self.mod_record(ENTITY, mod) # uncheck
|
||||
|
||||
self.mod_record(ENTITY, mod)
|
||||
self.validate_fields([('checkbox', name, checked)])
|
||||
self.mod_record(ENTITY, mod)
|
||||
self.validate_fields([('checkbox', name, [])])
|
||||
132
ipatests/test_webui/test_sudo.py
Normal file
132
ipatests/test_webui/test_sudo.py
Normal file
@@ -0,0 +1,132 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Sudo tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_sudo as sudo
|
||||
import ipatests.test_webui.data_netgroup as netgroup
|
||||
import ipatests.test_webui.data_user as user
|
||||
import ipatests.test_webui.data_group as group
|
||||
import ipatests.test_webui.data_hostgroup as hostgroup
|
||||
from ipatests.test_webui.test_host import host_tasks, ENTITY as HOST_ENTITY
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_sudo(UI_driver):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: sudo
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
self.basic_crud(sudo.CMDENTITY, sudo.CMD_DATA)
|
||||
self.basic_crud(sudo.CMDGROUP_ENTITY, sudo.CMDGROUP_DATA,
|
||||
default_facet=sudo.CMDGROUP_DEF_FACET)
|
||||
|
||||
@screenshot
|
||||
def test_mod(self):
|
||||
"""
|
||||
Mod: sudo
|
||||
"""
|
||||
self.init_app()
|
||||
host = host_tasks()
|
||||
host.setup(self.driver, self.config)
|
||||
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA2)
|
||||
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
self.add_record(user.ENTITY, user.DATA2, navigate=False)
|
||||
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.add_record(group.ENTITY, group.DATA2, navigate=False)
|
||||
|
||||
self.add_record(HOST_ENTITY, host.data)
|
||||
self.add_record(HOST_ENTITY, host.data2, navigate=False)
|
||||
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA)
|
||||
self.add_record(hostgroup.ENTITY, hostgroup.DATA2, navigate=False)
|
||||
|
||||
self.add_record(sudo.CMDENTITY, sudo.CMD_DATA)
|
||||
self.add_record(sudo.CMDENTITY, sudo.CMD_DATA2, navigate=False)
|
||||
|
||||
self.add_record(sudo.CMDGROUP_ENTITY, sudo.CMDGROUP_DATA)
|
||||
self.add_record(sudo.CMDGROUP_ENTITY, sudo.CMDGROUP_DATA2, navigate=False)
|
||||
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
self.navigate_to_record(sudo.RULE_PKEY, entity=sudo.RULE_ENTITY)
|
||||
|
||||
tables = [
|
||||
['memberuser_user', [user.PKEY, user.PKEY2], ],
|
||||
['memberuser_group', [group.PKEY, group.PKEY2], ],
|
||||
['memberhost_host', [host.pkey, host.pkey2], ],
|
||||
['memberhost_hostgroup', [hostgroup.PKEY, hostgroup.PKEY2], ],
|
||||
['memberallowcmd_sudocmd', [sudo.CMD_PKEY, sudo.CMD_PKEY2], ],
|
||||
['memberallowcmd_sudocmdgroup', [sudo.CMD_GROUP_PKEY, sudo.CMD_GROUP_PKEY2], ],
|
||||
['memberdenycmd_sudocmd', [sudo.CMD_PKEY, sudo.CMD_PKEY2], ],
|
||||
['memberdenycmd_sudocmdgroup', [sudo.CMD_GROUP_PKEY, sudo.CMD_GROUP_PKEY2], ],
|
||||
['ipasudorunas_user', ['admin'], ],
|
||||
['ipasudorunas_group', ['editors', 'admins'], ],
|
||||
['ipasudorunasgroup_group', ['editors', 'admins'], ],
|
||||
]
|
||||
|
||||
categories = [
|
||||
'usercategory',
|
||||
'hostcategory',
|
||||
'cmdcategory',
|
||||
'ipasudorunasusercategory',
|
||||
'ipasudorunasgroupcategory',
|
||||
]
|
||||
|
||||
no_cats = [
|
||||
'memberdenycmd_sudocmd',
|
||||
'memberdenycmd_sudocmdgroup',
|
||||
]
|
||||
|
||||
self.mod_rule_tables(tables, categories, no_cats)
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
self.delete(user.ENTITY, [user.DATA, user.DATA2])
|
||||
self.delete(group.ENTITY, [group.DATA, group.DATA2])
|
||||
self.delete(HOST_ENTITY, [host.data, host.data2])
|
||||
self.delete(hostgroup.ENTITY, [hostgroup.DATA, hostgroup.DATA2])
|
||||
self.delete(sudo.CMDENTITY, [sudo.CMD_DATA, sudo.CMD_DATA2])
|
||||
self.delete(sudo.CMDGROUP_ENTITY, [sudo.CMDGROUP_DATA, sudo.CMDGROUP_DATA2])
|
||||
|
||||
@screenshot
|
||||
def test_actions(self):
|
||||
"""
|
||||
Test sudo rule actions
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
self.navigate_to_record(sudo.RULE_PKEY)
|
||||
|
||||
self.disable_action()
|
||||
self.enable_action()
|
||||
self.delete_action(sudo.RULE_ENTITY, sudo.RULE_PKEY)
|
||||
160
ipatests/test_webui/test_trust.py
Normal file
160
ipatests/test_webui/test_trust.py
Normal file
@@ -0,0 +1,160 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Trust tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
from ipatests.test_webui.task_range import range_tasks
|
||||
import pytest
|
||||
|
||||
ENTITY = 'trust'
|
||||
CONFIG_ENTITY = 'trustconfig'
|
||||
|
||||
CONFIG_DATA = {
|
||||
'mod': [
|
||||
['combobox', 'ipantfallbackprimarygroup', 'admins'],
|
||||
]
|
||||
}
|
||||
|
||||
CONFIG_DATA2 = {
|
||||
'mod': [
|
||||
['combobox', 'ipantfallbackprimarygroup', 'Default SMB Group']
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class trust_tasks(UI_driver):
|
||||
|
||||
def get_data(self, add_data=None):
|
||||
|
||||
domain = self.config.get('ad_domain')
|
||||
|
||||
if not add_data:
|
||||
add_data = self.get_add_data()
|
||||
|
||||
data = {
|
||||
'pkey': domain,
|
||||
'add': add_data,
|
||||
'mod': [
|
||||
('multivalued', 'ipantsidblacklistincoming', [
|
||||
('del', 'S-1-5-18'),
|
||||
('add', 'S-1-5-21'),
|
||||
]),
|
||||
('multivalued', 'ipantsidblacklistoutgoing', [
|
||||
('del', 'S-1-5-18'),
|
||||
('add', 'S-1-5-21'),
|
||||
]),
|
||||
],
|
||||
}
|
||||
|
||||
return data
|
||||
|
||||
def get_add_data(self, range_type=None, base_id=None, range_size=None):
|
||||
|
||||
domain = self.config.get('ad_domain')
|
||||
admin = self.config.get('ad_admin')
|
||||
psw = self.config.get('ad_password')
|
||||
|
||||
add = [
|
||||
('textbox', 'realm_server', domain),
|
||||
('textbox', 'realm_admin', admin),
|
||||
('password', 'realm_passwd', psw),
|
||||
]
|
||||
|
||||
if range_type:
|
||||
add.append(('radio', 'range_type', range_type))
|
||||
if base_id:
|
||||
add.append(('textbox', 'base_id', base_id))
|
||||
if range_size:
|
||||
add.append(('textbox', 'range_size', range_size))
|
||||
|
||||
return add
|
||||
|
||||
def get_range_name(self):
|
||||
domain = self.config.get('ad_domain')
|
||||
return domain.upper() + '_id_range'
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_trust(trust_tasks):
|
||||
|
||||
def setup(self, *args, **kwargs):
|
||||
super(test_trust, self).setup(*args, **kwargs)
|
||||
if not self.has_trusts():
|
||||
self.skip('Trusts not configured')
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic basic CRUD: trust
|
||||
|
||||
Test establishing trust by using Windows admin credentials
|
||||
"""
|
||||
self.init_app()
|
||||
data = self.get_data()
|
||||
self.navigate_to_entity('idrange')
|
||||
self.delete_record(self.get_range_name())
|
||||
self.basic_crud(ENTITY, data)
|
||||
self.navigate_to_entity('idrange')
|
||||
self.delete_record(self.get_range_name())
|
||||
|
||||
@screenshot
|
||||
def test_range_types(self):
|
||||
|
||||
self.init_app()
|
||||
|
||||
r_tasks = range_tasks()
|
||||
r_tasks.setup(self.driver, self.config)
|
||||
r_tasks.get_shifts()
|
||||
range_add = r_tasks.get_add_data('')
|
||||
base_id = range_add[2][2]
|
||||
range_size = range_add[3][2]
|
||||
range_pkey = self.get_range_name()
|
||||
column = 'iparangetype'
|
||||
|
||||
self.navigate_to_entity('idrange')
|
||||
self.delete_record(range_pkey)
|
||||
|
||||
add = self.get_add_data('ipa-ad-trust', base_id, range_size)
|
||||
data = self.get_data(add_data=add)
|
||||
self.add_record(ENTITY, data, delete=True)
|
||||
self.navigate_to_entity('idrange')
|
||||
self.assert_record_value('Active Directory domain range', range_pkey, column)
|
||||
self.delete_record(range_pkey)
|
||||
|
||||
self.request_timeout = 60
|
||||
add = self.get_add_data('ipa-ad-trust-posix', base_id, range_size)
|
||||
data = self.get_data(add_data=add)
|
||||
self.add_record(ENTITY, data, delete=True)
|
||||
self.navigate_to_entity('idrange')
|
||||
self.assert_record_value('Active Directory trust range with POSIX attributes', range_pkey, column)
|
||||
self.delete_record(range_pkey)
|
||||
|
||||
@screenshot
|
||||
def test_config_mod(self):
|
||||
|
||||
self.init_app()
|
||||
self.navigate_to_entity(CONFIG_ENTITY)
|
||||
|
||||
self.mod_record(CONFIG_ENTITY, CONFIG_DATA)
|
||||
self.mod_record(CONFIG_ENTITY, CONFIG_DATA2)
|
||||
410
ipatests/test_webui/test_user.py
Normal file
410
ipatests/test_webui/test_user.py
Normal file
@@ -0,0 +1,410 @@
|
||||
# Authors:
|
||||
# Petr Vobornik <pvoborni@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
User tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_user as user
|
||||
import ipatests.test_webui.data_group as group
|
||||
import ipatests.test_webui.data_netgroup as netgroup
|
||||
import ipatests.test_webui.data_hbac as hbac
|
||||
import ipatests.test_webui.test_rbac as rbac
|
||||
import ipatests.test_webui.data_sudo as sudo
|
||||
import pytest
|
||||
|
||||
try:
|
||||
from selenium.webdriver.common.by import By
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class user_tasks(UI_driver):
|
||||
def load_file(self, path):
|
||||
with open(path, 'r') as file_d:
|
||||
content = file_d.read()
|
||||
return content
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_user(user_tasks):
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic CRUD: user
|
||||
"""
|
||||
self.init_app()
|
||||
self.basic_crud(user.ENTITY, user.DATA)
|
||||
|
||||
@screenshot
|
||||
def test_associations(self):
|
||||
"""
|
||||
User direct associations
|
||||
"""
|
||||
|
||||
self.init_app()
|
||||
|
||||
# prepare - add user, group, netgroup, role, hbac rule, sudo rule
|
||||
# ---------------------------------------------------------------
|
||||
self.add_record(user.ENTITY, user.DATA, navigate=False)
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
|
||||
# add & remove associations
|
||||
# -------------------------
|
||||
self.navigate_to_entity(user.ENTITY)
|
||||
self.navigate_to_record(user.PKEY)
|
||||
|
||||
self.add_associations([group.PKEY, 'editors'], facet='memberof_group', delete=True)
|
||||
self.add_associations([netgroup.PKEY], facet='memberof_netgroup', delete=True)
|
||||
self.add_associations([rbac.ROLE_PKEY], facet='memberof_role', delete=True)
|
||||
self.add_associations([hbac.RULE_PKEY], facet='memberof_hbacrule', delete=True)
|
||||
self.add_associations([sudo.RULE_PKEY], facet='memberof_sudorule', delete=True)
|
||||
|
||||
# cleanup
|
||||
# -------
|
||||
self.delete(user.ENTITY, [user.DATA])
|
||||
self.delete(group.ENTITY, [group.DATA])
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA])
|
||||
self.delete(rbac.ROLE_ENTITY, [rbac.ROLE_DATA])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
|
||||
@screenshot
|
||||
def test_indirect_associations(self):
|
||||
"""
|
||||
User indirect associations
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# add
|
||||
# ---
|
||||
self.add_record(user.ENTITY, user.DATA, navigate=False)
|
||||
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.navigate_to_record(group.PKEY)
|
||||
self.add_associations([user.PKEY])
|
||||
|
||||
self.add_record(group.ENTITY, group.DATA2)
|
||||
self.navigate_to_record(group.PKEY2)
|
||||
self.add_associations([group.PKEY], facet='member_group')
|
||||
|
||||
self.add_record(netgroup.ENTITY, netgroup.DATA)
|
||||
self.navigate_to_record(netgroup.PKEY)
|
||||
self.add_table_associations('memberuser_group', [group.PKEY2])
|
||||
|
||||
self.add_record(rbac.ROLE_ENTITY, rbac.ROLE_DATA)
|
||||
self.navigate_to_record(rbac.ROLE_PKEY)
|
||||
self.add_associations([group.PKEY2], facet='member_group')
|
||||
|
||||
self.add_record(hbac.RULE_ENTITY, hbac.RULE_DATA)
|
||||
self.navigate_to_record(hbac.RULE_PKEY)
|
||||
self.add_table_associations('memberuser_group', [group.PKEY2])
|
||||
|
||||
self.add_record(sudo.RULE_ENTITY, sudo.RULE_DATA)
|
||||
self.navigate_to_record(sudo.RULE_PKEY)
|
||||
self.add_table_associations('memberuser_group', [group.PKEY2])
|
||||
|
||||
# check indirect associations
|
||||
# ---------------------------
|
||||
self.navigate_to_entity(user.ENTITY, 'search')
|
||||
self.navigate_to_record(user.PKEY)
|
||||
|
||||
self.assert_indirect_record(group.PKEY2, user.ENTITY, 'memberof_group')
|
||||
self.assert_indirect_record(netgroup.PKEY, user.ENTITY, 'memberof_netgroup')
|
||||
self.assert_indirect_record(rbac.ROLE_PKEY, user.ENTITY, 'memberof_role')
|
||||
self.assert_indirect_record(hbac.RULE_PKEY, user.ENTITY, 'memberof_hbacrule')
|
||||
self.assert_indirect_record(sudo.RULE_PKEY, user.ENTITY, 'memberof_sudorule')
|
||||
|
||||
## cleanup
|
||||
## -------
|
||||
self.delete(user.ENTITY, [user.DATA])
|
||||
self.delete(group.ENTITY, [group.DATA, group.DATA2])
|
||||
self.delete(netgroup.ENTITY, [netgroup.DATA])
|
||||
self.delete(rbac.ROLE_ENTITY, [rbac.ROLE_DATA])
|
||||
self.delete(hbac.RULE_ENTITY, [hbac.RULE_DATA])
|
||||
self.delete(sudo.RULE_ENTITY, [sudo.RULE_DATA])
|
||||
|
||||
@screenshot
|
||||
def test_actions(self):
|
||||
"""
|
||||
Test user actions
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
self.add_record(user.ENTITY, user.DATA, navigate=False)
|
||||
self.navigate_to_record(user.PKEY)
|
||||
|
||||
self.disable_action()
|
||||
self.enable_action()
|
||||
|
||||
# reset password
|
||||
pwd = self.config.get('ipa_password')
|
||||
self.reset_password_action(pwd)
|
||||
self.assert_text_field('has_password', '******')
|
||||
|
||||
self.action_list_action('unlock')
|
||||
|
||||
# delete
|
||||
self.delete_action(user.ENTITY, user.PKEY, action='delete_active_user')
|
||||
|
||||
@screenshot
|
||||
def test_certificates(self):
|
||||
"""
|
||||
Test user certificate actions
|
||||
|
||||
Requires to have CA installed and 'user_csr_path' configuration option
|
||||
set.
|
||||
"""
|
||||
|
||||
if not self.has_ca():
|
||||
self.skip('CA is not configured')
|
||||
|
||||
csr_path = self.config.get('user_csr_path')
|
||||
if not csr_path:
|
||||
self.skip('CSR file is not configured')
|
||||
|
||||
self.init_app()
|
||||
# ENHANCEMENT: generate csr dynamically
|
||||
csr = self.load_file(csr_path)
|
||||
cert_widget_sel = "div.certificate-widget"
|
||||
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
self.navigate_to_record(user.PKEY)
|
||||
|
||||
# cert request
|
||||
self.action_list_action('request_cert', confirm=False)
|
||||
self.assert_dialog()
|
||||
self.fill_text("textarea[name='csr']", csr)
|
||||
self.dialog_button_click('issue')
|
||||
self.wait_for_request(n=2, d=3)
|
||||
self.assert_visible(cert_widget_sel)
|
||||
|
||||
# cert view
|
||||
self.action_list_action('view', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert get
|
||||
self.action_list_action('get', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.assert_dialog()
|
||||
# check that the textarea is not empty
|
||||
self.assert_empty_value('textarea.certificate', negative=True)
|
||||
self.dialog_button_click('close')
|
||||
|
||||
# cert download - we can only try to click the download action
|
||||
self.action_list_action('download', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
|
||||
# check that revoke action is enabled
|
||||
self.assert_action_list_action('revoke',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action('remove_hold', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cert revoke
|
||||
self.action_list_action('revoke', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.wait()
|
||||
self.select('select', '6')
|
||||
self.dialog_button_click('ok')
|
||||
self.wait_for_request(n=2, d=3)
|
||||
self.assert_visible(cert_widget_sel + " div.watermark")
|
||||
|
||||
# check that revoke action is not enabled
|
||||
self.assert_action_list_action('revoke', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is enabled
|
||||
self.assert_action_list_action('remove_hold',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cert remove hold
|
||||
self.action_list_action('remove_hold', confirm=False,
|
||||
parents_css_sel=cert_widget_sel)
|
||||
self.wait()
|
||||
self.dialog_button_click('ok')
|
||||
self.wait_for_request(n=2)
|
||||
|
||||
# check that revoke action is enabled
|
||||
self.assert_action_list_action('revoke',
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# check that remove_hold action is not enabled
|
||||
self.assert_action_list_action('remove_hold', enabled=False,
|
||||
parents_css_sel=cert_widget_sel,
|
||||
facet_actions=False)
|
||||
|
||||
# cleanup
|
||||
self.navigate_to_entity(user.ENTITY, 'search')
|
||||
self.delete_record(user.PKEY, user.DATA.get('del'))
|
||||
|
||||
@screenshot
|
||||
def test_password_expiration_notification(self):
|
||||
"""
|
||||
Test password expiration notification
|
||||
"""
|
||||
|
||||
pwd = self.config.get('ipa_password')
|
||||
|
||||
self.init_app()
|
||||
|
||||
self.set_ipapwdexpadvnotify('15')
|
||||
|
||||
# create user and group and add user to that group
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
self.navigate_to_entity(group.ENTITY)
|
||||
self.navigate_to_record(group.PKEY)
|
||||
self.add_associations([user.PKEY])
|
||||
|
||||
# password policy for group
|
||||
self.add_record('pwpolicy', {
|
||||
'pkey': group.PKEY,
|
||||
'add': [
|
||||
('combobox', 'cn', group.PKEY),
|
||||
('textbox', 'cospriority', '12345'),
|
||||
]})
|
||||
self.navigate_to_record(group.PKEY)
|
||||
self.mod_record('pwpolicy', {
|
||||
'pkey': group.PKEY,
|
||||
'mod': [
|
||||
('textbox', 'krbmaxpwdlife', '7'),
|
||||
('textbox', 'krbminpwdlife', '0'),
|
||||
]})
|
||||
|
||||
# reset password
|
||||
self.navigate_to_record(user.PKEY, entity=user.ENTITY)
|
||||
self.reset_password_action(pwd)
|
||||
|
||||
#re-login as new user
|
||||
self.logout()
|
||||
self.init_app(user.PKEY, pwd)
|
||||
|
||||
header = self.find('.navbar-pf', By.CSS_SELECTOR)
|
||||
self.assert_text(
|
||||
'.header-passwordexpires',
|
||||
'Your password expires in 6 days.',
|
||||
header)
|
||||
|
||||
# test password reset
|
||||
self.profile_menu_action('password_reset')
|
||||
self.fill_password_dialog(pwd, pwd)
|
||||
|
||||
# cleanup
|
||||
self.logout()
|
||||
self.init_app()
|
||||
self.set_ipapwdexpadvnotify('4')
|
||||
self.delete(user.ENTITY, [user.DATA])
|
||||
self.delete(group.ENTITY, [group.DATA])
|
||||
|
||||
def set_ipapwdexpadvnotify(self, days):
|
||||
"""
|
||||
Set ipa config "Password Expiration Notification (days)" field
|
||||
"""
|
||||
|
||||
self.navigate_to_entity('config')
|
||||
self.mod_record('config', {
|
||||
'mod': [
|
||||
('textbox', 'ipapwdexpadvnotify', days),
|
||||
]
|
||||
})
|
||||
|
||||
def reset_password_action(self, password):
|
||||
"""
|
||||
Execute reset password action
|
||||
"""
|
||||
|
||||
self.action_list_action('reset_password', False)
|
||||
self.fill_password_dialog(password)
|
||||
|
||||
def fill_password_dialog(self, password, current=None):
|
||||
"""
|
||||
Fill password dialog
|
||||
"""
|
||||
|
||||
self.assert_dialog()
|
||||
|
||||
fields = [
|
||||
('password', 'password', password),
|
||||
('password', 'password2', password),
|
||||
]
|
||||
|
||||
if current:
|
||||
fields.append(('password', 'current_password', current))
|
||||
|
||||
self.fill_fields(fields)
|
||||
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 (str(e.value) == '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])
|
||||
184
ipatests/test_webui/test_vault.py
Normal file
184
ipatests/test_webui/test_vault.py
Normal file
@@ -0,0 +1,184 @@
|
||||
# Authors:
|
||||
# Pavel Vomacka <pvomacka@redhat.com>
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat
|
||||
# see file 'COPYING' for use and warranty information
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Vault tests
|
||||
"""
|
||||
|
||||
from ipatests.test_webui.ui_driver import UI_driver
|
||||
from ipatests.test_webui.ui_driver import screenshot
|
||||
import ipatests.test_webui.data_vault as vault
|
||||
import ipatests.test_webui.data_user as user
|
||||
import ipatests.test_webui.data_group as group
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class vault_tasks(UI_driver):
|
||||
|
||||
def prep_service_data(self):
|
||||
|
||||
host = self.config.get('ipa_server')
|
||||
realm = self.config.get('ipa_realm')
|
||||
pkey = 'itest'
|
||||
|
||||
return {
|
||||
'entity': 'service',
|
||||
'pkey': '%s/%s@%s' % (pkey, host, realm),
|
||||
'add': [
|
||||
('textbox', 'service', pkey),
|
||||
('combobox', 'host', host)
|
||||
]
|
||||
}
|
||||
|
||||
def prepare_vault_service_data(self, data):
|
||||
s_data = self.prep_service_data()
|
||||
service = s_data['pkey']
|
||||
|
||||
serv_field = [('combobox', 'service', service)]
|
||||
|
||||
data['add'].extend(serv_field)
|
||||
|
||||
def prepare_vault_user_data(self, data, user='admin'):
|
||||
user_field = [('combobox', 'username', user)]
|
||||
|
||||
data['add'].extend(user_field)
|
||||
|
||||
|
||||
@pytest.mark.tier1
|
||||
class test_vault(vault_tasks):
|
||||
|
||||
def setup(self, *args, **kwargs):
|
||||
super(test_vault, self).setup(*args, **kwargs)
|
||||
if not self.has_kra():
|
||||
self.skip('KRA not configured')
|
||||
|
||||
@screenshot
|
||||
def test_crud(self):
|
||||
"""
|
||||
Basic basic CRUD: user vault
|
||||
"""
|
||||
self.init_app()
|
||||
self.prepare_vault_user_data(vault.DATA)
|
||||
self.basic_crud(vault.ENTITY, vault.DATA)
|
||||
|
||||
@screenshot
|
||||
def test_add_service_vault(self):
|
||||
"""
|
||||
Add Service vault
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# Add itest service
|
||||
s_data = self.prep_service_data()
|
||||
self.add_record(s_data['entity'], s_data)
|
||||
|
||||
self.prepare_vault_service_data(vault.DATA2)
|
||||
|
||||
# Add and remove service vault
|
||||
self.add_record(vault.ENTITY, vault.DATA2, facet=vault.DATA2['facet'],
|
||||
delete=True)
|
||||
|
||||
# Remove test service
|
||||
self.navigate_to_entity(s_data['entity'])
|
||||
self.delete_record(s_data['pkey'])
|
||||
|
||||
@screenshot
|
||||
def test_add_shared_vault(self):
|
||||
"""
|
||||
Add Shared vault
|
||||
"""
|
||||
self.init_app()
|
||||
|
||||
# Add shared vault
|
||||
self.add_record(vault.ENTITY, vault.DATA3, facet=vault.DATA3['facet'],
|
||||
delete=True)
|
||||
|
||||
@screenshot
|
||||
def test_member_owner_vault(self):
|
||||
"""
|
||||
Add User Vault and try to add member and owner
|
||||
"""
|
||||
def fill_tables():
|
||||
self.add_table_associations('member_user', [user.PKEY])
|
||||
self.add_table_associations('member_group', [group.PKEY])
|
||||
self.add_table_associations('member_service', [s_data['pkey']])
|
||||
self.add_table_associations('owner_user', [user.PKEY])
|
||||
self.add_table_associations('owner_group', [group.PKEY])
|
||||
self.add_table_associations('owner_service', [s_data['pkey']])
|
||||
|
||||
# Add user
|
||||
self.init_app()
|
||||
self.add_record(user.ENTITY, user.DATA)
|
||||
|
||||
# Prepare items - user already exists
|
||||
s_data = self.prep_service_data()
|
||||
self.add_record(s_data['entity'], s_data)
|
||||
self.add_record(group.ENTITY, group.DATA)
|
||||
|
||||
# USER
|
||||
# Add user vault
|
||||
self.add_record(vault.ENTITY, vault.DATA, facet='user_search')
|
||||
|
||||
# Navigate to record
|
||||
self.navigate_to_record(vault.DATA['pkey'])
|
||||
|
||||
# Try add values into table
|
||||
fill_tables()
|
||||
|
||||
# Remove user vault record
|
||||
self.navigate_to_entity(vault.ENTITY, vault.DATA['facet'])
|
||||
self.delete_record(vault.PKEY)
|
||||
|
||||
# SERVICE
|
||||
# Add service vault
|
||||
self.prepare_vault_service_data(vault.DATA2)
|
||||
self.add_record(vault.ENTITY, vault.DATA2, facet=vault.DATA2['facet'])
|
||||
|
||||
# Navigate to record
|
||||
self.navigate_to_record(vault.DATA2['pkey'])
|
||||
|
||||
# Try add values into table
|
||||
fill_tables()
|
||||
|
||||
# Remove service vault record
|
||||
self.navigate_to_entity(vault.ENTITY, vault.DATA2['facet'])
|
||||
self.delete_record(vault.DATA2['pkey'])
|
||||
|
||||
# SHARED
|
||||
# Add shared vault
|
||||
self.add_record(vault.ENTITY, vault.DATA3, facet=vault.DATA3['facet'])
|
||||
|
||||
# Navigate to record
|
||||
self.navigate_to_record(vault.DATA3['pkey'])
|
||||
|
||||
# Try add values into table
|
||||
fill_tables()
|
||||
|
||||
# Remove shared vault record
|
||||
self.navigate_to_entity(vault.ENTITY, vault.DATA3['facet'])
|
||||
self.delete_record(vault.DATA3['pkey'])
|
||||
|
||||
# Clean up
|
||||
self.navigate_to_entity(s_data['entity'])
|
||||
self.delete_record(s_data['pkey'])
|
||||
self.navigate_to_entity(user.ENTITY)
|
||||
self.delete_record(user.PKEY)
|
||||
self.navigate_to_entity(group.ENTITY)
|
||||
self.delete_record(group.PKEY)
|
||||
1821
ipatests/test_webui/ui_driver.py
Normal file
1821
ipatests/test_webui/ui_driver.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user