freeipa/ipatests/test_webui/data_selinuxusermap.py

121 lines
3.1 KiB
Python
Raw Normal View History

ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
#
# Copyright (C) 2018 FreeIPA Contributors see COPYING for license
#
from ipaplatform.constants import constants as platformconstants
# for example, user_u:s0
selinuxuser1 = platformconstants.SELINUX_USERMAP_ORDER.split("$")[0]
selinuxuser2 = platformconstants.SELINUX_USERMAP_ORDER.split("$")[1]
selinux_mcs_max = platformconstants.SELINUX_MCS_MAX
selinux_mls_max = platformconstants.SELINUX_MLS_MAX
second_mls_level = 's{}'.format(list(range(0, selinux_mls_max + 1))[0])
second_mcs_level = 'c{}'.format(list(range(0, selinux_mcs_max + 1))[0])
mcs_range = '{0}.{0}'.format(second_mcs_level)
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
ENTITY = 'selinuxusermap'
PKEY = 'itest-selinuxusermap'
DATA = {
'pkey': PKEY,
'add': [
('textbox', 'cn', PKEY),
('textbox', 'ipaselinuxuser', selinuxuser1),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
'mod': [
('textarea', 'description', 'itest-selinuxusermap desc'),
],
}
PKEY2 = 'itest-selinuxusermap2'
DATA2 = {
'pkey': PKEY2,
'add': [
('textbox', 'cn', PKEY2),
('textbox', 'ipaselinuxuser', selinuxuser2),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
'mod': [
('textarea', 'description', 'itest-selinuxusermap desc2'),
],
}
PKEY_MLS_RANGE = 'itest-selinuxusermap_MLS_range'
DATA_MLS_RANGE = {
'pkey': PKEY_MLS_RANGE,
'add': [
('textbox', 'cn', PKEY_MLS_RANGE),
('textbox', 'ipaselinuxuser', 'foo:s0-{}'.format(second_mls_level)),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
}
PKEY_MCS_RANGE = 'itest-selinuxusermap_MLS_range'
DATA_MCS_RANGE = {
'pkey': PKEY_MCS_RANGE,
'add': [
('textbox', 'cn', PKEY_MCS_RANGE),
('textbox', 'ipaselinuxuser',
'foo:s0-s{}:c0.c{}'.format(selinux_mls_max, selinux_mcs_max)
),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
}
PKEY_MCS_COMMAS = 'itest-selinuxusermap_MCS_commas'
DATA_MCS_COMMAS = {
'pkey': PKEY_MCS_COMMAS,
'add': [
('textbox', 'cn', PKEY_MCS_COMMAS),
('textbox', 'ipaselinuxuser',
'foo:s0-{}:c0,{},{}'.format(
second_mls_level, second_mcs_level, mcs_range),
),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
}
PKEY_MLS_SINGLE_VAL = 'itest-selinuxusermap_MLS_single_val'
DATA_MLS_SINGLE_VAL = {
'pkey': PKEY_MLS_SINGLE_VAL,
'add': [
('textbox', 'cn', PKEY_MLS_SINGLE_VAL),
('textbox', 'ipaselinuxuser',
'foo:s0-s0:c0.c{}'.format(selinux_mcs_max)
),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
}
PKEY_NON_EXIST_SEUSER = 'itest-selinuxusermap_nonexistent_user'
DATA_NON_EXIST_SEUSER = {
'pkey': PKEY_NON_EXIST_SEUSER,
'add': [
('textbox', 'cn', PKEY_NON_EXIST_SEUSER),
('textbox', 'ipaselinuxuser', 'foo:s0'),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
}
PKEY_INVALID_MCS = 'itest-selinuxusermap_invalid_MCS'
DATA_INVALID_MCS = {
'pkey': PKEY_INVALID_MCS,
'add': [
('textbox', 'cn', PKEY_INVALID_MCS),
('textbox', 'ipaselinuxuser', 'foo:s0:c'),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
}
PKEY_INVALID_MLS = 'itest-selinuxusermap_invalid_MLS'
DATA_INVALID_MLS = {
'pkey': PKEY_INVALID_MLS,
'add': [
('textbox', 'cn', PKEY_INVALID_MLS),
('textbox', 'ipaselinuxuser', 'foo'),
ui_tests: extend test_selinuxusermap.py suite Extend test_selinuxusermap.py suite with new test cases. Details in the ticket. We also modify "add_table_associations" to handle "cancel" and "negative" in the way other methods works. Lastly, we start using dialog_btn=None to test keyboard confirmation as we did use it incorrectly with "Negative=True" where it was already confirmed by "click". Added tests: addselinuxusermap_MLS_singlelevel addselinuxusermap_cancel addselinuxusermap_disabledhbacrule addselinuxusermap_MLS_range addselinuxusermap_MCS_range addselinuxusermap_MCS_commas addselinuxusermap_MLS_singlevalue addselinuxusermap_multiple addandeditselinuxusermap selinuxusermap_undo selinuxusermap_refresh selinuxusermap_reset selinuxusermap_update selinuxusermap_backlink_cancel selinuxusermap_backlink_reset selinuxusermap_backlink_update selinuxusermap_deletemultiple add_user_selinuxusermap_cancel add_host_selinuxusermap_cancel add_hostgroup_selinuxusermap_cancel selinuxusermap_requiredfield selinuxusermap_duplicate selinuxusermap_nonexistinguser selinuxusermap_invalidusersyntaxMCS selinuxusermap_invalidusersyntaxMLS add_usernegative_selinuxusermap selinuxusermap_addNegativeHBACrule selinuxusermap_search selinuxusermap_searchnegative selinuxusermap_disablemultiple selinuxusermap_enablemultiple selinuxusermap_deleteNegativeHBACrule add_selinuxusermap_adder_dialog_bug910463 delete_selinuxusermap_deleter_dialog_bug910463 https://pagure.io/freeipa/issue/7544 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-05-14 06:31:06 -05:00
],
}
PKEY_FIELD_REQUIRED = 'itest-selinuxusermap_without_SELinux_user'
DATA_FIELD_REQUIRED = {
'pkey': PKEY_FIELD_REQUIRED,
'add': [
('textbox', 'cn', PKEY_FIELD_REQUIRED),
],
}