Exemplo n.º 1
0
    def test_反测_失败添加楼层节点_楼层节点下建楼层(self, depend_nodeInfo):

        with allure.step('准备用例入参'):

            parentAreaCode = depend_nodeInfo["floorData"]["areaCode"]
            floorName = testdata.random_node_floorName()

        with allure.step('接口请求'):

            res_info = api.bns_node_addFloor(
                parentAreaCode=parentAreaCode,
                floorName=floorName,
            )
        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):

                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                actual_msg = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.message")
                expect_code = 5015
                expect_msg = '区域类型不正确'
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)
                self.assert_actual_equal_expect("接口响应信息", actual_msg,
                                                expect_msg)

        with allure.step('清理用例'):
            pass
Exemplo n.º 2
0
    def test_正测_成功添加楼层节点_在门店下创建楼层(self, depend_nodeInfo):

        with allure.step('准备用例入参'):

            parentAreaCode = depend_nodeInfo["shopData"]["areaCode"]
            floorName = testdata.random_node_floorName()

        with allure.step('接口请求'):

            res_info = api.bns_node_addFloor(
                parentAreaCode=parentAreaCode,
                floorName=floorName,
            )
            res_data = JsonHelper.parseJson_by_objectpath(
                res_info, "$.response_data.data")
        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):

                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):
            utils.positive_check_node(api, res_data)

        with allure.step('清理用例'):
            pass
Exemplo n.º 3
0
    def test_正测_成功添加楼层节点_名称在另一个门店下已使用(self, depend_nodeInfo):
        with allure.step('准备用例入参'):
            shopName = testdata.random_node_shopName()
            floorName = depend_nodeInfo["floorData"]["floorName"]

        with allure.step('接口请求'):
            res_info = api.scn_node_addShop(
                parentAreaCode=depend_nodeInfo["brandData"]["areaCode"],
                shopName=shopName)
            parentAreaCode = res_info["areaCode"]
        with allure.step('接口请求'):
            res_info = api.bns_node_addFloor(
                parentAreaCode=parentAreaCode,
                floorName=floorName,
            )
            res_data = JsonHelper.parseJson_by_objectpath(
                res_info, "$.response_data.data")
        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):
            utils.positive_check_node(api, res_data)

        with allure.step('清理用例'):
            api.bns_node_delete(areaCode=res_data["areaCode"])
Exemplo n.º 4
0
    def test_反测_失败添加品牌节点_划分21个年龄分组(self, depend_nodeInfo):
        with allure.step('准备用例入参'):
            brandName = testdata.random_node_brandName()
            ageGroups = [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
                         (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11),
                         (12, 12), (13, 13), (14, 14), (15, 15), (16, 16),
                         (17, 17), (18, 18), (19, 19), (20, 90)]

        with allure.step('接口请求'):
            res_info = api.bns_node_addBrand(
                parentAreaCode=depend_nodeInfo["firstPartnerData"]["areaCode"],
                brandName=brandName,
                ageGroups=ageGroups)
        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                actual_msg = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.message")
                expect_code = 5029
                expect_msg = "年龄分组不能超过20个"
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)
                self.assert_actual_equal_expect("接口message", actual_msg,
                                                expect_msg)
    def test_正测_成功添加一级合作方(self):

        with allure.step('准备用例入参'):

            partnerName = testdata.random_node_firstPartnerName()

        with allure.step('接口请求'):

            res_info = api.bns_node_addFirstPartner(partnerName=partnerName, )

        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):

                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                res_data = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.data")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):
            utils.positive_check_node(api, res_data)

        with allure.step('清理用例'):
            api.bns_node_delete(areaCode=res_data["areaCode"])
