def tearDown(self): print '\n\n\n --- TEARDOWN ---' if sys.exc_info()[0] is not None: make_screenshot(self.driver, name=self.__class__.__name__) if self.project_exists: try: # Remove project print 'Project is going to be removed.' remove_project(self.driver, self.project_name) self.project_exists = False time.sleep(BaseSettings.click_time_wait) _search(self.driver, self.project_name) if element_exists(self.driver, xpath='//a[contains(text(), "%s")]' % self.project_name): self.project_exists = True print 'Project exists: ', self.project_exists print 'Project was removed successfully.' except Exception as e: print 'Project cannot be removed. Error: "%s"' % e if self.resource_exists: print 'Warning! Test cannot remove resource %s. It has to be removed manually.' % self.resource_name if self.project_exists: print 'Warning! Test cannot remove project %s. It has to be removed manually.' % self.project_name self.driver.quit()
def tearDown(self): print '\n\n\n --- TEARDOWN ---' if sys.exc_info()[0] is not None: make_screenshot(self.driver, name=self.__class__.__name__) if self.project_exists: try: # Remove project print 'Project is going to be removed.' remove_project(self.driver, self.project_name) self.project_exists = False print 'Project exists: ', self.project_exists time.sleep(BaseSettings.click_time_wait) _search(self.driver, self.project_name) if element_exists(self.driver, xpath='//a[contains(text(), "%s")]' % self.project_name): self.project_exists = True print 'Project exists: ', self.project_exists print 'Project was removed successfully.' except Exception as e: print 'Project cannot be removed. Error: "%s"' % e if self.ssh_key_exists: try: # Remove ssh key print 'Ssh key is going to be removed.' remove_ssh_key(self.driver, self.key_name, Settings.user_full_name) self.ssh_key_exists = False print 'SSH key exists: ', self.ssh_key_exists _search(self.driver, self.key_name) assert not element_exists( self.driver, xpath='//span[contains(text(), "%s")]' % self.key_name ), ('Error: SSH key with name "%s" was not removed, it still exists' % self.key_name) print 'SSH key was removed successfully.' except Exception as e: print 'SSH key cannot be removed. Error: %s' % e if self.resource_exists: print 'Warning! Test cannot remove resource %s. It has to be removed manually.' % self.resource_name if self.project_exists: print 'Warning! Test cannot remove project %s. It has to be removed manually.' % self.project_name if self.ssh_key_exists: print 'Warning! Test cannot remove ssh key %s. It has to be deleted manually.' % self.key_name self.driver.quit()
def tearDown(self): print '\n\n\n --- TEARDOWN ---' if sys.exc_info()[0] is not None: make_screenshot(self.driver, name=self.__class__.__name__) print 'Provider exists: ', self.provider_exists if self.provider_exists: try: # Remove provider print 'Provider is going to be removed.' remove_provider(self.driver, self.provider_name) self.provider_exists = False print 'Provider exists: ', self.provider_exists time.sleep(BaseSettings.click_time_wait) _search(self.driver, self.provider_name) assert not element_exists(self.driver, xpath='//span[contains(text(), "%s")]' % self.provider_name), ( 'Error: Provider with name "%s" was not removed, it still exists' % self.provider_name) print 'Provider was removed successfully.' except Exception as e: print 'Provider cannot be removed. Error: "%s"' % e if self.project_exists: try: # Remove project print 'Project is going to be removed.' remove_project(self.driver, self.project_name) self.project_exists = False print 'Project exists: ', self.project_exists time.sleep(BaseSettings.click_time_wait) _search(self.driver, self.project_name) if element_exists(self.driver, xpath='//a[contains(text(), "%s")]' % self.project_name): self.project_exists = True print 'Project was removed successfully.' except Exception as e: print 'Project cannot be removed. Error: "%s"' % e if self.resource_exists: print 'Warning! Test cannot unlink resource "%s". It has to be unlinked manually.' % Settings.resource_name if self.provider_exists: print 'Warning! Test cannot remove provider "%s". It has to be removed manually.' % self.provider_name if self.project_exists: print 'Warning! Test cannot remove project "%s". It has to be removed manually.' % self.project_name self.driver.quit()
def tearDown(self): print '\n\n\n --- TEARDOWN ---' if sys.exc_info()[0] is not None: make_screenshot(self.driver, name=self.__class__.__name__) if self.project_exists: try: # Remove project print 'Project is going to be removed.' remove_project(self.driver, self.project_name) self.project_exists = False print 'Project exists: ', self.project_exists time.sleep(BaseSettings.click_time_wait) _search(self.driver, self.project_name) if element_exists(self.driver, xpath='//a[contains(text(), "%s")]' % self.project_name): self.project_exists = True print 'Project exists: ', self.project_exists print 'Project was removed successfully.' except Exception as e: print 'Project cannot be removed. Error: "%s"' % e if self.ssh_key_exists: try: # Remove ssh key print 'Ssh key is going to be removed.' remove_ssh_key(self.driver, self.key_name, Settings.user_full_name) self.ssh_key_exists = False print 'SSH key exists: ', self.ssh_key_exists _search(self.driver, self.key_name) assert not element_exists(self.driver, xpath='//span[contains(text(), "%s")]' % self.key_name), ( 'Error: SSH key with name "%s" was not removed, it still exists' % self.key_name) print 'SSH key was removed successfully.' except Exception as e: print 'SSH key cannot be removed. Error: %s' % e if self.resource_exists: print 'Warning! Test cannot remove resource %s. It has to be removed manually.' % self.resource_name if self.project_exists: print 'Warning! Test cannot remove project %s. It has to be removed manually.' % self.project_name if self.ssh_key_exists: print 'Warning! Test cannot remove ssh key %s. It has to be deleted manually.' % self.key_name self.driver.quit()
def tearDown(self): print '\n\n\n --- TEARDOWN ---' if sys.exc_info()[0] is not None: make_screenshot(self.driver, name=self.__class__.__name__) if self.application_project_exists: try: # Remove application project print 'Application project is going to be removed.' remove_application_project(self.driver, self.project_name, self.application_project_name) self.application_project_exists = False print 'Application project exists: ', self.application_project_exists _search(self.driver, self.application_project_name) print 'Wait till application project will be removed' try: WebDriverWait( self.driver, Settings.time_wait_to_remove_application).until( EC.invisibility_of_element_located( (By.XPATH, '//a[contains(text(), "%s")]' % self.application_project_name))) except TimeoutException as e: print 'Error: Application project with name "%s" was not removed, it still exists' % self.application_project_name raise e else: print 'Application project was removed successfully.' except Exception as e: print 'Application project cannot be removed. Error: %s' % e if self.application_group_exists: try: # Remove application group print 'Application group is going to be removed.' remove_application_group(self.driver, self.project_name, self.application_group_name) self.application_group_exists = False print 'Application group exists: ', self.application_group_exists _search(self.driver, self.application_group_name) print 'Wait till application group will be removed' try: WebDriverWait( self.driver, Settings.time_wait_to_remove_application).until( EC.invisibility_of_element_located( (By.XPATH, '//a[contains(text(), "%s")]' % self.application_group_name))) except TimeoutException as e: print 'Error: Application group with name "%s" was not removed, it still exists' % self.application_group_name raise e else: print 'Application group was removed successfully.' except Exception as e: print 'Application group cannot be removed. Error: %s' % e if self.project_exists: try: # Remove project print 'Project is going to be removed.' remove_project(self.driver, self.project_name) self.project_exists = False print 'Project exists: ', self.project_exists time.sleep(BaseSettings.click_time_wait) _search(self.driver, self.project_name) if element_exists(self.driver, xpath='//a[contains(text(), "%s")]' % self.project_name): self.project_exists = True print 'Project was removed successfully.' except Exception as e: print 'Project cannot be removed. Error: "%s"' % e if self.application_project_exists: print 'Warning! Test cannot remove application project %s. It has to be removed manually.' % self.application_project_name if self.application_group_exists: print 'Warning! Test cannot remove application group %s. It has to be removed manually.' % self.application_group_name if self.project_exists: print 'Warning! Test cannot remove project %s. It has to be removed manually.' % self.project_name self.driver.quit()
def tearDown(self): print '\n\n\n --- TEARDOWN ---' if sys.exc_info()[0] is not None: make_screenshot(self.driver, name=self.__class__.__name__) if self.application_project_exists: try: # Remove application project print 'Application project is going to be removed.' remove_application_project(self.driver, self.project_name, self.application_project_name) self.application_project_exists = False print 'Application project exists: ', self.application_project_exists _search(self.driver, self.application_project_name) print 'Wait till application project will be removed' try: WebDriverWait(self.driver, Settings.time_wait_to_remove_application).until( EC.invisibility_of_element_located((By.XPATH, '//a[contains(text(), "%s")]' % self.application_project_name))) except TimeoutException as e: print 'Error: Application project with name "%s" was not removed, it still exists' % self.application_project_name raise e else: print 'Application project was removed successfully.' except Exception as e: print 'Application project cannot be removed. Error: %s' % e if self.application_group_exists: try: # Remove application group print 'Application group is going to be removed.' remove_application_group(self.driver, self.project_name, self.application_group_name) self.application_group_exists = False print 'Application group exists: ', self.application_group_exists _search(self.driver, self.application_group_name) print 'Wait till application group will be removed' try: WebDriverWait(self.driver, Settings.time_wait_to_remove_application).until( EC.invisibility_of_element_located((By.XPATH, '//a[contains(text(), "%s")]' % self.application_group_name))) except TimeoutException as e: print 'Error: Application group with name "%s" was not removed, it still exists' % self.application_group_name raise e else: print 'Application group was removed successfully.' except Exception as e: print 'Application group cannot be removed. Error: %s' % e if self.project_exists: try: # Remove project print 'Project is going to be removed.' remove_project(self.driver, self.project_name) self.project_exists = False print 'Project exists: ', self.project_exists time.sleep(BaseSettings.click_time_wait) _search(self.driver, self.project_name) if element_exists(self.driver, xpath='//a[contains(text(), "%s")]' % self.project_name): self.project_exists = True print 'Project was removed successfully.' except Exception as e: print 'Project cannot be removed. Error: "%s"' % e if self.application_project_exists: print 'Warning! Test cannot remove application project %s. It has to be removed manually.' % self.application_project_name if self.application_group_exists: print 'Warning! Test cannot remove application group %s. It has to be removed manually.' % self.application_group_name if self.project_exists: print 'Warning! Test cannot remove project %s. It has to be removed manually.' % self.project_name self.driver.quit()