Esempio n. 1
0
    def __init__(self,
                 entity_path=None,
                 entrypoint=None,
                 host=None,
                 login=None,
                 password=None):
        credentials = conf.get_config("credentials")
        env = conf.get_config("env")
        ftp_data = env.ftpserver
        host = host or ftp_data.host
        login = login or credentials[ftp_data.credentials]["username"]
        password = password or credentials[ftp_data.credentials]["password"]

        self.entrypoint = entrypoint or ftp_data.entrypoint
        self.entity_path = entity_path

        super(FTPClientWrapper, self).__init__(host=host,
                                               login=login,
                                               password=password,
                                               time_diff=False)

        # Change working directory as per entity_path if provided
        self.cwd(
            os.path.join(self.entrypoint,
                         self.entity_path if entity_path else ""))
def test_delete_application(application):
    """
    Test01 -08
    Delete uploaded application file and check if next button gets disabled
    """
    project_name = fauxfactory.gen_alphanumeric(12, start="project_")
    project_collection = application.collections.projects
    view = navigate_to(project_collection, "Add")
    view.create_project.fill({"name": project_name, "description": "desc"})

    env = conf.get_config("env")
    fs = FTPClientWrapper(env.ftpserver.entities.rhamt)
    file_path = fs.download("acmeair-webapp-1.0-SNAPSHOT.war")

    view.add_applications.upload_file.fill(file_path)
    view.add_applications.next_button.wait_displayed()
    view.add_applications.delete_application.click()

    view.add_applications.confirm_delete.wait_displayed()
    view.add_applications.confirm_delete.click()

    view.add_applications.next_button.wait_displayed()
    assert not view.add_applications.next_button.is_enabled
    view.add_applications.back_button.wait_displayed()
    view.add_applications.back_button.click()
    view.add_applications.cancel_button.wait_displayed()
    view.add_applications.cancel_button.click()
def viewer():
    viewer = conf.get_config("selenium").vncviewer
    sel = SeleniumContainer()

    if not viewer:
        click.echo("No VNC viewer found in config file")
        exit(1)

    if not sel.is_running:
        click.echo(f"{sel.name} not in running state")
        exit(1)

    assert shutil.which(viewer)
    subprocess.run([viewer, f"localhost:{sel.vnc_port}"])
 def fill(self, values):
     app_list = values.get("app_list")
     env = conf.get_config("env")
     fs = FTPClientWrapper(env.ftpserver.entities.rhamt)
     for app in app_list:
         # Download application file to analyze
         # This part has to be here as file is downloaded temporarily
         file_path = fs.download(app)
         self.upload_file.fill(file_path)
     wait_for(lambda: self.next_button.is_enabled,
              delay=0.2,
              timeout=60)
     was_change = True
     self.after_fill(was_change)
     return was_change
    def __init__(self,
                 client=None,
                 name=None,
                 image=None,
                 vnc_port=None,
                 webdriver_port=None,
                 network=None):
        default_conf = conf.get_config("selenium")
        self.client = client or default_conf.client
        self.name = name or default_conf.name
        self.image = image or default_conf.image
        self.vnc_port = vnc_port or default_conf.vnc_port
        self.webdriver_port = webdriver_port or default_conf.webdriver_port
        self.network = network or default_conf.network

        assert shutil.which(self.client)
def pytest_configure(config):
    """Hook to get app and conf"""
    config._rhamt_conf = conf
    app = Application(config=conf.get_config("env"))
    plugin = ApplicationHolderPlugin(app)
    config.pluginmanager.register(plugin)