Exemplo n.º 6
0
    def test_正测_成功添加品牌节点_划分20个年龄分组(self, depend_nodeInfo):
        with allure.step('准备用例入参'):
            brandName = testdata.random_node_brandName()
            ageGroups = [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
                         (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11),
                         (12, 12), (13, 13), (14, 14), (15, 15), (16, 16),
                         (17, 17), (18, 18), (19, 90)]

        with allure.step('接口请求'):
            res_info = api.bns_node_addBrand(
                parentAreaCode=depend_nodeInfo["firstPartnerData"]["areaCode"],
                brandName=brandName,
                ageGroups=ageGroups)
        res_data = JsonHelper.parseJson_by_objectpath(res_info,
                                                      "$.response_data.data")
        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):
            utils.positive_check_node(api, res_data)

        with allure.step('清理用例'):
            api.bns_node_delete(areaCode=res_data["areaCode"])
Exemplo n.º 7
0
    def test_正测_新建采购订单提交审批(self):
        # with allure.step('准备用例入参'):

        with allure.step('接口请求'):
            api_admin.bns_new_po_add()
            # api_admin.bns_po_oa_submit()
            res_info = api_admin.bns_po_pass()

        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.retCode")
                actual_msg = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.retMsg")
                expect_code = 200
                expect_msg = "操作成功!"
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)
                self.assert_actual_equal_expect("接口业务码", actual_msg,
                                                expect_msg)

        with allure.step('校验:关联业务'):
            # 每个关联业务写成一个step
            pass

        with allure.step('清理用例'):
            pass
    def test_正测_成功查询到菜单列表(self):
        # with allure.step('准备用例入参'):

        with allure.step('接口请求'):
            res_info = api_admin.scn_queryMenu_menu(id=None,
                                                    res_accurate=False,
                                                    business_exception=False)

        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.retCode")
                actual_msg = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.retMsg")
                expect_code = 200
                expect_msg = "操作成功!"
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)
                self.assert_actual_equal_expect("接口业务码", actual_msg,
                                                expect_msg)

        with allure.step('校验:关联业务'):
            # 每个关联业务写成一个step
            pass

        with allure.step('清理用例'):
            pass
Exemplo n.º 9
0
    def scn_queryData_data(self,
                           headers=None,
                           id=None,
                           res_accurate=False,
                           business_exception=False):
        # TODO: 请确定参数并完成参数注释

        # 参数化
        # if func_param is None: func_param = gen_bnsData.xxx()

        # 发送业务请求
        res_json = self.bns_queryData_data(
            headers=headers,
            id=id,
        )

        # 定义一个http状态码的白名单, 如果状态码不在白名单中,则直接返回
        white_list = [200, 201]
        # 获取当前请求的http状态码
        http_code = JsonHelper.parseJson_by_objectpath(res_json,
                                                       "$.response_code")
        # 如果请求返回的状态码不是期望的http状态码, 则直接返回该状态码
        if http_code not in white_list:
            return res_json

        # 提取业务码
        actually_business_code = JsonHelper.parseJson_by_objectpath(
            res_json, "$.response_data.code")
        # 异常码集合
        exception_list = [
            # 400004,   # 设备类型不合法
        ]

        # 正常业务状态码下, 函数的返回信息
        if actually_business_code == 0:

            # 解析返回信息或调用自定义函数

            # 精确返回的内容
            if res_accurate:
                pass
                # return deviceCode

            # 全部信息返回
            info_dict = dict()
            return info_dict if info_dict else JsonHelper.parseJson_by_objectpath(
                res_json, "$.response_data")

        # 异常业务状态码下(已知异常), 函数的返回信息
        elif actually_business_code in exception_list:

            if business_exception:
                raise DefinedBusinessException("接口已知业务异常:订单查询")

            return JsonHelper.parseJson_by_objectpath(res_json,
                                                      "$.response_data")

        # 异常业务状态码下(未知异常), 函数的返回信息
        else:
            raise UndefinedBusinessException("接口未知业务异常:订单查询")
