diff options
author | tester <test@example.com> | 2016-07-20 14:49:31 +0200 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-08-01 17:07:49 +0200 |
commit | 37c0bd1dd6e19dd4afefb47ab52ace0a25f2ca82 (patch) | |
tree | d9dac4ffcee47547e1a9e6bba028a6e62d26eea9 /ipatests | |
parent | 45825b84b0d140f62e1459c3b5dbb5281229cad6 (diff) | |
download | freeipa-37c0bd1dd6e19dd4afefb47ab52ace0a25f2ca82.tar.gz freeipa-37c0bd1dd6e19dd4afefb47ab52ace0a25f2ca82.tar.xz freeipa-37c0bd1dd6e19dd4afefb47ab52ace0a25f2ca82.zip |
TEST: managing user certificates
Part of: https://fedorahosted.org/freeipa/ticket/6064
Reviewed-By: Lenka Doudova <ldoudova@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r-- | ipatests/test_webui/test_user.py | 111 |
1 files changed, 110 insertions, 1 deletions
diff --git a/ipatests/test_webui/test_user.py b/ipatests/test_webui/test_user.py index e926c2212..a1fc7076a 100644 --- a/ipatests/test_webui/test_user.py +++ b/ipatests/test_webui/test_user.py @@ -38,7 +38,15 @@ except ImportError: @pytest.mark.tier1 -class test_user(UI_driver): +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): @@ -164,6 +172,107 @@ class test_user(UI_driver): 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) + realm = self.config.get('ipa_realm') + 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 |