Esempio n. 1
0
def uploaded_files(datetimeformat, jobs):
    files = []
    for file in glob.glob(str(mapping_args.upload_path) + "/*.apk"):
        creationdate = datetime.datetime.fromtimestamp(
            creation_date(file)).strftime(datetimeformat)
        fileJson = (
        {'jobname': os.path.basename(file), 'creation': creationdate, 'type': 'jobType.INSTALLATION'})
        files.append(fileJson)

    for command in jobs:
        files.append({'jobname': command, 'creation': '', 'type': 'jobType.CHAIN'})

    return files
Esempio n. 2
0
def uploaded_files(datetimeformat, jobs):
    files = []
    for file in glob.glob(str(mapping_args.upload_path) + "/*.apk"):
        creationdate = datetime.datetime.fromtimestamp(
            creation_date(file)).strftime(datetimeformat)
        fileJson = ({
            'jobname': os.path.basename(file),
            'creation': creationdate,
            'type': 'jobType.INSTALLATION'
        })
        files.append(fileJson)

    for command in jobs:
        files.append({
            'jobname': command,
            'creation': '',
            'type': 'jobType.CHAIN'
        })

    processJson = ({
        'jobname': 'Reboot-Device',
        'creation': '',
        'type': 'jobType.REBOOT'
    })
    files.append(processJson)
    processJson = ({
        'jobname': 'Restart-Pogo',
        'creation': '',
        'type': 'jobType.RESTART'
    })
    files.append(processJson)
    processJson = ({
        'jobname': 'Stop-Pogo',
        'creation': '',
        'type': 'jobType.STOP'
    })
    files.append(processJson)
    processJson = ({
        'jobname': 'Start-Pogo',
        'creation': '',
        'type': 'jobType.START'
    })
    files.append(processJson)
    return files
Esempio n. 3
0
    def take_screenshot(self, origin=None, adb=False):
        origin = request.args.get('origin')
        useadb = request.args.get('adb', False)
        origin_logger = get_origin_logger(self._logger, origin=origin)
        origin_logger.info('MADmin: Making screenshot')

        devicemappings = self._mapping_manager.get_all_devicemappings()
        adb = devicemappings.get(origin, {}).get('adb', False)
        filename = generate_device_screenshot_path(origin, devicemappings, self._args)

        if useadb == 'True' and self._adb_connect.make_screenshot(adb, origin, "jpg"):
            origin_logger.info('MADMin: ADB screenshot successfully')
        else:
            self.generate_screenshot(origin)

        creationdate = datetime.datetime.fromtimestamp(
            creation_date(filename)).strftime(self._datetimeformat)

        return creationdate