Exemplo n.º 10
0
def snap_node_identification(response,
                             expect_snapRecordStatus,
                             expect_collectRecordStatus=None):
    with allure.step('校验:接口响应信息'):
        with allure.step('校验:查询数据为两条'):
            expect_value = 2
            actual_value = JsonHelper.parseJson_by_objectpath(
                response, "$..*[@.total]")[0]
            AllureHelper.assert_equal("接口查询返回条数", actual_value, expect_value)

        with allure.step('校验:查询结果中两条数据faceid相同'):
            expected_value = JsonHelper.parseJson_by_objectpath(
                response, "$..*[@.faceId]")[0]
            actual_value = JsonHelper.parseJson_by_objectpath(
                response, "$..*[@.faceId]")[1]
            AllureHelper.assert_equal("faceID查询的两条数据", actual_value,
                                      expected_value)

        with allure.step('校验:snapRecordStatus值'):

            actual_snapRecordStatus = \
                JsonHelper.parseJson_by_objectpath(response, "$.*.data.list.snapRecordStatus")[0]
            AllureHelper.assert_equal("抓拍节点下图片去重状态对应字段",
                                      expect_snapRecordStatus,
                                      actual_snapRecordStatus)
        if expect_collectRecordStatus is not None:
            with allure.step('校验:collectRecordStatus值'):

                actual_collectRecordStatus = \
                    JsonHelper.parseJson_by_objectpath(response, "$.*.data.list.collectRecordStatus")[0]
                AllureHelper.assert_equal("汇总节点下图片去重状态对应字段",
                                          expect_collectRecordStatus,
                                          actual_collectRecordStatus)
Exemplo n.º 11
0
    def test_正测_成功添加品牌节点_一级合作方下添加(self, depend_nodeInfo):
        with allure.step('准备用例入参'):
            brandName = testdata.random_node_brandName()
            ageGroups = [(0, 90)]

        with allure.step('接口请求'):
            res_info = api.bns_node_addBrand(
                parentAreaCode=depend_nodeInfo["firstPartnerData"]["areaCode"],
                brandName=brandName,
                ageGroups=ageGroups)
        res_data = JsonHelper.parseJson_by_objectpath(res_info,
                                                      "$.response_data.data")
        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):
            utils.positive_check_node(api, res_data)

        with allure.step('清理用例'):
            api.bns_node_delete(areaCode=res_data["areaCode"])
    def test_正测_成功添加三级合作方_名称在另一个二级合作方下已使用(self, depend_nodeInfo):
        with allure.step('准备用例入参'):
            secondPartnerName = testdata.random_node_secondPartnerName()
            thirdPartnerName = depend_nodeInfo["thirdPartnerData"]["name"]

        with allure.step('接口请求'):
            res_info = api.bns_node_addSecondPartner(
                parentAreaCode=depend_nodeInfo["firstPartnerData"]["areaCode"],
                partnerName=secondPartnerName,
            )
            areaCode = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.data.areaCode")
        with allure.step('接口请求'):
            res_info = api.bns_node_addThirdPartner(
                parentAreaCode=areaCode,
                partnerName=thirdPartnerName,
            )
        res_data = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.data")
        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code, expect_code)

        with allure.step('校验:关联业务'):
            utils.positive_check_node(api, res_data)

        with allure.step('清理用例'):
            api.bns_node_delete(areaCode=res_data["areaCode"])
Exemplo n.º 13
0
def positive_check_snapLogicmatch(api_admin, areaCode, expect_snapType,
                                  expect_userType):
    with allure.step("校验:校验第二次上报图片的校验结果"):
        with allure.step("取出第二次上报图片的抓拍时间"):
            res_json1 = api_admin.scn_snap_list(areaCodesList=[areaCode],
                                                expected_value=2)
            snapTime_list = JsonHelper.parseJson_by_objectpath(
                res_json1, "$..*[@.snapTime]", res_allowNone=True)
            snapTime = snapTime_list[
                0] if snapTime_list[0] > snapTime_list[1] else snapTime_list[1]
            res_json = api_admin.scn_snap_list(startDateTime=snapTime,
                                               areaCodesList=[areaCode])

        with allure.step("校验:上报数据抓拍类型及访客类型处理结果"):
            actual_snapType = JsonHelper.parseJson_by_objectpath(
                res_json,
                "$..*[@.snapType]",
                res_allowNone=True,
                res_firstOne=True)
            expect_snapType = expect_snapType
            AllureHelper.assert_equal("抓拍类型校验", expect_snapType,
                                      actual_snapType)

            actual_userType = JsonHelper.parseJson_by_objectpath(
                res_json,
                "$..*[@.userType]",
                res_allowNone=True,
                res_firstOne=True)
            expect_userType = expect_userType
            AllureHelper.assert_equal("访客的类型校验", expect_userType,
                                      actual_userType)
