Ejemplo n.º 1
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)
Ejemplo n.º 2
0
    def test_正测_成功编辑IOT设备_编辑设备条码(self, 待编辑_IOT设备信息):

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

            deviceId = 待编辑_IOT设备信息["deviceId"]
            deviceType = 待编辑_IOT设备信息["deviceType"]
            manufacturerType = 待编辑_IOT设备信息["manufacturerType"]
            deviceCode = 待编辑_IOT设备信息["deviceCode"]
            deviceBarCode = testdata.random_iotDevice_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 = 0
                actual_code = JsonHelper.parseJson_by_objectpath(
                    res_info, "$.response_data.code")
                self.assert_actual_equal_expect("接口业务码", actual_code,
                                                expect_code)

        with allure.step('校验:关联业务'):

            with allure.step('校验: 设备详情接口'):
                actual_value = api_admin.bns_iotDevice_detail(
                    deviceId=deviceId)
                expect_value = deviceBarCode
                self.assert_actual_contain_expect("编辑后的值被[设备详情接口]包含",
                                                  actual_value, expect_value)

            with allure.step('校验: 设备列表接口'):
                actual_value = api_admin.bns_iotDevice_list(
                    pageNo=1, pageSize=20, deviceCodeOrBar=deviceCode)
                expect_value = deviceBarCode
                self.assert_actual_contain_expect("编辑后的值被[设备列表接口]包含",
                                                  actual_value, expect_value)
Ejemplo n.º 3
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)