Exemplo n.º 1
0
 def pre_test(self):
     nameList = mysqlCon().searchMysql()
     self.log_info(self.casedata)
     self.assert_("已确定无%s的账号信息:",
                  mysqlCon().existName(nameList, self.casedata))
     self.log_info("已确定无%s的账号信息" % self.casedata)
     self.url = urlInfo()
Exemplo n.º 2
0
    def run_test(self):

        baseGo = modelFieldInfo()
        ModelFieldNew = baseGo.nameRandom()
        ModelFieldNameUpdate = baseGo.nameRandom()
        baseGo.creatID(ModelFieldNew)
        resMql = mysqlCon().comMysql(
            "SELECT field_id FROM custom_content_model_field ORDER BY field_id desc LIMIT 1"
        )
        ModelFieldId = resMql[0][0]
        findNewRes = baseGo.FindID(ModelFieldId)
        self.assert_("创建ModelField是否成功",
                     findNewRes["data"]["fieldName"] == ModelFieldNew)
        self.log_info("成功创建ModelField名称:%s,ModelFieldID:%s" %
                      (ModelFieldNew, ModelFieldId))

        baseGo.update(ModelFieldId, ModelFieldNameUpdate)
        findNewRes = baseGo.AccurateSearch(ModelFieldId)
        self.assert_(
            "修改程序是否成功",
            findNewRes["data"]["fieldName"] == ModelFieldNameUpdate)  # 验证是否修改
        self.log_info("成功执行修改程序,修改指定id的Name")

        baseGo.delete(ModelFieldId)
        mysqlCon().comMysql(
            "DELETE FROM custom_content_model_field WHERE field_id = %s" %
            ModelFieldId)
        resMql = mysqlCon().comMysql(
            "SELECT * FROM custom_content_model_field WHERE field_id = %s" %
            ModelFieldId)
        self.assert_("指定id是否已经被清理", (len(resMql) == 0))
Exemplo n.º 3
0
    def run_test(self):

        baseGo = SiteInfo()
        siteNew = baseGo.nameRandom()
        siteNameUpdate = baseGo.nameRandom()
        baseGo.creatID(siteNew)
        res  = baseGo.FindID()
        siteId = res["data"]["list"][0]["appId"]
        findNewRes = baseGo.AccurateSearch(siteId)
        self.assert_("创建site是否成功", findNewRes["data"]["appTitle"] == siteNew)
        self.log_info("成功创建site名称:%s,siteId:%s" % (siteNew, siteId))

        baseGo.update(siteId,siteNameUpdate)
        findNewRes = baseGo.AccurateSearch(siteId)
        self.assert_("修改程序是否成功", findNewRes["data"]["appTitle"] == siteNameUpdate)  # 验证是否修改
        self.log_info("成功执行修改程序,修改指定id的Name")


        enp = baseGo.delete(siteId)
        res = re.findall("cn.fy.common.exception.ResultException: (.+)", enp)
        self.assert_("删除功能权限是否开放", res[0] == '该操作危险,系统暂不开放')
        mysqlCon().comMysql("DELETE FROM site_app WHERE app_id = %s" % siteId)
        resMql = mysqlCon().comMysql("SELECT * FROM site_app WHERE app_id = %s" % siteId)
        self.log_info(resMql)
        self.assert_("指定id是否已经被清理", (len(resMql) == 0))
Exemplo n.º 4
0
    def run_test(self):

        baseGo = dictGroup()
        pageNew = baseGo.nameRandom()
        pageNameUpdate = baseGo.nameRandom()
        baseGo.creatID(pageNew)
        res = baseGo.FindID()
        self.log_info(res)
        pageId = res["data"]["list"][-1]["groupId"]
        findNewRes = baseGo.AccurateSearch(pageId)
        self.assert_("创建page是否成功", findNewRes["data"]["groupCode"] == pageNew)
        self.log_info("成功创建page名称:%s,modelID:%s" % (pageNew, pageId))

        baseGo.update(pageId, pageNameUpdate)
        findNewRes = baseGo.AccurateSearch(pageId)
        self.assert_(
            "修改程序是否成功",
            findNewRes["data"]["groupCode"] == pageNameUpdate)  # 验证是否修改
        self.log_info("成功执行修改程序,修改指定id的Name")

        baseGo.delete(pageId)
        mysqlCon().comMysql(
            "DELETE FROM custom_dict_group WHERE group_id = %s" % pageId)
        resMql = mysqlCon().comMysql(
            "SELECT * FROM custom_dict_group WHERE group_id = %s" % pageId)
        print(resMql)
        self.assert_("指定id是否已经被清理", (len(resMql) == 0))