Exemplo n.º 14
0
    def test_field_node_addFirstPartner(self, test_data):

        first_layer = test_data["first_layer"]
        sencod_layer = test_data["sencod_layer"]
        third_layer = test_data["third_layer"]

        if first_layer:
            allure.dynamic.epic(first_layer)
        if sencod_layer:
            allure.dynamic.feature(sencod_layer)
        if third_layer:
            allure.dynamic.story(third_layer)

        module_key = sys._getframe().f_code.co_name.split("_")[2]
        test_data = self.parse_csv_param(test_data, module_key)

        partnerName = test_data["partnerName"]

        with allure.step("步骤: 请求接口"):

            res_json = api_object_admin.bns_node_addFirstPartner(
                partnerName=partnerName, )

        with allure.step("步骤: 提取接口的业务状态码"):

            actual_code = JsonHelper.parseJson_by_objectpath(
                res_json, "$.response_data.code")

        with allure.step("校验: 业务状态码是否正确"):

            self.assert_actual_equal_expect("业务状态码", actual_code,
                                            test_data["expect_code"])

        if test_data["expect_msg"]:

            with allure.step("步骤: 提取接口的提示信息"):

                actual_msg = JsonHelper.parseJson_by_objectpath(
                    res_json, "$.response_data.message")

            with allure.step("校验: 提示信息是否正确"):

                self.assert_actual_contain_expect("提示信息", actual_msg,
                                                  test_data["expect_msg"])

        if test_data["clean_data"]:

            with allure.step("步骤: 数据清理操作"):

                # TODO: 调用删除接口
                pass

        generator_objs_list = test_data.get("generator_objs_list")
        if generator_objs_list:
            for generator_obj in generator_objs_list:
                try:
                    generator_obj.__next__()
                except StopIteration:
                    pass
Exemplo n.º 15
0
    def test_正测_成功查询设备列表_镜头类型(self, 已注册_IOT设备):

        with allure.step('准备用例入参'):
            pageNo = 1
            pageSize = 50
            areaCodesList = None
            deviceStatus = None
            deviceCodeOrBar = None
            deviceType = None
            manufacturerType = None
            lensType = 已注册_IOT设备["lensType"]
            hardwareVersion = None
            startDateTime = None
            endDateTime = None

        with allure.step('接口请求'):

            res_info = api_admin.bns_iotDevice_list(

                pageNo=pageNo,
				pageSize=pageSize,
				areaCodesList=areaCodesList,
				deviceStatus=deviceStatus,
				deviceCodeOrBar=deviceCodeOrBar,
				deviceType=deviceType,
				manufacturerType=manufacturerType,
				lensType=lensType,
				hardwareVersion=hardwareVersion,
				startDateTime=startDateTime,
				endDateTime=endDateTime,

            )

        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):

                actual_code = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code, expect_code)

            with allure.step('校验:接口内容返回的镜头类型'):

                manufacturerType_list = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.data.list.lensType")
                actual_count = len(list(set(manufacturerType_list)))
                expect_count = 1
                self.assert_actual_equal_expect("校验筛选查询后列表中每条业务内容的镜头类型均相同", actual_count, expect_count)

                actual_value = manufacturerType_list.pop()
                expect_value = lensType
                self.assert_actual_equal_expect("校验筛选查询后列表中镜头类型的值与期望一致", actual_value, expect_value)
