コード例 #1
0
    def add_home_provider_serials(self):
        # 批量添加房源信息,空间信息
        payload = hmpv.add_house_provider()
        home_provider_name = hmpv.add_house_provider()["providerName"]
        req_url = pu.house_manage_urls()["add_home_source_provider_url"]
        r = requests.post(req_url, json=payload)
        rsp = json.loads(r.text)
        # 添加房源信息
        if r.status_code == 200:
            provider_id = db.house_source_sql("get_provider_name_and_id",
                                              home_provider_name)
            payload = hmpv.add_house_source()
            payload["providerId"] = provider_id
            req_url = pu.house_manage_urls()["add_home_source_url"]
            r = requests.post(req_url, json=payload)
            home_source_name = payload["homeSourceName"]

            if r.status_code:
                # 添加空间信息
                payload = hmpv.add_space()
                payload["homeSourceId"] = db.house_source_sql(
                    "get_home_source_id", home_source_name)
                req_url = pu.house_manage_urls()["add_space_url"]
                r = requests.post(req_url, json=payload)
            else:
                pass
        else:
            pass
コード例 #2
0
 def delete_user_info():
     delete_user_info_payload = {
         "userId":
         str(
             db.system_sql("get_group_id",
                           SystemManageParamsValue.update_username)[0][0])
     }
     return delete_user_info_payload
コード例 #3
0
 def add_house_provider():
     customer_id = db.house_source_sql("get_customer_id",
                                       HouseManageParamsValue.customer_name)
     add_house_provider_payload = {
         "enterpriseAccountId": str(customer_id),
         "providerName": HouseManageParamsValue.house_provider_name
     }
     return add_house_provider_payload
コード例 #4
0
 def repeater_update_instance():
     repeater_update_name = DeviceManageParamsValue.update_repeater_name
     repeater_update_model = DeviceManageParamsValue.update_repeater_model
     id_and_model = db.device_sql("get_product_id_and_model",
                                  DeviceManageParamsValue.repeater_name)
     DeviceManageParamsValue.repeater_id = id_and_model[0]
     return DeviceManageParamsValue.update_instance(
         "zhognjiupdate.png", repeater_update_name, "1",
         repeater_update_model, "", "1", "1", "1", id_and_model[0])
コード例 #5
0
 def collector_update_instance():
     collector_update_instance_name = DeviceManageParamsValue.update_collector_name
     collector_update_instance_model = DeviceManageParamsValue.update_collector_model
     id_and_model = db.device_sql("get_product_id_and_model",
                                  DeviceManageParamsValue.collector_name)
     DeviceManageParamsValue.collector_id = id_and_model[0]
     return DeviceManageParamsValue.update_instance(
         "diancaiupdate.png", collector_update_instance_name, "1",
         collector_update_instance_model, "", "", "1", "1", id_and_model[0])
コード例 #6
0
 def water_meter_update_instance():
     water_update_instance_name = DeviceManageParamsValue.update_water_meter_name
     water_update_instance_model = DeviceManageParamsValue.update_water_meter_model
     id_and_model = db.device_sql("get_product_id_and_model",
                                  DeviceManageParamsValue.water_meter_name)
     DeviceManageParamsValue.water_meter_id = id_and_model[0]
     return DeviceManageParamsValue.update_instance(
         "wmhot.png", water_update_instance_name, "",
         water_update_instance_model, "", "1", "", "", id_and_model[0])
コード例 #7
0
 def lock_update_instance():
     lock_update_instance_name = DeviceManageParamsValue.update_lock_name
     lock_update_instance_model = DeviceManageParamsValue.update_lock_model
     id_and_model = db.device_sql("get_product_id_and_model",
                                  DeviceManageParamsValue.lock_name)
     DeviceManageParamsValue.lock_id = id_and_model[0]
     return DeviceManageParamsValue.update_instance(
         "lockUpdate.png", lock_update_instance_name, "",
         lock_update_instance_model, "", "1", "", "", id_and_model[0])
