Commit Graph

224 Commits

Author SHA1 Message Date
Stanislav Levin
fec66942d4 pytest: Migrate unittest/nose to Pytest fixtures
Even though Pytest supports xunit style setups, unittest and nose
tests, this support is limited and may be dropped in the future
releases. Worst of all is that the mixing of various test
frameworks results in weird conflicts and of course, is not widely
tested.

This is a part of work to remove the mixing of test idioms in the
IPA's test suite:
1) replace unittest.TestCase subclasses
2) replace unittest test controls (SkipTest, fail, etc.)
3) replace unittest assertions

Related: https://pagure.io/freeipa/issue/7989
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
2020-02-12 18:08:32 +02:00
Stanislav Levin
292d686c0b pytest: Migrate xunit-style setups to Pytest fixtures
Even though Pytest supports xunit style setups, unittest and nose
tests, this support is limited and may be dropped in the future
releases. Worst of all is that the mixing of various test
frameworks results in weird conflicts and of course, is not widely
tested.

This is a part of work to remove the mixing of test idioms in the
IPA's test suite:
1) replace xunit style
2) employ the fixtures' interdependencies

Related: https://pagure.io/freeipa/issue/7989
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
2020-02-12 18:08:32 +02:00
Serhii Tsymbaliuk
a4634a59c9
WebUI tests: Fix broken reference to parent facet in table record check
Add decorator to has_record method which repeats the check when an active facet is changed
(catch StaleElementReferenceException).

Ticket: https://pagure.io/freeipa/issue/8157

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Armando Neto <abiagion@redhat.com>
2020-02-06 10:21:36 +01:00
Serhii Tsymbaliuk
9418042ee7
WebUI tests: Fix 'Button is not displayed' exception
Add a small timeout (up to 5 seconds) which allows to prevent exceptions when
WebDriver attempts to click a button before it is rendered.

Ticket: https://pagure.io/freeipa/issue/8169

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Sergey Orlov <sorlov@redhat.com>
2020-02-05 12:04:50 +01:00
Christian Heimes
6a17a91672 Skip paramiko tests in FIPS mode
Paramiko is not compatible with FIPS mode. It uses MD5 on the client
side and does not support rsa-sha2 connections for RSA auth.

See: https://pagure.io/freeipa/issue/8129
Reviewed-By: Francisco Trivino <ftrivino@redhat.com>
2019-11-29 17:02:16 +01:00
Serhii Tsymbaliuk
4dbc6926b1 WebUI: Fix new test initialization on "HBAC Test" page
"New Test" action cleared only information about selected options but kept
radio buttons checked. It confused users and caused an error on validation step.

New behaviour is:
- tables forget all selected values after "New Test" click;
- first table record is checked initially in case the option is mandatory;
- all records is unchecked initially in case the option is not mandatory.

Ticket: https://pagure.io/freeipa/issue/8031

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Armando Neto <abiagion@redhat.com>
2019-09-17 18:12:43 -03:00
Serhii Tsymbaliuk
755154318a
WebUI: Fix changing category on HBAC/Sudo/etc Rule pages
No object can be added to a rule when object category is 'all'.
So while editing rule there is needed to save actual category value
before adding related objects.

Ticket: https://pagure.io/freeipa/issue/7961

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Armando Neto <abiagion@redhat.com>
2019-09-17 08:35:32 +02:00
Serhii Tsymbaliuk
123c93f92c WebUI: Make 'Unlock' option is available only on locked user page
The implementation includes checking password policy for selected user.
'Unlock' option is available only in case user reached a limit of login failures.

Ticket: https://pagure.io/freeipa/issue/5062
Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Reviewed-By: Armando Neto <abiagion@redhat.com>
2019-09-11 18:26:34 +02:00
Serhii Tsymbaliuk
b20ae34b48
WebUI tests: Fix login screen loading issue
test_webui/test_loginscreen fails because login screen is rendered with delays.
To solve the issue small pause added after login.

Ticket: https://pagure.io/freeipa/issue/8053

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Francois Cami <fcami@redhat.com>
2019-08-29 20:16:43 +02:00
Serhii Tsymbaliuk
f16ea8e652
WebUI tests: Fix request timeout for test_trust
Because of intergration with AD server response can take time more then 1 minute.
So request_timeout is increased to 120s.