Exemplo n.º 16
0
    def test_正测_成功查询设备列表_模糊查询设备编码(self, 已注册_IOT设备):

        with allure.step('准备用例入参'):

            pageNo = 1
            pageSize = 20
            areaCodesList = None
            deviceStatus = None
            deviceCodeOrBar = 已注册_IOT设备["deviceCode"][2:]
            deviceType = None
            manufacturerType = None
            lensType = None
            hardwareVersion = None
            startDateTime = None
            endDateTime = None

        with allure.step('接口请求'):

            res_info = api_admin.bns_iotDevice_list(

                pageNo=pageNo,
				pageSize=pageSize,
				areaCodesList=areaCodesList,
				deviceStatus=deviceStatus,
				deviceCodeOrBar=deviceCodeOrBar,
				deviceType=deviceType,
				manufacturerType=manufacturerType,
				lensType=lensType,
				hardwareVersion=hardwareVersion,
				startDateTime=startDateTime,
				endDateTime=endDateTime,

            )

        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):

                actual_code = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code, expect_code)

            with allure.step('校验:接口返回的业务信息条数'):
                expect_count = 1
                actual_count = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.data.total")
                self.assert_actual_equal_expect("校验筛选查询后列表中内容条数", actual_count, expect_count)

            with allure.step('校验:接口返回的业务信息内容'):
                expect_content = 已注册_IOT设备["deviceCode"]
                actual_content = JsonHelper.parseJson_by_objectpath(res_info, "$.response_data.data.list")
                self.assert_actual_contain_expect("校验筛选查询后列表应包含内容", actual_content, expect_content)
Exemplo n.º 17
0
def positive_check_snapLogic(api_admin, areaCode, expect_snapType,
                             expect_userType, expect_snapRecordStatus,
                             expect_collectRecordStatus, expect_faceId):

    with allure.step('测试步骤:抓拍列表查询'):
        res_json = api_admin.scn_snap_list(areaCodesList=areaCode,
                                           res_accurate=False,
                                           expected_value=1)

        actual_snapType = JsonHelper.parseJson_by_objectpath(
            res_json,
            "$..*[@.snapType]",
            res_allowNone=True,
            res_firstOne=True)
        expect_snapType = expect_snapType
        AllureHelper.assert_equal("抓拍类型校验", expect_snapType, actual_snapType)

        actual_userType = JsonHelper.parseJson_by_objectpath(
            res_json,
            "$..*[@.userType]",
            res_allowNone=True,
            res_firstOne=True)
        expect_userType = expect_userType
        AllureHelper.assert_equal("访客的类型校验", expect_userType, actual_userType)

        actual_snapRecordStatus = JsonHelper.parseJson_by_objectpath(
            res_json,
            "$..*[@.snapRecordStatus]",
            res_allowNone=True,
            res_firstOne=True)
        expect_snapRecordStatus = expect_snapRecordStatus
        AllureHelper.assert_equal("抓拍节点-客流处理状态校验", expect_snapRecordStatus,
                                  actual_snapRecordStatus)

        actual_collectRecordStatus = JsonHelper.parseJson_by_objectpath(
            res_json,
            "$..*[@.collectRecordStatus]",
            res_allowNone=True,
            res_firstOne=True)
        expect_collectRecordStatus = expect_collectRecordStatus
        AllureHelper.assert_equal("汇总节点-客流处理状态", expect_collectRecordStatus,
                                  actual_collectRecordStatus)

        faceId = JsonHelper.parseJson_by_objectpath(res_json,
                                                    "$..*[@.faceId]",
                                                    res_allowNone=True,
                                                    res_firstOne=True)
        actual_faceId = False if faceId == "0" else True
        expect_faceId = expect_faceId
        AllureHelper.assert_equal("人脸库faceId值校验", expect_faceId, actual_faceId)
Exemplo n.º 18
0
def get_random_addNode_mallAddr():
    ele = random.choice(node_addr)

    # 获取省
    province = JsonHelper.parseJson_by_objectpath(ele, "$.value")

    # 获取市
    city_list = JsonHelper.parseJson_by_objectpath(ele, "$.children.value")
    city = random.choice(city_list)

    # 获取区
    district_list = JsonHelper.parseJson_by_objectpath(ele,"$.children.*[ @.'value' is '{}' ].children..*[@.value]".format(city),res_allowNone=True)
    district = random.choice(district_list)

    return province, city, district