コード例 #8
0
 def update_user_group():
     groupType = random.choice(["2", "3"])
     SystemManageParamsValue.user_group_id = \
     db.system_sql("get_group_id_with_group_name", SystemManageParamsValue.user_group_name)[0][0]
     update_user_group_payload = {
         "name": SystemManageParamsValue.update_user_group_name,
         "ext": SystemManageParamsValue.update_user_group_description,
         "id": SystemManageParamsValue.user_group_id,
         "groupType": groupType
     }
     return update_user_group_payload
コード例 #9
0
 def smoke_detector_update_instance():
     smoke_detector_update_instance_name = DeviceManageParamsValue.update_smoke_detector_name
     smoke_detector_update_instance_model = DeviceManageParamsValue.update_smoke_detector_model
     id_and_model = db.device_sql(
         "get_product_id_and_model",
         DeviceManageParamsValue.smoke_detector_name)
     DeviceManageParamsValue.smoke_detector_id = id_and_model[0]
     return DeviceManageParamsValue.update_instance(
         "yanganUpdate.png", smoke_detector_update_instance_name, "1",
         smoke_detector_update_instance_model, "", "1", "1", "1",
         id_and_model[0])
コード例 #10
0
 def electric_meter_update_instance():
     electric_update_instance_name = DeviceManageParamsValue.update_electric_name
     electric_update_instance_model = DeviceManageParamsValue.update_electric_model
     id_and_model = db.device_sql(
         "get_product_id_and_model",
         DeviceManageParamsValue.electric_meter_name)
     DeviceManageParamsValue.electric_meter_id = id_and_model[0]
     return DeviceManageParamsValue.update_instance(
         "eleupdate.png", electric_update_instance_name, "1",
         electric_update_instance_model, "0", "1", "2", "1",
         id_and_model[0])
コード例 #11
0
    def center_control_update_instance():

        id_and_model = db.device_sql(
            "get_product_id_and_model",
            DeviceManageParamsValue.ceter_control_name)

        DeviceManageParamsValue.center_control_id = id_and_model[0]
        center_control_update_instance_payload = DeviceManageParamsValue.update_instance(
            "upda.png", DeviceManageParamsValue.update_center_control_name, "",
            DeviceManageParamsValue.update_center_control_model, "", "0", "",
            "", id_and_model[0])

        return center_control_update_instance_payload
コード例 #12
0
 def update_space(self):
     payload = hmpv.update_space()
     payload["homeSourceId"] = CustomerManage.home_source_id
     payload["id"] = db.house_source_sql("get_space_id",
                                         CustomerManage.home_no)
     req_url = pu.house_manage_urls()["update_space_url"]
     r = requests.post(req_url, json=payload, cookies=self.ck)
     CustomerManage.home_source_id = payload["homeSourceId"]
     operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
     self.result_check(r,
                       operate_time,
                       payload,
                       CustomerManage.space_id,
                       query_type="get_space_info")
コード例 #13
0
    def update_house_source(self):

        payload = hmpv.update_house_source()
        payload["id"] = db.house_source_sql("get_home_source_id",
                                            CustomerManage.home_source_name)
        payload["providerId"] = str(CustomerManage.provider_id)
        req_url = pu.house_manage_urls()["update_home_source_url"]
        r = requests.post(req_url, json=payload, cookies=self.ck)

        # 检查 homeSourceName, providerId,id,types,删除状态
        operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
        CustomerManage.home_source_name = payload["homeSourceName"]
        self.result_check(r,
                          operate_time,
                          payload,
                          payload["homeSourceName"],
                          query_type="get_home_source_info")
コード例 #14
0
    def add_house_source(self):

        payload = hmpv.add_house_source()
        payload["providerId"] = db.house_source_sql(
            "get_provider_name_and_id", CustomerManage.home_provider_name)

        req_url = pu.house_manage_urls()["add_home_source_url"]
        r = requests.post(req_url, json=payload, cookies=self.ck)
        CustomerManage.home_source_name = payload["homeSourceName"]
        CustomerManage.addrCode = payload["addrCode"]
        CustomerManage.provider_id = payload["providerId"]
        operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
        self.result_check(r,
                          operate_time,
                          payload,
                          payload["homeSourceName"],
                          query_type="get_home_source_info")
