Exemple #1
0
def get_testcases():
    """Query for testcases."""
    args = request.args
    if args.has_key('projectid'):
        args = args.to_dict()
        args['project.id'] = request.args['projectid']
        del args['projectid']
    return JsonResponse(queryFor(Testcase, args))
Exemple #2
0
def get_testplans():
    """Query for existing testplans."""
    # for backwards compatibility
    args = request.args
    if args.has_key('projectid'):
        args = args.to_dict()
        args['project.id'] = request.args['projectid']
        del args['projectid']
    return JsonResponse(queryFor(TestPlan, args))
Exemple #3
0
def get_pipelines():
    """Query for pipelines."""
    args = request.args.to_dict()
    if 'releaseid' in args:
        args['release.releaseId'] = args['releaseid']
        del args['releaseid']
    if 'testplanid' in args:
        args['testplanId'] = args['testplanid']
        del args['testplanid']

    return JsonResponse(queryFor(Pipeline, args))
Exemple #4
0
def get_testruns():
    """Query for testruns."""
    args = request.args.to_dict()
    if 'releaseid' in args:
        args['release.releaseId'] = args['releaseid']
        del args['releaseid']
    if 'testplanid' in args:
        args['testplanId'] = args['testplanid']
        del args['testplanid']

    return JsonResponse(queryFor(Testrun, args))
Exemple #5
0
def get_dashboards():
    """Query for a list of dashboards."""
    args = request.args
    type = BaseDashboard
    if args.has_key('config-type'):
        args = args.to_dict()
        if args['config-type'] in DashboardTypes:
            type = DashboardTypes[args['config-type']]
        else:
            args['configurationType'] = args['config-type']
        del args['config-type']
    return JsonResponse(queryFor(type, args))
Exemple #6
0
def get_system_configurations():
    """Find various system configuration types."""
    args = request.args
    type = BaseSystemConfiguration
    if args.has_key('config-type'):
        args = args.to_dict()
        if args['config-type'] in SystemConfigurationTypes:
            type = SystemConfigurationTypes[args['config-type']]
        else:
            args['configurationType'] = args['config-type']
        del args['config-type']
    return JsonResponse(queryFor(type, args))
Exemple #7
0
def get_results():
    """Query for results."""
    args = request.args.to_dict()
    if 'testrunid' in args:
        args['testrun.testrunId'] = request.args['testrunid']
        del args['testrunid']
    if 'excludestatus' in args:
        args['q'] = "ne(status,\"{}\")".format(args['excludestatus'])
        del args['excludestatus']
    if 'allfields' in args:
        del args['allfields']
    if "orderby" not in args:
        args["orderby"] = '-recorded'

    return JsonResponse(queryFor(Result, args))
Exemple #8
0
def get_projects():
    """Query for available projects in slick"""
    if 'dashboard' in request.args:
        conn = connection.get_connection()
        result = conn[app.config['MONGODB_DBNAME']]['projects'].aggregate([
            {
                '$project': {
                    'name': '$name',
                    'releases': '$releases',
                    'count': {'$size': "$releases.builds"}
                }
            }
        ])
        return JsonResponse(list(result))
    else:
        return JsonResponse(queryFor(Project))
Exemple #9
0
def get_all_matching_configurations():
    """Query for and find configurations (like Environments)."""
    return JsonResponse(queryFor(Configuration))
Exemple #10
0
def get_projects():
    """Query for available projects in slick"""
    return JsonResponse(queryFor(Project))
Exemple #11
0
def get_testrungroups():
    """Query for testrungroups."""
    return JsonResponse(queryFor(TestrunGroup))
Exemple #12
0
def get_users():
    """Query for user accounts."""
    return JsonResponse(queryFor(UserAccount))
Exemple #13
0
def get_result_counts():
    """Get the number of results for a query."""
    return JsonResponse(queryFor(Result).count())
Exemple #14
0
def get_events():
    """Query for slick log events."""
    return JsonResponse(queryFor(SlickLogEvent))