Exemplo n.º 19
0
 def test_反测_失败添加门店节点_节点名称已使用(self, depend_nodeInfo):
     with allure.step('准备用例入参'):
         parentAreaCode = depend_nodeInfo["brandData"]["areaCode"]
         shopName = depend_nodeInfo["shopData"]["shopName"]
         province, city, district = testdata.get_random_addNode_mallAddr()
         clerkSimType = 1
         customerSimType = 1
         repeatDate = 30
         skipTime = 3600
         trailSkipTime = 3600
     with allure.step('接口请求'):
         res_info = api.bns_node_addShop(
             parentAreaCode=parentAreaCode,
             shopName=shopName,
             province=province,
             city=city,
             district=district,
             clerkSimType=clerkSimType,
             customerSimType=customerSimType,
             repeatDate=repeatDate,
             skipTime=skipTime,
             trailSkipTime=trailSkipTime,
         )
     with allure.step('校验:接口响应信息'):
         with allure.step('校验:接口状态码'):
             actual_code = JsonHelper.parseJson_by_objectpath(
                 res_info, "$.response_data.code")
             expect_code = 5013
             self.assert_actual_equal_expect("接口业务码", actual_code,
                                             expect_code)
Exemplo n.º 20
0
    def test_反测_失败注册1台设备_设备编码已存在(self, 已使用_IOT设备信息):

        with allure.step('准备用例入参'):
            deviceType = 0
            manufacturerType = 0
            deviceCode = 已使用_IOT设备信息["deviceCode"]
            deviceBarCode = testdata.random_iotDevice_deviceBarCode()
            hardwareVersion = testdata.random_iotDevice_hardwareVersion()
            lensType = testdata.random_iotDevice_lensType()

        with allure.step('接口请求'):
            res_info = api_admin.bns_iotDevice_add(
                deviceType=deviceType,
                manufacturerType=manufacturerType,
                deviceCode=deviceCode,
                deviceBarCode=deviceBarCode,
                hardwareVersion=hardwareVersion,
                lensType=lensType,
            )

        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):
                expect_code = 3004
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)
Exemplo n.º 21
0
 def scn_iotDevice_apply(self, deviceId):
     """
     默认审批者: approver = 1
     :param deviceId: 设备id
     :return:
     """
     # 审批者
     approver = 1
     # 申请删除设备
     applyDesc = gen_bnsData.random_iotDevice_applyDesc()
     self.bns_iotDevice_applyDelete(deviceId=deviceId,
                                    applyDesc=applyDesc,
                                    approver=approver)
     # 通过 applyDesc 来获取到 applyId
     list_info = self.bns_iotDevice_applyList(pageNo=1, pageSize=20)
     applyId = JsonHelper.parseJson_by_objectpath(
         list_info,
         "$..*[@.approvalDesc is '{}'].id".format(applyDesc),
         res_firstOne=True)
     # 审批通过
     self.bns_iotDevice_handleApply(
         applyId=applyId,
         approver=approver,
         approvalStatus=1,  # 通过
         approvalSuggestion=gen_bnsData.random_iotDevice_approvalSuggestion(
         ))
