Example #1
0
class Environment(db.Model):
    """
    接口表
    """
    env_id = db.Column(db.Integer, primary_key=True, comment='接口id')
    env_name = db.Column(db.String(30), comment='接口名称')
    env_desc = db.Column(db.String(300), comment='接口名称')
    env_status = db.Column(db.String(10), comment='接口状态 1启用 ,2禁用')
    env_agreement = db.Column(db.String(10), comment='请求协议 get  pos')
    env_transmission = db.Column(db.String(10), comment='传输协议 http  https')
    env_ip = db.Column(db.String(100), comment='接口ip地址')
    env_port = db.Column(db.String(100), comment='接口端口号')
    env_mode = db.Column(db.String(10), comment='接口类型')
    env_path = db.Column(db.String(100), comment='接口路径')
    env_bodyData = db.Column(db.String(500), comment='接口bodyData')
    env_verification = db.Column(db.String(500), comment='校验规则')
    env_update_time = db.Column(db.DateTime,
                                default=datetime.now(),
                                comment='修改时间')
    env_create_time = db.Column(db.DateTime,
                                default=datetime.now(),
                                comment='创建时间')
    env_complete = db.Column(db.String(10),
                             default='1',
                             comment='是否开发完成 1完成 ,2未完成')
    env_del_status = db.Column(db.String(10),
                               default='1',
                               comment='删除状态 1未删除  0删除')

    modules_id = db.Column(db.Integer,
                           db.ForeignKey('modules.modules_id'),
                           comment='模块外键')
    modules = db.relationship('Modules', back_populates='environment')

    project_id = db.Column(db.Integer,
                           db.ForeignKey('project.project_id'),
                           comment='项目外键')
    project = db.relationship('Project', back_populates='environment')

    parameter = db.relationship(
        'Parameter',
        back_populates='environment',
        cascade='all, delete , delete-orphan')  # 参数管理表外键

    transfer = db.relationship('Transfer',
                               back_populates='environment',
                               cascade='all, delete-orphan')  # 调用接口

    headerValue = db.relationship(
        'HeaderValue',
        back_populates='environment',
        cascade='all, delete , delete-orphan')  # 参数管理表外键
Example #2
0
class Modules(db.Model):
    """
    模块表
    """
    modules_id = db.Column(db.Integer, primary_key=True, comment='模块id')
    # unique = True  分类名称不允许重复
    modules_name = db.Column(db.String(30), unique=True, comment='模块名称')
    modules_desc = db.Column(db.String(500), comment='模块描述')
    status = db.Column(db.String(10), default='1', comment='模块状态 1启用 ,2禁用')
    update_time = db.Column(db.DateTime,
                            default=datetime.now(),
                            comment='修改时间')
    create_time = db.Column(db.DateTime,
                            default=datetime.now(),
                            comment='创建时间')
    del_status = db.Column(db.String(10), default='1', comment='删除状态')

    project_id = db.Column(db.Integer,
                           db.ForeignKey('project.project_id',
                                         ondelete='CASCADE'),
                           comment='项目表外键')
    project = db.relationship('Project', back_populates='module')

    environment = db.relationship('Environment',
                                  back_populates='modules',
                                  cascade='all, delete , delete-orphan')
Example #3
0
class SceneEnv(db.Model):
    """
    场景接口管理表
    """
    scene_id = db.Column(db.Integer, primary_key=True, comment='场景接口id')
    project_id = db.Column(db.Integer, comment='项目id')
    modules_id = db.Column(db.Integer, comment='模块id')
    env_id = db.Column(db.Integer, comment='接口id')
    scene_body = db.Column(db.String(100), comment='场景body')
    number = db.Column(db.Integer, comment='排列顺序')

    header = db.relationship('HeaderValue',
                             back_populates='sceneEnv',
                             cascade='all, delete , delete-orphan')  # 信息头管理表外键

    check = db.relationship('Check',
                            back_populates='sceneEnv',
                            cascade='all, delete , delete-orphan')  # 校验表外键

    variable = db.relationship('Variable',
                               back_populates='sceneEnv',
                               cascade='all, delete, delete-orphan')

    sceneList_id = db.Column(db.Integer,
                             db.ForeignKey('scene_list.sceneList_id'),
                             comment='场景管理表外键')
    sceneList = db.relationship('SceneList', back_populates='sceneEnv')
Example #4
0
class CaseScene(db.Model):
    """
    用例关联的场景
    """
    caseScene_id = db.Column(db.Integer, primary_key=True, comment='id')
    project_id = db.Column(db.Integer, comment='项目id')

    uc_id = db.Column(db.Integer,
                      db.ForeignKey('user_case.uc_id'),
                      comment='用例表外键')
    user_case = db.relationship('UserCase', back_populates='caseScene')

    sceneList_id = db.Column(db.Integer,
                             db.ForeignKey('scene_list.sceneList_id'),
                             comment='场景表外键')
    sceneList = db.relationship('SceneList', back_populates='caseScene')
