Ejemplo n.º 1
0
    def used_by_project(self):
        from app.models.ConfigCopy import ConfigCopy
        from app.models.ConfigRelation import ConfigRelation
        pid_list = []
        copy_configs = ConfigCopy.query.filter_by(case_id=self.id,
                                                  delete_time=None).all()
        for config in copy_configs:
            pid_list.append(config.project_id)

        relation_configs = ConfigRelation.query.filter_by(
            case_id=self.id, delete_time=None).all()
        for config in relation_configs:
            pid_list.append(config.project_id)

        project_list = []
        for pid in pid_list:
            from app.models.project import Project
            project = Project.query.filter_by(id=pid).first()
            p = {
                'name': project.name,
                'id': pid,
                'type': project.type,
                'type_name': ProjectTypeEnum.data()[project.type],
            }
            project_list.append(p)

        return project_list
Ejemplo n.º 2
0
        'deal': case.deal,
        'expect': case.expect,
        'header': case.header,
        'info': case.info,
        'method_text': CaseMethodEnum.data()[case.method],
        'method': case.method,
        'reason': case.reason,
        'submit_text': CaseSubmitEnum.data()[case.submit],
        'submit': case.submit,
        'type': CaseTypeEnum.data()[case.type],
        'url': case.url,
        'result': case.result,
        'project_id': project.id,
        'project_name': project.name,
        'project_type': project.type,
        'project_type_name': ProjectTypeEnum.data()[project.type],
        'task_id': task.id,
        'task_no': task.task_no,
        'deal_result': case.deal_result
    }
    return case_log


def log_format(case_log):
    return {
        'id': case_log['id'],
        'case_group': case_log['case_group'],
        'case_group_name': case_log['case_group_name'],
        'name': case_log['name'],
        'actual_result': case_log['actual_result'],
        'assertion_text': case_log['assertion_text'],
Ejemplo n.º 3
0
def enum_type():
    form = EnumTypeForm().validate_for_api()
    if form.type.data == 'TYPE':
        return ProjectTypeEnum.data()
    else:
        raise ParameterException(msg='无目标类型')