Exemplo n.º 22
0
    def test_反测_失败编辑IOT设备_设备条码已存在(self, 待编辑_IOT设备信息, 已使用_IOT设备信息):
        with allure.step('准备用例入参'):
            deviceId = 待编辑_IOT设备信息["deviceId"]
            deviceType = 待编辑_IOT设备信息["deviceType"]
            manufacturerType = 待编辑_IOT设备信息["manufacturerType"]
            deviceCode = 待编辑_IOT设备信息["deviceCode"]
            deviceBarCode = 已使用_IOT设备信息["deviceBarCode"]
            hardwareVersion = 待编辑_IOT设备信息["hardwareVersion"]
            lensType = 待编辑_IOT设备信息["lensType"]

        with allure.step('接口请求'):
            res_info = api_admin.bns_iotDevice_edit(
                deviceid=deviceId,
                deviceType=deviceType,
                manufacturerType=manufacturerType,
                deviceCode=deviceCode,
                deviceBarCode=deviceBarCode,
                hardwareVersion=hardwareVersion,
                lensType=lensType,
            )

        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):
                expect_code = 3005
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)
Exemplo n.º 23
0
 def bns_warehouseOrderInStock_saveOrUpdatePONotice(self):
     response = self.bns_warehouse_queryNoticeList()
     self.fstockId = JsonHelper.parseJson_by_objectpath(
         response, "$.data..fstockId")[0]
     self.fnoticeOrderNum = JsonHelper.parseJson_by_objectpath(
         response, "$.data..fnoticeOrderNum")[0]
     data = {"finStockStatus": 4, "finStockId": self.fstockId}
     self.headers["use-node-method"] = "jsonRequest"
     response = self.session.post(
         # TODO: 请确认url是否需要变化!!!
         url="{}/new/warehouse/warehouseOrderInStock/saveOrUpdatePONotice".
         format(get_b2b_host),
         data=json.dumps(data),
         headers=self.headers)
     # self.log.log_info("仓库确认入库接受接口请求信息:{}".format(data))
     self.log.log_info("仓库确认入库接受接口返回信息:{}".format(response.json()))
     return response.json()
Exemplo n.º 24
0
def register_employee(api_admin, areaCode, mallareaCode):

    with allure.step("前置条件: 注册店员"):
        res_json = api_admin.scn_snap_list(areaCodesList=[areaCode])
        faceId = JsonHelper.parseJson_by_objectpath(res_json,
                                                    "$..*[@.faceId]",
                                                    res_allowNone=True,
                                                    res_firstOne=True)
        featureImageUrl = JsonHelper.parseJson_by_objectpath(
            res_json,
            "$..*[@.featureImageUrl]",
            res_allowNone=True,
            res_firstOne=True)

        api_admin.scn_employee_add(mallareaCode=mallareaCode,
                                   faceId=faceId,
                                   imagePath=featureImageUrl)
Exemplo n.º 25
0
    def test_field_iotDevice_edit(self, test_data):

        first_layer = test_data["first_layer"]
        sencod_layer = test_data["sencod_layer"]
        third_layer = test_data["third_layer"]

        if first_layer:
            allure.dynamic.epic(first_layer)
        if sencod_layer:
            allure.dynamic.feature(sencod_layer)
        if third_layer:
            allure.dynamic.story(third_layer)
        
        module_key = sys._getframe().f_code.co_name.split("_")[2]
        test_data = self.parse_csv_param(test_data, module_key)
        
        deviceid = test_data["deviceid"]
        deviceType = test_data["deviceType"]
        manufacturerType = test_data["manufacturerType"]
        deviceCode = test_data["deviceCode"]
        deviceBarCode = test_data["deviceBarCode"]
        hardwareVersion = test_data["hardwareVersion"]
        lensType = test_data["lensType"]
        
        with allure.step("步骤: 请求接口"):

            res_json = api_object_admin.bns_iotDevice_edit(
                deviceid=deviceid,
				deviceType=deviceType,
				manufacturerType=manufacturerType,
				deviceCode=deviceCode,
				deviceBarCode=deviceBarCode,
				hardwareVersion=hardwareVersion,
				lensType=lensType,
            )

        with allure.step("步骤: 提取接口的业务状态码"):
            
            actual_code = JsonHelper.parseJson_by_objectpath(res_json, "$.response_data.code")

        with allure.step("校验: 业务状态码是否正确"):

            self.assert_actual_equal_expect("业务状态码", actual_code, test_data["expect_code"])

        if test_data["clean_data"]:

            with allure.step("步骤: 数据清理操作"):
                
                # TODO: 调用删除接口
                pass
                
        generator_objs_list = test_data.get("generator_objs_list")
        if generator_objs_list:
            for generator_obj in generator_objs_list:
                try:
                    generator_obj.__next__()
                except StopIteration:
                    pass