Example #5
0
class Parameter(db.Model):
    """
    参数管理表
    """
    par_id = db.Column(db.Integer, primary_key=True, comment='参数id')
    par_variable_name = db.Column(db.String(30), comment='变量名称')
    par_cn_name = db.Column(db.String(30), comment='参数中文名称')
    par_us_name = db.Column(db.String(30), comment='参数英文名称')
    par_type = db.Column(db.String(30), comment='参数类型')
    par_range = db.Column(db.String(30),
                          comment='参数限制范围  0-10-0   0表示最小  10表示最大   0表示小数范围')
    par_date_type = db.Column(db.String(30), comment='日期格式  yyyy-mm-dd')
    par_start_date = db.Column(db.String(30), comment='日期开始时间')
    par_end_date = db.Column(db.String(30), comment='日期结束时间')
    par_required = db.Column(db.String(10),
                             default='1',
                             comment='是否必填 0必填 ,1非必填')
    par_correct = db.Column(db.String(100), comment='正确的参数值')
    par_correct_list = db.Column(db.String(10),
                                 default='1',
                                 comment='案例值类型 0字符串 ,1 list')
    # par_variable = db.Column(db.String(20), comment='参数变量')

    env_id = db.Column(db.Integer,
                       db.ForeignKey('environment.env_id'),
                       comment='接口表外键')
    environment = db.relationship('Environment', back_populates='parameter')
Example #6
0
class Mathmodel(db.Model, UserMixin):
    __tablename__ = "mathmodel"
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(30))
    body = db.Column(db.String(100))
    timestamp = db.Column(db.DateTime, default=datetime.utcnow, index=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    user = db.relationship('User', back_populates='mathmodel')
Example #7
0
class HeaderValue(db.Model):
    """
    信息头管理
    """
    header_id = db.Column(db.Integer, primary_key=True, comment='id')
    header_name = db.Column(db.String(30), comment='信息头名称')
    header_value = db.Column(db.String(50), comment='信息头值')

    env_id = db.Column(db.Integer,
                       db.ForeignKey('environment.env_id'),
                       comment='接口表外键')
    environment = db.relationship('Environment', back_populates='headerValue')

    scene_id = db.Column(db.Integer,
                         db.ForeignKey('scene_env.scene_id'),
                         comment='场景表外键')
    sceneEnv = db.relationship('SceneEnv', back_populates='header')
Example #8
0
class Variable(db.Model):
    """
    接口返回变量管理
    """
    var_id = db.Column(db.Integer, primary_key=True, comment='id')
    var_regexp = db.Column(db.String(30), comment='正则表达式')
    var_name = db.Column(db.String(30), comment='变量名称')
    var_value = db.Column(db.String(30), comment='变量值')

    # 外键接口调用表
    transfer_id = db.Column(db.Integer,
                            db.ForeignKey('transfer.tra_transfer_id'),
                            comment='接口表外键')
    transfer = db.relationship('Transfer', back_populates='variable')

    scene_id = db.Column(db.Integer,
                         db.ForeignKey('scene_env.scene_id'),
                         comment='场景表外键')
    sceneEnv = db.relationship('SceneEnv', back_populates='variable')
Example #9
0
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    date_posted = db.Column(db.DateTime,
                            nullable=False,
                            default=datetime.utcnow)
    content = db.Column(db.Text, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Post('{self.title}', '{self.date_posted}')"
Example #10
0
class Check(db.Model):
    """
    校验表
    """
    check_id = db.Column(db.Integer, primary_key=True, comment='id')
    check_verification_code = db.Column(db.String(50), comment='校验路径')
    check_agreement_relation = db.Column(db.String(50), comment='校验关系')
    check_verification_value = db.Column(db.String(100), comment='校验值')

    scene_id = db.Column(db.Integer,
                         db.ForeignKey('scene_env.scene_id'),
                         comment='场景表外键')
    sceneEnv = db.relationship('SceneEnv', back_populates='check')
Example #11
0
class CaseEnv(db.Model):
    """
    用例关联的接口
    """
    case_id = db.Column(db.Integer, primary_key=True, comment='id')
    project_id = db.Column(db.Integer, comment='项目id')
    modules_id = db.Column(db.Integer, comment='模块id')
    env_id = db.Column(db.Integer, comment='接口id')
    # 外键接口调用表
    uc_id = db.Column(db.Integer,
                      db.ForeignKey('user_case.uc_id'),
                      comment='接口表外键')
    user_case = db.relationship('UserCase', back_populates='case_env')
Example #12
0
class Transfer(db.Model):
    """
    接口调用表
    """
    tra_transfer_id = db.Column(db.Integer, primary_key=True, comment='id')
    tra_modulated_env_id = db.Column(db.Integer, comment='被调用的接口id')

    tra_need_env_id = db.Column(db.Integer,
                                db.ForeignKey('environment.env_id'),
                                comment='需要调用的接口id 接口表外键')
    environment = db.relationship('Environment', back_populates='transfer')

    variable = db.relationship('Variable',
                               back_populates='transfer',
                               cascade='all, delete, delete-orphan')
Example #13
0
class Report(db.Model):
    """
    报告
    """
    report_id = db.Column(db.Integer, primary_key=True, comment='id')
    report_title = db.Column(db.String(50), comment='报告标题')
    report_url = db.Column(db.String(50), comment='请求url')
    report_env_param = db.Column(db.String(100), comment='请求参数')
    report_env_status = db.Column(db.String(10), comment='返回响应码')
    report_env_time = db.Column(db.String(100), comment='响应时间')
    report_env_pass = db.Column(db.Integer, comment='用例执行是否通过  通过0  不通过1')
    report_env_response = db.Column(db.String(100), comment='后台返回数据信息')
    report_create_time = db.Column(db.String(30), comment='创建时间')
    scheduling_id = db.Column(db.String(30), comment='任务ID')
    report_case_type = db.Column(db.String(30), comment='case执行分类')
    # 外键接口调用表
    uc_id = db.Column(db.Integer,
                      db.ForeignKey('user_case.uc_id'),
                      comment='接口表外键')
    user_case = db.relationship('UserCase', back_populates='report')