Esempio n. 1
0
class PerformReport(MyDocument):
    """
    性能测试报告,已经作废,在bench中有专门的处理的了:2016-09-10
    waste
    """
    __collection__ = "perform_report"

    server_soft_ware = StringField(max_length=2048)
    server_host_name = StringField(max_length=2048)
    server_port = StringField(max_length=64)
    doc_path = StringField(max_length=2048)
    doc_length = IntField()  # 文档长度,bytes
    con_level = IntField()  # 并发量
    test_time_taken = FloatField()  # 消耗时间 seconds
    complete_req = IntField()  # 完成请求数
    failed_req = IntField()  # 失败请求数
    non_2xx_res = IntField()  # 非2xx请求数
    total_trans = IntField()  # 总传输数据量bytes
    html_trans = IntField()  # 总html传输数据量bytes
    req_per_sec = FloatField()  # 每秒请求量
    time_per_req = FloatField()  # 平均http请求响应时间:ms
    time_per_req_across = FloatField()  # 所有并发请求量耗时(平均事务响应时间):ms
    trans_rate = FloatField()  # 每秒传输数据量,Kbytes/sec

    organization = ReferenceField(
        reference_document_type=Organization)  # 数据所属的组织
Esempio n. 2
0
    def test_validate_enforces_floats(self):
        field = FloatField()

        expect(field.validate(1.0)).to_be_true()
        expect(field.validate("1.5")).to_be_true()
        expect(field.validate("qwe")).to_be_false()
        expect(field.validate(None)).to_be_true()
Esempio n. 3
0
class SafetyTestReport(ProjectDataDocument):
    """
    安全测试报告
    """
    __collection__ = "safety_test_report"
    # project_name = StringField()  # 项目名,里面加上版本号,这个并不是具体的内部项目,和其它几种测试数据不同
    hack_tool = StringField()  # 用于hack的软件名称
    total_cnts = IntField()  # 总计次数
    success_cnts = IntField()  # 成功次数
    success_rate = FloatField()  # 成功率,冗余
    time_cycle = FloatField()  # 花费时间:s
    crack_rate = FloatField()  # 破解效率,冗余
    mark = StringField()  # 描述备注
Esempio n. 4
0
class PenetrationTestData(ProjectDataDocument):
    """
    渗透测试详情
    """
    __collection__ = "penetration_test_data"
    start_time = StringField()
    use_time = FloatField()
    note = StringField()
Esempio n. 5
0
class ApiReqDelay(MyDocument):
    """测试接口的延时
    """
    __collection__ = "api_req_delay"

    domain = StringField(max_length=2048)  # ms,基准域
    path = StringField(max_length=2048)  # ms,接口路径及参数
    delay = FloatField()  # ms,请求时间
    http_status = IntField()  # http状态值

    # 数据归属
    project = ReferenceField(reference_document_type=Project)
    project_name = StringField()  # 项目名称,冗余
    organization = ReferenceField(reference_document_type=Organization)
Esempio n. 6
0
class UnitTestData(MyDocument):
    """
    测试数据统计表--插入时没有使用,没有使用ORM
    """
    __collection__ = "unit_test_data"

    pro_version = StringField(max_length=1024)  # 项目版本号:1.2.3.4
    was_successful = BooleanField()  # 是否是成功的
    total = IntField()
    failures = IntField()
    errors = IntField()
    skipped = IntField()
    run_time = FloatField()
    details = ListField(ReferenceField(UnitTestDataDetail))

    # 数据归属
    project = ReferenceField(reference_document_type=Project)  # 测试数据所属的项目
    project_name = StringField()  # 项目名称,冗余
    organization = ReferenceField(
        reference_document_type=Organization)  # 数据所属的组织
Esempio n. 7
0
class MobileSafetyData(
        OrgUserDataDocument,
        HttpDocument,
        # OperationDocument
):
    """
    手机安全数据

    """

    __collection__ = 'mobile_safety_data'

    bs = StringField()  # charging battery status
    br = FloatField()  # 电池状态,"0.36",battery rate

    carrier = StringField()  # 运营商,"\U4e2d\U56fd\U8054\U901a";
    cellular = StringField()  # LTE;
    coun = StringField()  # CN;
    dn = StringField()  # "iPhone 6s"

    idf = StringField()  # 85BA4C903C16F7631;
    imei = StringField()  # 000000000000000;
    # ip = StringField()
    lang = StringField()  # "en-CN";
    sc_w = IntField()  # screen width
    sc_h = IntField()  # screen height
    # mScreen = StringField()  # 1242x2208;
    dType = StringField()  # iPhone;
    mac = StringField()  # "02:00:00:00";
    dModel = StringField()  # "iPhone8,2";
    osType = StringField()  # ios;
    # osVerInt =StringField()# "9.3.2";
    osVerRelease = StringField()  # "9.3.2";
    route = StringField()  # "24:3:b0";
    ssid = StringField()  # MyWIFI;
    # utc = StringField()  # "2016-07-18 06:51:53";
    uuid = StringField()  # "513DE79D-F20AB2F685A";

    c_time = DateTimeField()  # 客户端时间,东8时区
Esempio n. 8
0
    def test_validate_enforces_max_value(self):
        field = FloatField(max_value=5.4)

        expect(field.validate(5.3)).to_be_true()
        expect(field.validate(5.5)).to_be_false()
        expect(field.validate("5.2")).to_be_true()
Esempio n. 9
0
    def test_validate_is_empty(self):
        field = FloatField()

        expect(field.is_empty(None)).to_be_true()
Esempio n. 10
0
    def test_from_son(self):
        field = FloatField()

        expect(field.from_son(10.0230)).to_equal(10.023)
        expect(field.from_son("10.56")).to_equal(10.56)
Esempio n. 11
0
 def test_create_float_field(self):
     field = FloatField(db_field="test", min_value=10.5, max_value=200.6)
     expect(field.db_field).to_equal("test")
     expect(field.min_value).to_equal(10.5)
     expect(field.max_value).to_equal(200.6)