def add_test_server(self, ip, name, ssh_private_key, host_public_key, server_url): """Add a test server using the landing page. Args: ip: A string for the ip address of the server to add. name: A string for the name of the server to add. ssh_private_key: A string for the ssh private key of the server to add. host_public_key: A string for the host public key of the server to add. server_url: The base url portion of the setup page. """ self.go_to_landing_page(server_url) # Navigate to add server. add_server_button = self.get_element(UfOPageLayout.ADD_SERVER_BUTTON) add_server_button.click() WebDriverWait(self.driver, UfOPageLayout.DEFAULT_TIMEOUT).until( EC.visibility_of_element_located( ((UfOPageLayout.ADD_SERVER_MODAL)))) add_server_modal = self.driver.find_element( *LandingPage.ADD_SERVER_MODAL) server_form = ServerForm(self.driver) server_form.addServer(add_server_modal, ip, name, ssh_private_key, host_public_key)
def add_test_server(self, ip, name, ssh_private_key, host_public_key, server_url): """Add a test server using the setup page. Args: ip: A string for the ip address of the server to add. name: A string for the name of the server to add. ssh_private_key: A string for the ssh private key of the server to add. host_public_key: A string for the host public key of the server to add. server_url: The base url portion of the setup page. """ # Navigate to add server. self.driver.get(server_url + flask.url_for('setup')) proxy_server_add_template = self.get_element( UfOPageLayout.PROXY_SERVER_DISPLAY_TEMPLATE) server_form = ServerForm(self.driver) server_form.addServer(proxy_server_add_template, ip, name, ssh_private_key, host_public_key)
def add_test_server(self, ip, name, ssh_private_key, host_public_key, server_url): """Add a test server using the landing page. Args: ip: A string for the ip address of the server to add. name: A string for the name of the server to add. ssh_private_key: A string for the ssh private key of the server to add. host_public_key: A string for the host public key of the server to add. server_url: The base url portion of the setup page. """ self.go_to_landing_page(server_url) # Navigate to add server. add_server_button = self.get_element(UfOPageLayout.ADD_SERVER_BUTTON) add_server_button.click() WebDriverWait(self.driver, UfOPageLayout.DEFAULT_TIMEOUT).until( EC.visibility_of_element_located(((UfOPageLayout.ADD_SERVER_MODAL)))) add_server_modal = self.driver.find_element(*LandingPage.ADD_SERVER_MODAL) server_form = ServerForm(self.driver) server_form.addServer(add_server_modal, ip, name, ssh_private_key, host_public_key)
def editTestServer(self, old_name, ip, name, ssh_private_key, host_public_key, server_url): """Edit a test server using the landing page (the only way). Args: old_name: A string for the name of the test server to edit. ip: A string for the ip address of the server to edit. name: A string for the name of the server to edit. ssh_private_key: A string for the ssh private key of the server to edit. host_public_key: A string for the host public key of the server to edit. server_url: The base url portion of the landing page. """ self.go_to_landing_page(server_url) # Find the server and navigate to its details page. landing_page = LandingPage(self.driver) server_list = landing_page.get_element(LandingPage.SERVER_LIST_ITEM) server_listbox = server_list.find_element(*LandingPage.GENERIC_LISTBOX) server_item = landing_page.findItemInListing(server_listbox, old_name) if server_item is None: raise Exception else: server_item.click() # Click edit on that server. details_modal = server_item.find_element(*LandingPage.DETAILS_MODAL) WebDriverWait(self.driver, UfOPageLayout.DEFAULT_TIMEOUT).until( EC.visibility_of(details_modal)) edit_button = details_modal.find_element( *LandingPage.SERVER_EDIT_BUTTON) edit_button.click() # Perform the actual edits server_form = ServerForm(self.driver) server_form.editServer(details_modal, ip, name, ssh_private_key, host_public_key)
def editTestServer(self, old_name, ip, name, ssh_private_key, host_public_key, server_url): """Edit a test server using the landing page (the only way). Args: old_name: A string for the name of the test server to edit. ip: A string for the ip address of the server to edit. name: A string for the name of the server to edit. ssh_private_key: A string for the ssh private key of the server to edit. host_public_key: A string for the host public key of the server to edit. server_url: The base url portion of the landing page. """ self.go_to_landing_page(server_url) # Find the server and navigate to its details page. landing_page = LandingPage(self.driver) server_list = landing_page.get_element(LandingPage.SERVER_LIST_ITEM) server_listbox = server_list.find_element(*LandingPage.GENERIC_LISTBOX) server_item = landing_page.findItemInListing(server_listbox, old_name) if server_item is None: raise Exception else: server_item.click() # Click edit on that server. details_modal = server_item.find_element(*LandingPage.DETAILS_MODAL) WebDriverWait(self.driver, UfOPageLayout.DEFAULT_TIMEOUT).until( EC.visibility_of(details_modal)) edit_button = details_modal.find_element(*LandingPage.SERVER_EDIT_BUTTON) edit_button.click() # Perform the actual edits server_form = ServerForm(self.driver) server_form.editServer(details_modal, ip, name, ssh_private_key, host_public_key)