Exemplo n.º 5
0
    def run_test(self):

        baseGo = modelInfo()
        modelNew = baseGo.nameRandom()
        modelNameUpdate = baseGo.nameRandom()
        baseGo.creatID(modelNew)
        res = baseGo.FindID()
        modelId = res["data"]["list"][0]["modelId"]
        findNewRes = baseGo.AccurateSearch(modelId)
        self.assert_("创建model是否成功",
                     findNewRes["data"]["modelName"] == modelNew)
        self.log_info("成功创建model名称:%s,modelID:%s" % (modelNew, modelId))

        baseGo.update(modelId, modelNameUpdate)
        findNewRes = baseGo.AccurateSearch(modelId)
        self.assert_(
            "修改程序是否成功",
            findNewRes["data"]["modelName"] == modelNameUpdate)  # 验证是否修改
        self.log_info("成功执行修改程序,修改指定id的Name")

        # baseGo.delete(modelId)
        mysqlCon().comMysql(
            "DELETE FROM custom_content_model WHERE model_id = %s" % modelId)
        resMql = mysqlCon().comMysql(
            "SELECT * FROM custom_content_model WHERE model_id = %s" % modelId)
        self.assert_("指定id是否已经被清理", (len(resMql) == 0))
Exemplo n.º 6
0
    def run_test(self):

        baseGo = reviewInfo()
        #上传文件至网页端目录
        enpPath = baseGo.upfilisBatch(settings.PROJECT_ROOT_DIR +
                                      r"\resources\FIles\pingLun.xlsx")
        #上传评论到网页
        res = baseGo.importDo(enpPath)
        self.comparsion("批量创建评论", res["msg"] == "执行成功")
        #清理data数据,以test开头的评论
        sql = 'DELETE FROM review_reviews WHERE content LIKE "test%"'
        mysqlCon().comMysql(sql)
        pass
Exemplo n.º 7
0
    def run_test(self):

        baseGo = self.baseGo
        modelNew = baseGo.nameRandom()
        modelNameUpdate = baseGo.nameRandom()
        baseGo.creatID(modelNew)
        res = baseGo.FindID()
        self.log_info(res)
        modelId = res["data"]["list"][0]["id"]
        findNewRes = baseGo.AccurateSearch(modelId)
        self.assert_("创建model是否成功", findNewRes["data"]["keywords"] == modelNew)
        self.log_info("成功创建model名称:%s,modelID:%s" % (modelNew, modelId))

        baseGo.update(modelId, modelNameUpdate)
        findNewRes = baseGo.AccurateSearch(modelId)
        self.log_info("修改后的model:%s" % findNewRes)
        self.assert_(
            "修改程序是否成功",
            findNewRes["data"]["keywords"] == modelNameUpdate)  # 验证是否修改
        self.assert_("修改程序是否成功",
                     findNewRes["data"]["isOpen"] == 1)  #验证修改isOpen是否有效
        self.log_info("成功执行修改程序,修改指定id的Name")
        #删除
        baseGo.delete(modelId)
        # mysqlCon().comMysql("DELETE FROM custom_content_model WHERE model_id = %s" % modelId)
        #验证其数据库知否存在该数据
        resMql = mysqlCon().comMysql(
            "SELECT * FROM ad_position WHERE id = %s" % modelId)
        self.assert_("指定id是否已经被清理", (len(resMql) == 0))
Exemplo n.º 8
0
 def post_test(self):
     # 删除该账号
     urldel = self.url.urlBasefun() + "ms/sys/sys_manager/delete.do"
     payload = "[%s]" % self.managerId
     response = requests.request("POST",
                                 urldel,
                                 data=payload,
                                 headers=self.headers)
     self.log_info("删除功能response:%s" % response.text)
     #从数据库中验证是否已经删除
     nameList = mysqlCon().searchMysql()
     self.log_info(r"查找数据库是否存在该账户:" + str(self.newName in nameList))
     # print(self.newName,nameList)
     urlCheck = self.url.urlBasefun(
     ) + "ms/sys/sys_manager/info/%s.do" % self.managerId
     responseCheck = requests.request("POST",
                                      urlCheck,
                                      data=payload,
                                      headers=self.headers)
     responseCheck = json.loads(responseCheck.text)
     self.log_info("调用查找接口response:%s" % responseCheck)
     if (self.newName
             in nameList) == False and responseCheck['data'] == None:
         self.log_info("添加成功,数据库中已经不含有%s,删除功能已经实现" % self.newName)
         self.log_info("新增账号已清理")
     else:
         raise ("账号未被清理")
