def create_temporary_folder(app_connector): client = ssh_connect.start() ssh_connect.execute_command(client, 'rm -r "{}"'.format(folder_path), ignore_error=True) ssh_connect.execute_command(client, 'mkdir {}'.format(folder_path)) yield client ssh_connect.execute_command(client, 'rm -r "{}"'.format(folder_path), ignore_error=True)
def test_stop_media_server(): attach_to_application() client = ssh_connect.start() ssh_connect.execute_command(client, STOP_MEDIASERVER, passwd_required=True) with pytest.raises(VideoStreamingError): waitForObject('Settings') ssh_connect.execute_command(client, START_MEDIASERVER, passwd_required=True) time.sleep(10) waitForObject('Settings')
def get_current_sync_build_version(app_connector): # get version sync from config file client = ssh_connect.start() stdin, stdout, stderr = client.exec_command(CURRENT_SYNC_VERSION) sync = stdout.read()[:-1] stdin, stdout, stderr = client.exec_command(CURRENT_BUILD_VERSION) build = stdout.read()[:-1] yield sync, build ssh_connect.execute_command(client, cmd.VDP_ATE_SERVER_RESTART, passwd_required=True)
def client(attach_to_app): client = start() execute_command( client, 'cd {}; sudo rm -r "{}"'.format(default_folder, folder_name), True, True) execute_command(client, 'cd {}; mkdir {}'.format(default_folder, folder_name), True) yield client execute_command(client, 'cd {}; sudo rm -r {}'.format(default_folder, folder_name), True, True)
def __init__(self, dir_name): self.ssh_client = start() self.dir_name = dir_name self.path_dir = r"{}/{}".format(DIR_PREFIX, self.dir_name) self.result_of_capture_frames = None self.left_point = None self.right_point = None self.expected_resolution = None self.interval = None self.duration = None
def test_port_busy_another_process(): client = ssh_connect.start() ssh_connect.execute_command(client, STOP, passwd_required=True) output = ssh_connect.execute_command(client, CURRENT_DATE) curr_time = output.read()[:-2] client.exec_command(START_TCP, get_pty=False) ssh_connect.execute_command(client, START, passwd_required=True) time.sleep(SLEEP) logs = ssh_connect.execute_command(client, RETRIEVE_LOG) process_time = logs.read().split('\n')[-2][0:12] find_process_on_port_and_kill(client) time.sleep(SLEEP) ssh_connect.execute_command(client, START, passwd_required=True) attach_to_application() assert curr_time == process_time
def __init__(self, config): if type(config) is not dict: raise TypeError('Wrong type, should be dict with parameters') self.client = start() self.config = config self.sync_v = config.get(_attr_name_sync_v, None) self.build = config.get(_attr_name_build, None) self.collection_mode = config.get(_attr_name_collection_mode, None) self.width = config.get(_attr_name_width) self.height = config.get(_attr_name_height) self.diagonal = config.get(_attr_name_diagonal, None) self.display_type_id = SyncResolution.get_type_for_resolution( self.sync_v, self.width, self.height, self.diagonal) self._init_config = self.get_ate_server_ini() self._init_resolution = None self._config_for_cmd = config.copy() self._config_for_cmd.pop(_attr_name_diagonal)
def __change_resolution_sync3(self): client = start() command = cmd.SYNC3_SH.format(self.display_type_id) with client.invoke_shell() as ssh: ssh.send(command) client.close()
def prep_for_neg_test(attach_to_app): ssh_client = start() yield ssh_client ssh_client.close()
def client_setup(): client = start() return client
def test_recovery(): client = ssh_connect.start() ssh_connect.execute_command(client, KILLALL, passwd_required=True) attach_to_application()
def test_check_exception_after_stop_vhat(): client = ssh_connect.start() ssh_connect.execute_command(client, STOP, passwd_required=True) with pytest.raises(RuntimeError): attach_to_application() ssh_connect.execute_command(client, START, passwd_required=True)
def __init__(self, ssh_connection=None): self._ssh = ssh_connection if ssh_connection else start() self._sftp = SCPClient(self._ssh.get_transport())