Ejemplo n.º 1
0
    def test_login(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/reviewDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        conf = Configure(path)

        try:
            conf_Filename = "reviewDr.ini"
            Request = requestAPI(log, conf_Filename)
            res = Request.execute("config_reviewDr.xlsx", "checkLogin",
                                  "login_reviewDr")
            if res.status_code == 200:
                cookies = requests.utils.dict_from_cookiejar(
                    res.cookies)  # 返回值 jessionid
                result = res.json()  #返回值 json
                print(cookies)
                print(result)
                role = result["data"]["role"]
                user_id = (result["data"]["user_id"])
                #处理cookies格式
                key = cookies["SESSION"]
                cookies = "SESSION" + "=" + key
                #把cookies传递出去,后续请求使用

                conf.Set("login", "cookies", cookies)  # 设置 setion、option、value
                conf.Set("login", "role", str(role))
                conf.Set("login", "user_id", str(user_id))
        except Exception as e:
            log.error("=====case error ====%s" % e)
            pytest.fail("CASE FAIL")
Ejemplo n.º 2
0
    def test_user_patient_AUDIT_PASS(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/superAdmin.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_filename = "superAdmin.ini"
        Request = requestAPI(log, conf_filename, section)
        result = Request.execute("config_superAdmin.xlsx", "common",
                                 "patientList_AUDIT_PASS")

        # print(result)
        log.info("返回结果为:")
        log.info(result)

        # 取到已审核的报告ID放入 superAdmin.ini中

        if result["users"] != []:
            conf = Configure(path)

            for user in result["users"]:
                reportList_AUDIT_PASS.append(user["record_id"])

                # 把List状态传到superAdmin.ini中
            for i in range(0, len(reportList_AUDIT_PASS)):
                conf.Set("AUDIT_PASS_report", "report" + str(i),
                         str(reportList_AUDIT_PASS[i]))
        else:
            return result["users"]
Ejemplo n.º 3
0
    def test_user_patient_EDITING(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/markDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_Filename = "markDr.ini"
        Request = requestAPI(log, conf_Filename, section)
        result = Request.execute("config_markDr.xlsx", "common",
                                 "patientList_EDITING")

        # print(result)
        log.info("返回结果为:")
        log.info(result)

        if result["users"] != []:
            conf = Configure(path)
            for user in result["users"]:
                reportList_EDITING.append(user["record_id"])

                # 把List状态传到markDr.ini中
            for i in range(0, len(reportList_EDITING)):
                conf.Set("EDITING_report", "report" + str(i),
                         str(reportList_EDITING[i]))
        else:
            log.info("当前状态下没有报告")
Ejemplo n.º 4
0
    def test_user_patient_ANALYZE_FAILED(self):
        log = Logger(os.path.basename(__file__))
        log = log.getlog()
        path = os.path.dirname(
            os.path.dirname(os.path.dirname(
                os.path.abspath(__file__)))) + "/configure/uploaderDr.ini"
        if 'Windows' in platform.system():
            # windows os
            path = path.replace('/', '\\')
        section = "login"  # 传入配置文件的section
        conf_filename = "uploaderDr.ini"
        Request = requestAPI(log, conf_filename, section)
        result = Request.execute("config_uploaderDr.xlsx", "common",
                                 "patientList_ANALYZE_FAILED")

        # print(result)
        log.info("返回结果为:")
        log.info(result)

        # 取到分析失败的报告ID放入 uploaderDr.ini中

        if result["users"] != []:
            conf = Configure(path)

            for user in result["users"]:
                reportList_ANALYZE_FAILED.append(user["record_id"])

                # 把List状态传到uploaderDr.ini中
            for i in range(0, len(reportList_ANALYZE_FAILED)):
                conf.Set("ANALYZE_FAILED_report", "report" + str(i),
                         str(reportList_ANALYZE_FAILED[i]))
        return result["users"]