From 95de6f061cc1959030e25bd4d3e27bb1f962d3bb Mon Sep 17 00:00:00 2001 From: Michal Reznik Date: Tue, 13 Mar 2018 18:56:25 +0100 Subject: [PATCH] ui_tests: add funcs to add/remove users public SSH key Add funcs to add/remove users public SSH key. https://pagure.io/freeipa/issue/7441 Reviewed-By: Petr Vobornik --- ipatests/test_webui/ui_driver.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ipatests/test_webui/ui_driver.py b/ipatests/test_webui/ui_driver.py index ee71b3047..f8b53039e 100644 --- a/ipatests/test_webui/ui_driver.py +++ b/ipatests/test_webui/ui_driver.py @@ -1615,6 +1615,34 @@ class UI_driver(object): # add multiple at once and test table delete button self.add_table_associations(table, keys, delete=True) + def add_sshkey_to_user(self, user, ssh_key): + """ + Add ssh public key to particular user + + user (str): user to add the key to + ssh_key (str): public ssh key + """ + self.navigate_to_entity('user') + self.navigate_to_record(user) + + ssh_pub = 'div[name="ipasshpubkey"] button[name="add"]' + self.find(ssh_pub, By.CSS_SELECTOR).click() + self.wait() + self.driver.switch_to.active_element.send_keys(ssh_key) + self.dialog_button_click('update') + self.facet_button_click('save') + + def delete_user_sshkey(self, user): + """ + Delete ssh public key of particular user + """ + self.navigate_to_entity('user') + self.navigate_to_record(user) + + ssh_pub = 'div[name="ipasshpubkey"] button[name="remove"]' + self.find(ssh_pub, By.CSS_SELECTOR).click() + self.facet_button_click('save') + def has_class(self, el, cls): """ Check if el has CSS class