Exemplo n.º 9
0
    def run_test(self):

        baseGo = self.baseGo
        modelNew = baseGo.nameRandom()
        baseGo.creatID(modelNew)
        res  = baseGo.FindID()
        self.log_info(res)
        modelId = res["data"]["list"][0]["id"]
        self.log_info("该信息的id:%s"%modelId)
        baseGo.delete(modelId) #删除
        time.sleep(2)

        #验证其数据库知否存在该数据
        resMql = mysqlCon().comMysql("SELECT del_flag FROM message where id = %s" % modelId)
        self.assert_( "指定id是否已经被清理,flag已更改为1",(resMql[0][0] == 1))
        #清理数据库测试数据
        mysqlCon().comMysql("delete FROM message where id = %s" % modelId)
Exemplo n.º 10
0
 def getModelId(self):
     '''
         获得数据库model_id最新添加的一个modelID
     :return:最新modelId
     '''
     resMql = mysqlCon().comMysql("SELECT model_id FROM sys_model order by model_id DESC LIMIT 1")
     print(resMql)
     rootModelID = resMql[0][0]
     return  rootModelID
Exemplo n.º 11
0
    def run_test(self):
        baseGo = roleModelInfo()
        dirName = baseGo.nameRandom()
        rootName = baseGo.nameRandom()
        buttonName = baseGo.nameRandom()
        dirButtonName = baseGo.nameRandom()
        dirButtonNameUpdate = baseGo.nameRandom()
        baseGo.creatModel(rootName, 1, 0)  # 执行创建根目录菜单
        rootModelID = baseGo.getModelId()

        findNewRes = baseGo.AccurateSearch(rootModelID)
        self.assert_("创建一级菜单栏是否成功",findNewRes["data"]["modelTitle"] == rootName)
        self.log_info("成功创建一级菜单栏名称:%s,modelID:%s" % (rootName, rootModelID))

        baseGo.creatModel(dirName, 1, rootModelID)  # 在根目录下创建二级目录菜单
        dirModelID = baseGo.getModelId()

        findNewRes = baseGo.AccurateSearch(dirModelID)
        self.assert_("创建二级菜单栏名称是否成功",findNewRes["data"]["modelTitle"] == dirName)
        self.log_info("成功创建二级菜单栏名称:%s,modelID:%s" % (dirName, dirModelID))

        baseGo.creatModel(buttonName, 2, rootModelID)  # 执行创建二级目录按钮
        buttonModelID = baseGo.getModelId()

        findNewRes = baseGo.AccurateSearch(buttonModelID)
        self.assert_( "创建二级按钮是否成功",findNewRes["data"]["modelTitle"] == buttonName)
        self.log_info("成功创建二级按钮名称:%s,modelID:%s" % (buttonName, buttonModelID))

        baseGo.creatModel(dirButtonName, 2, dirModelID)  # 执行创建二级目录菜单下创建按钮
        dirModelID_twice = baseGo.getModelId()

        findNewRes = baseGo.AccurateSearch(dirModelID_twice)
        self.assert_( "创建二级菜单栏按钮是否成功",findNewRes["data"]["modelTitle"] == dirButtonName)
        self.log_info("成功创建二级菜单栏按钮名称:%s,modelID:%s" % (dirButtonName, dirModelID_twice))


        baseGo.update(dirModelID_twice, dirModelID, dirButtonNameUpdate)
        findNewRes = baseGo.AccurateSearch(dirModelID_twice)
        self.assert_( "修改程序是否成功",findNewRes["data"]["modelTitle"] == dirButtonNameUpdate)  # 验证是否修改
        self.log_info("成功执行修改程序,修改指定id的Name")


        baseGo.delete(dirModelID_twice)
        resMql = mysqlCon().comMysql("SELECT model_id FROM sys_model where model_id = %s" % dirModelID_twice)
        self.assert_( "指定id是否已经被清理",(len(resMql) == 0))
        self.log_info("成功删除指定id的记录")

        self.log_info("清理根目录数据")
        baseGo.delete(rootModelID)
Exemplo n.º 12
0
 def run_test(self):
     url = self.url.urlBasefun() + "ms/sys/sys_manager/save.do"
     self.log_info("创建新用户%s" % self.url.nameRandom())
     self.newName = self.url.nameRandom()
     payload = {
         "createBy": 0,
         "createDate": "2019-08-01T01:25:03.800Z",
         "createDateStr": "string",
         "del": 0,
         "managerName": "%s" % self.newName,
         "managerNickname": "strog",
         "managerPassword": "******",
         "managerSalt": "string",
         "roleIdList": [self.casedata['roleID']],
         "updateBy": 0,
         "updateDate": "2019-08-01T01:25:03.800Z",
         "updateDateStr": "string"
     }
     self.headers = {
         'Cookie': 'accountName = liubo;%s' % self.url.keepSession()
     }
     responseAdd = requests.request("POST",
                                    url,
                                    json=payload,
                                    headers=self.headers)
     self.log_info("新增接口返回response:%s" % responseAdd.text)
     nameList = mysqlCon().searchMysql()
     self.log_info(r"查找数据库是否存在该账户:" + str(self.newName in nameList))
     if (self.newName in nameList) == True:
         self.log_info("添加成功,数据库中已经含有%s,添加功能已经实现" % self.newName)
     #索引获取manager_id
     urlList = self.url.urlBasefun() + "ms/sys/sys_manager/list.do"
     querystring = {
         "sortOrder": "asc",
         "pageSize": "10",
         "pageNumber": "1",
         "pageNo": "1"
     }
     responseList = requests.request("POST",
                                     urlList,
                                     headers=self.headers,
                                     params=querystring)
     responseList = json.loads(responseList.text)
     self.managerId = responseList['data']['list'][0]['managerId']
     #获得最新的managerID
     self.log_info("新增账号的managerId:%s" %
                   responseList['data']['list'][0]['managerId'])
