Пример #1
0
def get_file_storage_from_swagger():
    response = rest_crud.get_raw('explore/v2/swagger.yaml')
    spec = yaml.load(response.text, Loader=yaml.FullLoader)
    if isinstance(spec, basestring) or 'paths' not in spec.keys():
        raise cli_exception.CliException(
            'Unable to reach Neoload Web API. Bad URL or bad swagger file at /explore/v2/swagger.yaml.'
        )
    return spec['paths']['/tests/{testId}/project']['servers'][0]['url']
Пример #2
0
def get_nlweb_information():
    response = rest_crud.get_raw('v2/informations')
    if response.status_code == 200:
        json = response.json()
        __user_data_singleton.url(json['front_url'], json['filestorage_url'],
                                  json['version'])
        return True
    else:
        return False
Пример #3
0
def get_nlweb_information():
    try:
        response = rest_crud.get_raw('v3/information')
        if response.status_code == 401:
            raise cli_exception.CliException(response.text)
        elif response.status_code == 200:
            json = response.json()
            __user_data_singleton.set_url(json['front_url'], json['filestorage_url'], json['version'])
            return True
        else:
            return False
    except requests.exceptions.MissingSchema as err:
        raise cli_exception.CliException('Unable to reach Neoload Web API. The URL must start with https:// or http://'
                                         + '. Details: ' + str(err))
    except requests.exceptions.ConnectionError as err:
        raise cli_exception.CliException('Unable to reach Neoload Web API. Bad URL. Details: ' + str(err))
    except JSONDecodeError as err:
        raise cli_exception.CliException('Unable to parse the response of the server. Did you set the frontend URL'
                                         + ' instead of the API url ? Details: ' + str(err))
Пример #4
0
def get_file_storage_from_swagger():
    response = rest_crud.get_raw('explore/v2/swagger.yaml')
    spec = yaml.load(response.text, Loader=yaml.FullLoader)
    return spec['paths']['/tests/{testId}/project']['servers'][0]['url']