コード例 #15
0
 def add_space(self):
     payload = hmpv.add_space()
     payload["homeSourceId"] = db.house_source_sql(
         "get_home_source_id", CustomerManage.home_source_name)
     req_url = pu.house_manage_urls()["add_space_url"]
     r = requests.post(req_url, json=payload, cookies=self.ck)
     CustomerManage.home_source_id = payload["homeSourceId"]
     CustomerManage.home_no = payload["homeNo"]
     # homelist 检查id,homeSourceId,homeNo,floorNum,del
     # 通过homeSourceId,homeNo确定space 的id
     CustomerManage.space_id = db_wc.house_manage_web_check(
         "get_space_id", payload["homeSourceId"], payload["homeNo"])
     operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
     self.result_check(r,
                       operate_time,
                       payload,
                       CustomerManage.space_id,
                       query_type="get_space_info")
コード例 #16
0
 def update_user_info():
     update_user_info_payload = {
         "userName":
         SystemManageParamsValue.update_username,
         "phone":
         SystemManageParamsValue.update_phone,
         "nickName":
         SystemManageParamsValue.update_nickname,
         "groupId":
         SystemManageParamsValue.update_group_id,
         "states":
         SystemManageParamsValue.update_states,
         "companyName":
         SystemManageParamsValue.update_company_name,
         "id":
         db.system_sql("get_group_id",
                       SystemManageParamsValue.username)[0][0]
     }
     return update_user_info_payload
コード例 #17
0
 def delete_space():
     space_id = db.house_source_sql("get_space_id",
                                    HouseManageParamsValue.update_home_num)
     return space_id
コード例 #18
0
 def delete_house_provider():
     house_provider_id = db.house_source_sql(
         "get_provider_name_and_id",
         HouseManageParamsValue.house_provider_name)
     return house_provider_id
コード例 #19
0
 def delete_house_source():
     house_source_id = db.house_source_sql(
         "get_home_source_id",
         HouseManageParamsValue.update_home_source_name)
     return house_source_id