Exemplo n.º 13
0
    def run_test(self):

        baseGo = self.baseGo
        modelNew = baseGo.nameRandom()
        baseGo.creatID(modelNew)
        res  = baseGo.FindID()
        # self.log_info(res)
        modelId = res["data"]["list"][0]["id"]
        self.log_info("该信息的id:%s"%modelId)
        tel = res["data"]["list"][0]["tel"]
        self.log_info(baseGo.phone(tel))
        self.comparsion("该手机号已经被加密","错误的手机号"==baseGo.phone(tel))

        baseGo.delete(modelId) #删除
        time.sleep(2)

        #验证其数据库知否存在该数据
        resMql = mysqlCon().comMysql("SELECT * FROM message where id = %s" % modelId)
        self.comparsion( "指定id是否已经被清理",(len(resMql) == 0))
Exemplo n.º 14
0
    def run_test(self):

        baseGo = DictInfo()
        dictNew = baseGo.nameRandom()
        dictNameUpdate = baseGo.nameRandom()
        baseGo.creatID(dictNew)
        res = baseGo.FindID()
        dictId = res["data"]["list"][0]["dictId"]
        findNewRes = baseGo.AccurateSearch(dictId)
        self.assert_("创建dict是否成功", findNewRes["data"]["dictName"] == dictNew)
        self.log_info("成功创建dict名称:%s,modelID:%s" % (dictNew, dictId))

        baseGo.update(dictId, dictNameUpdate)
        findNewRes = baseGo.AccurateSearch(dictId)
        self.assert_(
            "修改程序是否成功",
            findNewRes["data"]["dictName"] == dictNameUpdate)  # 验证是否修改
        self.log_info("成功执行修改程序,修改指定id的Name")

        baseGo.delete(dictId)
        resMql = mysqlCon().comMysql(
            "SELECT * FROM custom_dict WHERE dict_id = %s" % dictId)
        self.assert_("指定id是否已经被清理", (len(resMql) == 0))
Exemplo n.º 15
0
    def AccurateSearch(self, id):
        url = SiteInfo().urlBasefun() + "ms/sys/site_app/info/%s.do" % id
        headers = {
            'Content-Type': "application/json",
            'Cookie': "%s" % SiteInfo()._keepSession(),
        }
        response = requests.request("POST", url, headers=headers)
        response = json.loads(response.text)
        return  response


if __name__ == '__main__':
    baseGo = SiteInfo()
    siteId=33
    # print(baseGo.delete("63"))
    mysqlCon().comMysql("DELETE FROM site_app WHERE app_id = 18")

    # baseGo.update(26,"test123")
    # enp = baseGo.delete(26)
    # res  = re.findall("cn.fy.common.exception.ResultException: (.+)",enp)
    # print(res)
# # import requests
#     name = '60'
#     url = "http://csf.91clt.com:8090/fycms/ms/sys/site_app/delete.do"
#     payload = "[\r\n  %s\r\n]"%name
#     headers = {
#         'Content-Type': "application/json",
#         'Cookie': "%s"%SiteInfo()._keepSession(),
#
#         }
#
        headers = {
            'Content-Type': "application/json",
            'Cookie': "%s" % reviewInfo()._keepSession(),
        }
        response = requests.request("GET", url, headers=headers, params=querystring)
        response = json.loads(response.text)
        return  response


if __name__ == '__main__':
    baseGo = reviewInfo()

    enpPath = baseGo.upfilisBatch(settings.PROJECT_ROOT_DIR+r"\resources\FIles\pingLun.xlsx")
    res = baseGo.importDo(enpPath)
    sql = 'DELETE FROM review_reviews WHERE content LIKE "test%"'
    enpMysql = mysqlCon().comMysql(sql)
    print(enpMysql)











    # print(baseGo.GetFiles()
    # for dir_path, dir_names, file_names in test_resources.walk("/"):
    #     log_info("dir_path=%s" % dir_path)