Exemplo n.º 26
0
    def _get_header(self):

        # 获取接口信息
        res_login = self.bns_user_login(userName=self.username, userPasswd=self.password,randStr="",ticket="")
        # 处理接口的信息
        access_token = JsonHelper.parseJson_by_objectpath(res_login, "$..*['data']", res_firstOne=True)

        # 定义header
        self._header.setdefault('token', access_token)
Exemplo n.º 27
0
    def _get_header(self):

        # 获取接口信息
        res_login = self.bns_user_login()
        # 处理接口的信息
        access_token = JsonHelper.parseJson_by_objectpath(
            res_login, "$.retEntity.token")
        # 定义header
        self.headers['adminAccessToken'] = access_token
Exemplo n.º 28
0
    def test_正测_成功添加门店节点_名称在另一个品牌下已使用(self, depend_nodeInfo):
        with allure.step('准备用例入参'):
            brandName = testdata.random_node_brandName()
            shopName = depend_nodeInfo["shopData"]["shopName"]
            province, city, district = testdata.get_random_addNode_mallAddr()
            clerkSimType = 1
            customerSimType = 1
            repeatDate = 30
            skipTime = 3600
            trailSkipTime = 3600

        with allure.step('接口请求'):
            res_info = api.scn_node_addBrand(
                parentAreaCode=depend_nodeInfo["thirdPartnerData"]["areaCode"],
                brandName=brandName)
            parentAreaCode = res_info["areaCode"]
        with allure.step('接口请求'):
            res_info = api.bns_node_addShop(
                parentAreaCode=parentAreaCode,
                shopName=shopName,
                province=province,
                city=city,
                district=district,
                clerkSimType=clerkSimType,
                customerSimType=customerSimType,
                repeatDate=repeatDate,
                skipTime=skipTime,
                trailSkipTime=trailSkipTime,
            )
            res_data = JsonHelper.parseJson_by_objectpath(
                res_info, "$.response_data.data")
        with allure.step('校验:接口响应信息'):
            with allure.step('校验:接口状态码'):
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                expect_code = 0
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):
            utils.positive_check_node(api, res_data)

        with allure.step('清理用例'):
            api.bns_node_delete(areaCode=res_data["areaCode"])
Exemplo n.º 29
0
    def test_正测_成功注册1台设备_瑞为店计设备(self):

        with allure.step('准备用例入参'):

            deviceType = 0
            manufacturerType = 0
            deviceCode = testdata.random_iotDevice_deviceCode()
            deviceBarCode = testdata.random_iotDevice_deviceBarCode()
            hardwareVersion = testdata.random_iotDevice_hardwareVersion()
            lensType = testdata.random_iotDevice_lensType()

        with allure.step('接口请求'):

            res_info = api_admin.bns_iotDevice_add(
                deviceType=deviceType,
                manufacturerType=manufacturerType,
                deviceCode=deviceCode,
                deviceBarCode=deviceBarCode,
                hardwareVersion=hardwareVersion,
                lensType=lensType,
            )

        with allure.step('校验:接口响应信息'):

            with allure.step('校验:接口状态码'):

                expect_code = 0
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):
            # 每个关联业务写成一个step
            pass

        with allure.step('清理用例'):

            list_info = api_admin.bns_iotDevice_list(
                pageNo=1, pageSize=20, deviceCodeOrBar=deviceCode)
            deviceId = JsonHelper.parseJson_by_objectpath(list_info,
                                                          "$..*[@.id]",
                                                          res_firstOne=True)
            api_admin.scn_iotDevice_delete(deviceId=deviceId)
Exemplo n.º 30
0
    def _get_header(self):

        # 获取接口信息
        res_login = self.bns_user_login()
        # 处理接口的信息
        access_token = JsonHelper.parseJson_by_objectpath(res_login,
                                                          "$..token",
                                                          res_firstOne=True)

        # 定义header
        self._header.setdefault('adminAccessToken', access_token)