summaryrefslogtreecommitdiffstats
path: root/ipatests
Commit message (Collapse)AuthorAgeFilesLines
* webui:tests: realm domain add with DNS checkPetr Vobornik2018-02-161-4/+58
| | | | | | | | | | | | Try adding and deleting with "Check DNS" (in html 'ok' button) DNS check expects that the added domain will have DNS record: TXT _kerberos.$domain "$REALM" When a new domain is added using dnszone-add it automatically adds this TXT record and adds a realm domain. So in order to test without external DNS we must get into state where realm domain is not added (in order to add it) but DNS domain with the TXT record exists.
* webui:tests: move DNS test data to separate filePetr Vobornik2018-02-162-60/+69
| | | | | So that the data can be used in other test without running the DNS tests.
* WebUI Tests: changing the ActionsChains.move_to_element to a new approachFelipe Barreto2018-02-161-5/+11
| | | | | | | | | | | | | | | The approach ActionChains.move_to_element no longer works as said here [1], so, it's necessary to change it to the new one. This means, running a javascript script to move the page to where the element is. There are more details in the link [1], but in summary the w3c spec is not obvious if a click should scroll the page to the element or not. In one hand Chrome and Edge does that, but Firefox don't. As we use Firefox to run the tests, we need the workaround. [1] https://github.com/mozilla/geckodriver/issues/776 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: fixing test_user.py::test_test_noprivate_posixFelipe Barreto2018-02-161-0/+1
| | | | | | | | When filling the combo box (the gidnumber) in the dialog to create a new user, the Add button was also clicked; closing the dialog. The wait makes it to not click. Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: Changing how the initial load process is doneFelipe Barreto2018-02-161-1/+19
| | | | | | | | | | | | | | Instead of always entering the address on the address bar and reloading the application, now the code checks if that is necessary. With the change, the logout process is done correctly and we do not keep any AJAX call left behind. Which could cause the user not being logout properly and breaking the tests. More about the logout problem described in: https://github.com/freeipa/freeipa/pull/1479 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: fixing test_range test caseFelipe Barreto2018-02-162-2/+37
| | | | | | | | | | | | | As described in the commit [1] and ticket [2], it should not be possible to change the range of a local IPA domain. The basic_crud was changed to make it flexible to do not run the mod operation if needed. [1] 55feea500be1f4ae7bf02ef3c48377a6751ca71d [2] https://pagure.io/freeipa/issue/4826 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: changing how the login screen is detectedFelipe Barreto2018-02-161-9/+11
| | | | | | | | | | | The "rcue-login-screen" element does not exist anymore. Changing the code to use the ".login-pf" instead. With the change, it's also necessary to check if the login screen is still visible when trying to fill the fields of new password, otherwise a StaleElementReferenceException exception will be raised. Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: refactoring login method to be more readableFelipe Barreto2018-02-161-25/+28
| | | | Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: fixing test_navigationFelipe Barreto2018-02-161-3/+5
| | | | | | | Removing old menu options, including idview and navigation on the side bar Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: fixing test_groupFelipe Barreto2018-02-161-1/+1
| | | | | | Removing old data that is not needed anymore. Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* WebUI Tests: fixing test_hbacFelipe Barreto2018-02-161-10/+11
| | | | | | | Adding more wait_for_request between navigation and small code refactor. Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
* Have all the scripts run in python 3 by defaultStanislav Laznicka2018-02-157-7/+7
| | | | | | | | | The Python 3 refactoring effort is finishing, it should be safe to turn all scripts to run in Python 3 by default. https://pagure.io/freeipa/issue/4985 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Unified ldap_initialize() functionChristian Heimes2018-02-153-5/+8
| | | | | | | | | | | Replace all ldap.initialize() calls with a helper function ldap_initialize(). It handles cacert and cert validation correctly. It also provides a unique place to handle python-ldap 3.0 bytes warnings in the future. Fixes: https://pagure.io/freeipa/issue/7411 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
* 389-ds OTP lasttoken plugin: Add unit testFlorence Blanc-Renaud2018-02-151-0/+173
| | | | | | | | | | | Add a xmlrpc test checking that a user cannot delete his last OTP token. Related to https://pagure.io/freeipa/issue/7012 Reviewed-By: Nathaniel McCallum <npmccallum@redhat.com> Reviewed-By: Alexey Slaykovsky <alexey@slaykovsky.com>
* Fix i18n test for Chinese translationChristian Heimes2018-02-151-9/+18
| | | | | | | | | | Python 3's regular expression default to full range of unicode characters. Restrict \w matches to ASCII and drop \b suffix check to fix a problem with validation the Chinese translation zh_CN. Co-Authored-By: Stanislav Laznicka <slaznick@redhat.com> Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
* Generate same API.txt under Python 2 and 3Christian Heimes2018-02-151-2/+6
| | | | | | | | | Use Python 3's reprlib with customizations to create same API.txt under Python 2 and 3. Some plugins have been slightly altered to use stable sorting for dynamically created parameter lists. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
* test_backup_and_restore.py Fix loggingAleksei Slaikovskii2018-02-141-3/+3
| | | | | | Use strings to log in restore_checker and backup functions. Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Before the fix, when ipa-backup was called for the first time, the LDAP ↵Mohammad Rizwan Yusuf2018-02-141-0/+52
| | | | | | | | | | | | | | | | database exported to /var/lib/dirsrv/slapd-<instance>/ldif/<instance>-userRoot.ldif. db2ldif is called for this and it runs under root, hence files were owned by root. When ipa-backup called the next time, the db2ldif fails, because the tool does not have permissions to write to the ldif file which was owned by root (instead of dirsrv) This test check if files are owned by dirsrv and db2ldif doesn't fails related ticket: https://pagure.io/freeipa/issue/7010 Signed-off-by: Mohammad Rizwan Yusuf <myusuf@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
* ipa host-add --ip-address: properly handle NoNameserversFlorence Blanc-Renaud2018-02-121-0/+72
| | | | | | | | | | | | | | | | When ipa host-add --ip-address is called but no DNS server is able to answer for the reverse zone, get_reverse_zone raises a NoNameservers exception. The exception is not managed by add_records_for_host_validation, and this leads to the command exiting on failure with an InternalError: $ ipa host-add testhost.ipadomain.com --ip-address 172.16.30.22 ipa: ERROR: an internal error has occurred A traceback is also logged in httpd error_log. This commit properly handles the exception, and adds a test. https://pagure.io/freeipa/issue/7397 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Enable and start oddjobd after ipa-restore if it's not running.Aleksei Slaikovskii2018-02-093-36/+110
| | | | | | | | | | | | | | If after ipa-restore the service oddjobd is not running, domain-level1 replica installation will fail during ipa-replica-conncheck because this step is using oddjob to start the process ipa-replica-conncheck on the master. This patch fixes it. Also added regression test. https://pagure.io/freeipa/issue/7234 Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
* Fix detection of KRA installation so upgrades can succeedRob Crittenden2018-02-081-0/+21
| | | | | | | | | | | Use is_installed() instead of is_configured() because is_installed() does a config file check to see if the service is in use. https://pagure.io/freeipa/issue/7389 Signed-off-by: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
* Replace hard-coded paths with path constantsChristian Heimes2018-02-085-11/+14
| | | | | | | | | | | Several run() calls used hard-coded paths rather than pre-defined paths from ipaplatform.paths. The patch fixes all places that I was able to find with a simple search. The fix simplifies Darix's port of freeIPA on openSuSE. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
* ipa_tests: test subca key replicationMichal Reznik2018-02-071-3/+46
| | | | | | | | Test if key replication is not failing. https://pagure.io/freeipa/issue/7387 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Make IntegrationTest fail if an error happened during uninstallFelipe Barreto2018-02-072-3/+1
| | | | | | | | | | | | | | Before this change, if the uninstall process fails, the test would not fail, due to the raiseonerr=False. It's necessary to remove the uninstall call in CALessBase because in TestIntegration there is another uninstall call. So, without the raiseonerr=False, it would make the uninstall process fail, since the master is already uninstalled. https://pagure.io/freeipa/issue/7357 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* IntegrationTests now collects logs from all test methodsFelipe Barreto2018-02-061-2/+0
| | | | | | | | | | logs_dict should not be cleared. It's filled once per class and it should not be cleared after running the first test. https://pagure.io/freeipa/issue/7310 https://pagure.io/freeipa/issue/7335 Reviewed-By: Michal Reznik <mreznik@redhat.com>
* Updated the TestExternalCA with the functions introduced for the steps of ↵Mohammad Rizwan Yusuf2018-02-061-19/+8
| | | | | | | external CA installation. Signed-off-by: Mohammad Rizwan Yusuf <myusuf@redhat.com> Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
* When the dirsrv service, which gets started during the first ↵Mohammad Rizwan Yusuf2018-02-061-0/+71
| | | | | | | | | | | | ipa-server-install --external-ca phase, is not running when the second phase is run with --external-cert-file options, the ipa-server-install command fail. This test checks if second phase installs successfully when dirsrv is stoped. related ticket: https://pagure.io/freeipa/issue/6611 Signed-off-by: Mohammad Rizwan Yusuf <myusuf@redhat.com> Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
* IANA reserved IP address can not be used as a forwarder. This test checks if ↵Mohammad Rizwan Yusuf2018-01-311-0/+42
| | | | | | | | | ipa server installation throws an error when 0.0.0.0 is specified as forwarder IP address. related ticket: https://pagure.io/freeipa/issue/6894 Signed-off-by: Mohammad Rizwan Yusuf <myusuf@redhat.com> Reviewed-By: Tibor Dudlak <tdudlak@redhat.com>
* test_integration: backup custodia conf and keysFlorence Blanc-Renaud2018-01-291-0/+13
| | | | | | | | | | | Add an integration test for issue 7247 (ipa-backup does not backup Custodia keys and files) The test performs backup / uninstall / check custodia files were removed / restore and check that the custodia conf and keys files are restored. related ticket https://pagure.io/freeipa/issue/7247 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Fixing test_backup_and_restore assert to do not rely on the orderFelipe Barreto2018-01-171-0/+9
| | | | | | | | | | | | | | | Since we cannot assume that LDAP will return data in any ordered way, the test should be changed to do not rely on that. Instead of just comparing the output of the show-user command, this change first order the groups returned in the 'Member of Group' field before compare them. https://pagure.io/freeipa/issue/7339 Reviewed-By: Aleksei Slaikovskii <aslaikov@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
* test_caless: add SAN extension to other certsMichal Reznik2018-01-171-5/+5
| | | | | | | | | Currently when testing we are using SAN extension only in KDC, wildcard certs and not in the other certs. During replica installation we then see a warning about certs having no `subjectAltName`. Reviewed-By: Christian Heimes <cheimes@redhat.com>
* ipa-run-tests: make --ignore absolute, tooChristian Heimes2018-01-121-0/+9
| | | | | | | | | | ipa-run-tests now applies the same logic to --ignore then to included paths. https://pagure.io/freeipa/issue/7355 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Michal Reznik <mreznik@redhat.com>
* tests: move CA related modules to pytest_pluginsMichal Reznik2018-01-093-2/+2
| | | | | | | | | | | | | Till now both create_caless_pki.py and create_external_ca.py were stored in test_integration folder. However when trying to import e.g. "from create_external_ca import ExternalCA" from tasks.py where all other integration test`s support functions lives we get "AttributeError: module 'pytest' has no attribute 'config' as pytest was not completely initialized at the moment of the import. https://pagure.io/freeipa/issue/7302 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
* test_external_ca: selfsigned->ext_ca->selfsignedMichal Reznik2018-01-091-19/+106
| | | | | | | | | | Add selfsigned > external_ca > selfsigned test case. Covers Pagure issue #7106 https://pagure.io/freeipa/issue/7302 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
* test_tasks: add sign_ca_and_transport() functionMichal Reznik2018-01-091-0/+28
| | | | | | | | | Add sign_ca_and_transport() function which will sign provided csr and transport root CA and signed IPA CA to the host. https://pagure.io/freeipa/issue/7302 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
* test_caless: test PKINIT install and anchor updateMichal Reznik2018-01-091-7/+34
| | | | | | | | | Add test case for installing PKINIT and anchor update when using 3rd party CA after caless installation. Related to #6831 issue. https://pagure.io/freeipa/issue/7233 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* test_renewal_master: add ipa csreplica-manage testMichal Reznik2018-01-091-2/+45
| | | | | | | | | | | | Add test case for setting renewal master using command ipa-csreplica-manage. Automation related to upstream ticket #7120. Testing using config-mod already covered. https://pagure.io/freeipa/issue/7321 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Fixing test_testconfig with proper assertsFelipe Barreto2018-01-092-12/+30
| | | | | | | | | | | | | When the cls in env_config.py is a WinHost, the __init__ receives different parameters. Now, it's adapted to all different kinds of hosts. Also, it's necessary to add the host_type field to most of domains created in the test classes, because the field is returned by pytest_multihost.Config in pytest_plugins/integration/config.py::Config::to_dict https://pagure.io/freeipa/issue/7346 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* test_backup_and_restore.py AssertionError fixAleksei Slaikovskii2018-01-091-3/+2
| | | | | | | | | | prefix in the backup function expects output to have 'ipa.ipaserver.install.ipa_backup.Backup:' and it's wrong. The right one is 'ipaserver.install.ipa_backup:'. https://pagure.io/freeipa/issue/7339 Reviewed-By: Felipe Volpone <fbarreto@redhat.com>
* Idviews: fix objectclass violation on idview-addFlorence Blanc-Renaud2018-01-091-0/+35
| | | | | | | | | | | | | | | | | | | | When the option --domain-resolution-order is used with the command ipa idview-add, the resulting LDAP object stores the value in ipadomainresolutionorder attribute. The issue is that the add command does not add the needed object class (ipaNameResolutionData) because it is part of possible_objectclasses but not of object_class. The fix makes sure to add the objectclass when the option --domain-resolution-order is used, and adds a non-regression test. Note that idview-mod does not have any issue as it correctly handles the addition of missing possible objectclasses. Fixes: https://pagure.io/freeipa/issue/7350 Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
* LGTM: unnecessary else in for loopChristian Heimes2018-01-091-2/+2
| | | | | | | | for/else makes only sense when the for loop uses break, too. If the for loop simply returns on success, then else is not necessary. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
* LGTM: Fix multiple use before assignmentChristian Heimes2018-01-091-1/+2
| | | | | | | | | | | - Move assignment before try/finally block - Add raise to indicate control flow change - Add default value https://pagure.io/freeipa/issue/7344 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
* LGTM: Use of exit() or quit()Christian Heimes2018-01-092-11/+17
| | | | | | | | | | Replace exit() with sys.exit(). exit() or quit() may fail if the interpreter is run with the -S option. https://pagure.io/freeipa/issue/7344 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
* ipa-run-tests: replace chdir with pluginChristian Heimes2018-01-041-5/+36
| | | | | | | | | | | | | | | | | | | The ipa-run-tests command used os.chdir() to change into the ipatests/ directory. The approach works for simple cases but breaks some pytest features. For example it makes it impossible to selects tests by their fully qualified test name. Further more, coverage statistics break because path and module names get messed up by chdir. A name plugin takes care of adjusting paths relative to ipatests and to add ipatests as base. It's now possible to run tests with qualified test names, e.g. ipa-run-tests ipatests/test_ipalib/test_base.py::test_ReadOnly::test_lock Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Felipe Volpone <fbarreto@redhat.com>
* test_cert_plugin: check if SAN is added with default profileMichal Reznik2018-01-041-8/+17
| | | | | | https://pagure.io/freeipa/issue/7334 Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
* test_help: test "help" command without cacheMichal Reznik2017-12-191-0/+25
| | | | | | | | | This test case addresses upsteam ticket #6999, where "ipa help" does not work if called when no schema is cached. https://pagure.io/freeipa/issue/7325 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Replace nose with unittest and pytestChristian Heimes2017-12-1230-324/+385
| | | | | | | | | | | | | | | | | * Replace raise nose.SkipTest with raise unittest.SkipTest * Replace nose.tools.assert_equal(a, b) with assert a == b * Replace nose.tools.raises with pytest.raises * Convert @raises decorator to pytest.raises() but just for relevant lines. * Remove nose dependency I left the nose_compat pytest plugin in place. It can be removed in another request in case it is no longer used. https://pagure.io/freeipa/issue/7301 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
* Extend ui_driver to support geckodriver log_pathPavel Vomacka2017-12-121-1/+2
| | | | | | | | | | | | | | | | | Geckodriver automatically logs into geckodriver.log file which is placed in the same directory from which tests are run. In case of running tests using ipa-run-tests the current working directory is /usr/lib/python*/site-packages/ipatests where most of users cannot write because of priviledges. By adding "geckodriver_log_path" into test configuration we allow to set path where user who run tests have priviledges to write. Config file might be seen here: https://www.freeipa.org/page/Web_UI_Integration_Tests#Running_tests Fixes: https://pagure.io/freeipa/issue/7311 Reviewed-By: Christian Heimes <cheimes@redhat.com>
* Add safe DirectiveSetter context managerChristian Heimes2017-12-121-0/+67
| | | | | | | | | | | | | | | installutils.set_directive() is both inefficient and potentially dangerous. It does not ensure that the whole file is written and properly synced to disk. In worst case it could lead to partially written or destroyed config files. The new DirectiveSetter context manager wraps everything under an easy to use interface. https://pagure.io/freeipa/issue/7312 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
* Add tests for installutils.set_directiveFraser Tweedale2017-12-121-0/+57
| | | | | | Part of: https://pagure.io/freeipa/issue/7288 Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>