コード例 #20
0
class SystemManageParamsValue(object):
    # 角色管理--新增角色
    user_group_name = u"自动化组" + time.strftime('%Y-%m-%d_%H:%M:%S',
                                              time.localtime(time.time()))
    user_group_description = u"这是自动化测试使用角色描述。这里有很多时间戳" + time.strftime(
        '%Y-%m-%d_%H:%M:%S', time.localtime(time.time()))
    # 角色管理--更新角色
    update_user_group_name = u"更新!!更新!!自动化组" + time.strftime(
        '%Y-%m-%d_%H:%M:%S', time.localtime(time.time()))
    update_user_group_description = u"更新!!!!更新!!!更新!!!!这是自动化测试使用角色描述。这里有很多时间戳" + time.strftime(
        '%Y-%m-%d_%H:%M:%S', time.localtime(time.time()))
    # 后面为group 添加权限是用到
    user_group_id = ""

    # 用户管理--添加账户
    phone_prefix_list = [
        "130", "131", "132", "133", "134", "135", "136", "137", "138", "139",
        "147", "150", "151", "152", "153", "155", "156", "157", "158", "159",
        "186", "187", "188"
    ]
    first_name = ['张', '金', '李', '王', '赵', '陈', '郭', '宋', '周', '秦', '何', '刘']
    middle_name = ['玉', '明', '龙', '芳', '军', '玲', '才', '伟', '娜', '敏', '静', '杰']
    last_name = ['', '立', '玲', '', '国', '', '玉', '', '秀', '', '桂', '勇']
    username = "******" + time.strftime('%Y-%m-%d_%H:%M:%S',
                                             time.localtime(time.time()))
    phone = random.choice(phone_prefix_list) + "".join(
        random.choice("0123456789") for i in range(8))
    nickname = random.choice(first_name) + random.choice(
        middle_name) + random.choice(last_name) + time.strftime(
            '%Y-%m-%d_%H:%M:%S', time.localtime(time.time()))
    group_name_and_id = db.system_sql("get_group_id_and_name")
    group_name = group_name_and_id[random.randint(0,
                                                  len(group_name_and_id) -
                                                  1)][1]
    group_id = group_name_and_id[random.randint(0,
                                                len(group_name_and_id) - 1)][0]
    states = "0"
    company_name = "auto自动化公司" + time.strftime('%Y-%m-%d_%H:%M:%S',
                                               time.localtime(time.time()))

    # 用户管理--更新账户
    update_username = "******" + time.strftime('%Y-%m-%d_%H:%M:%S',
                                                   time.localtime(time.time()))
    update_phone = random.choice(phone_prefix_list) + "".join(
        random.choice("0123456789") for i in range(8))
    update_nickname = "更新" + random.choice(first_name) + random.choice(
        middle_name) + random.choice(last_name) + time.strftime(
            '%Y-%m-%d_%H:%M:%S', time.localtime(time.time()))
    update_group_name_and_id = db.system_sql("get_group_id_and_name")
    update_group_name = update_group_name_and_id[random.randint(
        0,
        len(update_group_name_and_id) - 1)][1]
    update_group_id = update_group_name_and_id[random.randint(
        0,
        len(update_group_name_and_id) - 1)][0]
    update_states = "1"
    update_company_name = "更新auto自动化公司" + time.strftime(
        '%Y-%m-%d_%H:%M:%S', time.localtime(time.time()))

    # 角色权限配置项

    @staticmethod
    def add_user_info():
        add_user_info_payload = {
            "userName": SystemManageParamsValue.username,
            "phone": SystemManageParamsValue.phone,
            "nickName": SystemManageParamsValue.nickname,
            "groupId": SystemManageParamsValue.group_id,
            "states": SystemManageParamsValue.states,
            "companyName": SystemManageParamsValue.company_name
        }
        return add_user_info_payload

    @staticmethod
    def update_user_info():
        update_user_info_payload = {
            "userName":
            SystemManageParamsValue.update_username,
            "phone":
            SystemManageParamsValue.update_phone,
            "nickName":
            SystemManageParamsValue.update_nickname,
            "groupId":
            SystemManageParamsValue.update_group_id,
            "states":
            SystemManageParamsValue.update_states,
            "companyName":
            SystemManageParamsValue.update_company_name,
            "id":
            db.system_sql("get_group_id",
                          SystemManageParamsValue.username)[0][0]
        }
        return update_user_info_payload

    @staticmethod
    def delete_user_info():
        delete_user_info_payload = {
            "userId":
            str(
                db.system_sql("get_group_id",
                              SystemManageParamsValue.update_username)[0][0])
        }
        return delete_user_info_payload

    @staticmethod
    def add_user_group():
        groupType = random.choice(["2", "3"])
        add_user_group_payload = {
            "name": SystemManageParamsValue.user_group_name,
            "groupType": groupType,
            "ext": SystemManageParamsValue.user_group_description
        }
        return add_user_group_payload

    @staticmethod
    def update_user_group():
        groupType = random.choice(["2", "3"])
        SystemManageParamsValue.user_group_id = \
        db.system_sql("get_group_id_with_group_name", SystemManageParamsValue.user_group_name)[0][0]
        update_user_group_payload = {
            "name": SystemManageParamsValue.update_user_group_name,
            "ext": SystemManageParamsValue.update_user_group_description,
            "id": SystemManageParamsValue.user_group_id,
            "groupType": groupType
        }
        return update_user_group_payload

    # @staticmethod
    # def update_user_group_setting(self):
    #     #更新角色权限配置项
    #     update_user_group_setting_payload={
    #         "groupId":SystemManageParamsValue.user_group_id,
    #         "modifyPowerSettingDtoList":modifyPowerSettingDtoList
    #     }
    @staticmethod
    def delete_user_group():
        delete_user_group_payload = {
            # "groupId": db.system_sql("get_group_id_with_group_name", SystemManageParamsValue.update_group_name)[0][0]
            "groupId": SystemManageParamsValue.user_group_id
        }
        return delete_user_group_payload