Ticket: https://pagure.io/freeipa/issue/8024

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>
2019-07-29 17:38:45 +02:00
Serhii Tsymbaliuk
6316a00632
WebUI tests: Fix timeout issues for reset password tests
- Increase wait timeout after password reset
- Wait for server response after login in TestLoginScreen.test_reset_password_and_login_view

Ticket: https://pagure.io/freeipa/issue/8012

Signed-off-by: Serhii Tsymbaliuk <stsymbal@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
2019-07-22 11:28:46 +02:00
Stanislav Levin
ac1ea0ec67 Fix test_webui.test_selinuxusermap
A previous refactoring of SELinux tests has have a wrong
assumption about the user field separator within
ipaSELinuxUserMapOrder. That was '$$', but should be just '$'.

Actually, '.ldif' and '.update' files are passed through
Python template string substitution:

> $$ is an escape; it is replaced with a single $.
> $identifier names a substitution placeholder matching
> a mapping key of "identifier"

This means that the text to be substituted on should not be escaped.
The wrong ipaSELinuxUserMapOrder previously set will be replaced on
upgrade.

Fixes: https://pagure.io/freeipa/issue/7996
Fixes: https://pagure.io/freeipa/issue/8005
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2019-07-15 14:41:23 +03:00
Stanislav Levin
b2acd65013 Make use of single configuration point for SELinux
For now, FreeIPA supports SELinux things as they are in RedHat/Fedora.
But different distributions may have their own SELinux customizations.

This moves SELinux configuration out to platform constants:
- SELINUX_MCS_MAX
- SELINUX_MCS_REGEX
- SELINUX_MLS_MAX
- SELINUX_MLS_REGEX
- SELINUX_USER_REGEX
- SELINUX_USERMAP_DEFAULT
- SELINUX_USERMAP_ORDER

and applies corresponding changes to the test code.

Fixes: https://pagure.io/freeipa/issue/7996
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2019-07-01 14:44:57 +03:00
Alexander Bokovoy
c41b3ae98f fix selenium imports in automount web UI test
Fixes: https://pagure.io/freeipa/issue/7942
Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2019-05-16 09:51:45 +03:00
Serhii Tsymbaliuk
e12e3e84a9
WebUI test: Fix automember tests according to new behavior
After deleting user/host from group "rebuild" task is triggered,
so the entity returns to the group. And we check if it exists.

Also the order of cleaning test resources are changed:
groups are being deleted only after corresponding rules.

New automembership design description:
https://www.port389.org/docs/389ds/design/automember-postop-modify-design.html

Ticket: https://pagure.io/freeipa/issue/7881
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
2019-03-20 11:33:50 +01:00
Serhii Tsymbaliuk
b763bc7952
Fix test_arbitrary_certificates for Web UI
- fix selector for "Add" button in the certificate dialog
- specify selector for the certificate dialog

Ticket: https://pagure.io/freeipa/issue/7843
Reviewed-By: Sergey Orlov <sorlov@redhat.com>
2019-02-06 18:11:56 +01:00
Serhii Tsymbaliuk
bf1875a0e7
Web UI tests: Get rid of *_cert_path and *_csr_path config variables
Web UI tests now don't require additional configuration to test certificates.
Self-signed certificates and CSR are generated on fly.
Next variables from ~/.ipa/ui_test.conf for now are deprecated:
- arbitrary_cert_path
- service_csr_path
- user_csr_path

Ticket: https://pagure.io/freeipa/issue/7843
Reviewed-By: Sergey Orlov <sorlov@redhat.com>
2019-02-06 18:11:56 +01:00
Serhii Tsymbaliuk
88795fb9a9
Fix certificate revocation tests for Web UI
- correct revocation date before search
- increase timeouts

https://pagure.io/freeipa/issue/7834

Reviewed-By: Armando Neto <abiagion@redhat.com>
2019-02-04 14:14:26 +01:00
Serhii Tsymbaliuk
ef7a903761
Fix "Configured size limit exceeded" warning on Web UI
Suppress size limit warning in 'refresh' command.

Ticket: https://pagure.io/freeipa/issue/7603
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2019-01-14 10:16:58 +01:00
Serhii Tsymbaliuk
18cac46092
WebUI: Temporary fix for UnexpectedAlertPresentException
It is regression in Firefox 55
Fixed in Firefox 65:
https://bugzilla.mozilla.org/show_bug.cgi?id=1503015

https://pagure.io/freeipa/issue/7809

Reviewed-By: Sergey Orlov <sorlov@redhat.com>
2018-12-13 21:14:57 +01:00
Serhii Tsymbaliuk
07c163ca92
Fix "ID views" tests fail after running "Automember" tests
Clear default user/host group before deleting.

https://pagure.io/freeipa/issue/7771

Reviewed-By: Christian Heimes <cheimes@redhat.com>
2018-11-27 14:20:34 +01:00
Christian Heimes
f800d8f8ca pylint: Fix duplicate-string-formatting-argument
pylint 2.2 has a checker for duplicate string formatting argument.
Instead of passing the same argument multiple times, reference the
argument by position.

See: https://pagure.io/freeipa/issue/7772
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
2018-11-26 16:54:43 +01:00
Christian Heimes
713607769e Fix useless-import-alias
See: https://pagure.io/freeipa/issue/7758
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2018-11-13 13:37:58 +01:00
Christian Heimes
496d1756c9 Address consider-using-in
Replace multiple comparisons with 'in' operation.

See: https://pagure.io/freeipa/issue/7758
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2018-11-13 13:37:58 +01:00
Serhii Tsymbaliuk
8954521007
WebUI tests: Make possible to use kwargs with @screenshot decorator
Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
8f2a75cb00
UI tests for "Automount": check dialog confirmation using ENTER
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
6444808fd2
UI tests for "Automount": check some negative cases
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
ba40590e9d
UI tests for "Automount": check indirect map duplication
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
b7a149feb2
UI tests for "Automount": check creating automount key without some fields
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
de06bf2778
UI tests for "Automount": check creating indirect automount map without some fields
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
97f158aeec
UI tests for "Automount": Fix item deleting
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
e957e0aef0
UI tests for "Automount": check modifying map and key settings
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
1d4b43efa4
UI tests for "Automount": check "Add Automount..." dialogs
https://pagure.io/freeipa/issue/7735

Reviewed-By: Petr Cech <pcech@redhat.com>
2018-10-31 11:55:35 +01:00
Serhii Tsymbaliuk
8949aa64d9
UI tests for "Automember": Extend search cases
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
cd795257cc
UI tests for "Automember": Negative cases
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
33a74fb2c4
UI tests for "Automember": check setting default user/host group
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
a68035dcae
UI tests for "Automember": check creating and deleting of automember rule conditions
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
63cbf6294e
UI tests for "Automember": check creating and deleting of multiple rules
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
49df1ab1c8
UI tests for "Automember": check search filter
https://pagure.io/freeipa/issue/7721

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Cech <pcech@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-30 16:26:29 +01:00
Serhii Tsymbaliuk
4c3f010461 UI tests for "ID Range": Clean unnecessary Python2 compatible code constructions
https://pagure.io/freeipa/issue/7709

Reviewed-By: Christian Heimes <cheimes@redhat.com>
2018-10-16 09:09:02 +02:00
Serhii Tsymbaliuk
2d845cc70a UI tests for "ID Range": check deleting primary local range
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
6595949e1d UI tests for "ID Range": check creating ID Range with overlapping of primary and secondary RID base
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
dd590e7ea7 UI tests for "ID Range": - check creating ID range with special characters in name - check modifying ID range with existing secondary RID base
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
70f51c0db2 UI tests for "ID Range": check modifying ID range with invalid or missing values
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
dde4d19f7b UI tests for "ID Range": check adding range with overlapping of existing local range
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
b180991aca UI tests for "ID Range": check primary RID base duplication
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
369fb23ed9 UI tests for "ID Range": check adding range without primary and secondary RID bases
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Serhii Tsymbaliuk
e55d17d609 UI tests for "ID Range": check range name and base ID duplication
https://pagure.io/freeipa/issue/7709

Reviewed-By: Mohammad Rizwan Yusuf <myusuf@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
2018-10-15 14:11:42 +02:00
Christian Heimes
15d5e44ee8 Py3: Replace six.moves imports
Replace six.moves and six.StringIO/BytesIO imports with cannonical
Python 3 packages.

Note: six.moves.input behaves differently than builtin input function.
Therefore I left six.moves.input for now.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
2018-10-05 12:06:19 +02:00
Christian Heimes
b431e9b684 Py3: Remove subclassing from object
Python 2 had old style and new style classes. Python 3 has only new
style classes. There is no point to subclass from object any more.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2018-09-27 11:49:04 +02:00