Beispiel #1
0
 def get_login_decode(cls, base_url, session, login_path, decode_path):
     # 登录
     login_data = Utility.read_json(login_path)
     login_url = base_url + login_data[0][0]["login_url"]
     Service.login(session, login_url, login_data[0][1])
     # 解密
     decode_data = Utility.read_json(decode_path)
     decode_url = base_url + decode_data[0][0]["decode_url"]
     Service.decode(session, decode_url, decode_data[0][1])
 def setUp(self):
     self.session = requests.session()
     self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
     # 登录
     login_data = Utility.read_json("../../test_data/login_data/login_data")
     login_url = self.base_url + login_data[0][0]["login_url"]
     Service.login(self.session, login_url, login_data[0][1])
     # 解密
     decode_data = Utility.read_json("../../test_data/login_data/decode_data")
     decode_url = self.base_url + decode_data[0][0]["decode_url"]
     Service.decode(self.session, decode_url, decode_data[0][1])
 def setUp(self):
     self.session = requests.session()
     self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
     # 登陆(咨询主管:郑雪姣)、解密
     counselor_login_path = "../../test_data/login_data/counselor_login_data"
     decode_path = "../../test_data/login_data/decode_data"
     Service.get_login_decode(self.base_url, self.session, counselor_login_path, decode_path)
Beispiel #4
0
    def sql_query_allocating_resource(cls, query_info, path):
        base_sql = Utility.read_json(path)
        # "source": "专属", "info": ""
        # 00
        if query_info["source"] == "" and query_info["region"] == "":
            return base_sql["1"]
        # 01
        elif query_info["source"] == "" and query_info["region"] != "":
            condition = Service.judge_cusInfo(query_info["info"])
            if condition == 1:
                return base_sql["201"][0] % (query_info["info"])
            elif condition == 2:
                return base_sql["202"][0] % (query_info["info"])
            elif condition == 3:
                return base_sql["203"][0] % (query_info["info"])
        # 10
        elif query_info["source"] != "" and query_info["region"] == "":
            return base_sql["3"]

        # 11
        elif query_info["source"] != "" and query_info["region"] != "":
            condition = Service.judge_cusInfo(query_info["info"])
            if condition == 1:
                return base_sql["401"][0] % (query_info["source"],
                                             query_info["info"])
            elif condition == 2:
                return base_sql["402"][0] % (query_info["source"],
                                             query_info["info"])
            elif condition == 3:
                return base_sql["403"][0] % (query_info["source"],
                                             query_info["info"])
 def setUp(self):
     self.session = requests.session()
     self.base_url = self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
     # 登陆(咨询主管:李毅)、解密
     teacher_login_path = "../../test_data/login_data/teacher_manage_login_data"
     decode_path = "../../test_data/login_data/decode_data"
     Service.get_login_decode(self.base_url, self.session, teacher_login_path, decode_path)
Beispiel #6
0
    def sql_query_trans_feree(cls, query_info, path):
        base_sql = Utility.read_json(path)
        # 0000
        if query_info["workId"] == "" and query_info["region"] == "" and query_info["source"] == "" and \
                query_info["status"] == "" :
            return base_sql["1"]
            #   "select count(customer_id) from customer;"
        # 0011
        elif query_info["workId"] == "" and query_info["region"] == "" and query_info["source"] != "" and \
                query_info["status"] != "" :
            return base_sql["2"] % (query_info["source"], query_info["status"])
            # "select count(customer_id) from customer where source='%s' and last_status='%s';"%(query_info["source"], query_info["status"])
        # 0101
        elif query_info["workId"] == "" and query_info["region"] != "" and query_info["source"] == "" and \
                query_info["status"] != "" :
            return base_sql["3"] % (query_info["region"], query_info["status"])
            # "select count(customer_id) from customer where region='%s' and last_status='%s';"%(query_info["region"], query_info["status"])

        # 0110
        elif query_info["workId"] == "" and query_info["region"] != "" and query_info["source"] != "" and \
             query_info["status"] == "":
            return base_sql["4"] % (query_info["region"], query_info["source"])
            # "select count(customer_id) from customer where region='%s' and source='%s';"%(query_info["region"], query_info["source"])

        # 1001
        elif query_info["workId"] != "" and query_info["region"] == "" and query_info["source"] == "" and \
             query_info["status"] != "":
            return base_sql["5"] % (query_info["workId"], query_info["status"])
            # "select count(customer_id) from customer where work_id='%s' and status='%s';"%(empName_work_id, query_info["status"])

        # 1010
        elif query_info["workId"] != "" and query_info["region"] == "" and query_info["source"] != "" and \
             query_info["status"] == "":
            return base_sql["6"] % (query_info["workId"], query_info["source"])
            # "select count(customer_id) from customer where work_id='%s' and source='%s';"%(empName_work_id, query_info["source"])

        # 1100
        elif query_info["workId"] != "" and query_info["region"] != "" and query_info["source"] == "" and \
             query_info["status"] == "":
            return base_sql["7"] % (query_info["workId"], query_info["region"])
        # "select count(customer_id) from customer where work_id='%s' and region='%s';"%(empName_work_id, query_info["region"])

        # 1111
        elif query_info["workId"] != "" and query_info["region"] != "" and query_info["source"] != "" and \
             query_info["status"] != "":
            return base_sql["8"] % (query_info["workId"], query_info["region"],
                                    query_info["source"], query_info["status"])
Beispiel #7
0
 def sql_query_common_resource_pool(cls, query_info, path):
     base_sql = Utility.read_json(path)
     # 000
     if query_info["workId"] == "全部" and query_info[
             "lastStatus"] == "全部" and query_info["source"] == "全部":
         return base_sql["1"]
     # 011
     elif query_info["workId"] == "全部" and query_info[
             "lastStatus"] != "" and query_info["source"] != "":
         return base_sql["2"] % (query_info["lastStatus"],
                                 query_info["source"])
     # 101
     elif query_info["workId"] != "全部" and query_info[
             "lastStatus"] == "" and query_info["source"] != "全部":
         return base_sql["3"] % (query_info["workId"], query_info["source"])
     # 110
     elif query_info["workId"] != "全部" and query_info[
             "lastStatus"] != "全部" and query_info["source"] == "":
         return base_sql["4"] % (query_info["workId"],
                                 query_info["lastStatus"])
Beispiel #8
0
import unittest
from parameterized import parameterized
from interface.common.training_resource.Transferee import Transferee
from interface.util.Service import Service
from interface.util.Utility import Utility
import re
import requests

# 数据
open_transferee_data = Utility.read_json(
    "../../test_data/training_resource/transferee_module/open_transferee_data")

trans_feree_data = Utility.read_json(
    "../../test_data/training_resource/transferee_module/trans_feree_data")

show_resume_data = Utility.read_json(
    "../../test_data/training_resource/transferee_module/show_resume_data")

switch_page_data = Utility.read_json(
    "../../test_data/training_resource/transferee_module/switch_page_data")

submit_data = Utility.read_json(
    "../../test_data/training_resource/transferee_module/submit_data")
'''培训资源模块  子模块 转让责任人'''


class TransfereeTest(unittest.TestCase):

    # 自定义,登录、解密
    def setUp(self):
        self.session = requests.session()
Beispiel #9
0
import re
import requests
import unittest
from parameterized import parameterized
from interface.util.Service import Service
from interface.util.Utility import Utility

open_common_resource_pool_data = Utility.read_json(
    "../../test_data/training_resource/common_resource_pool_module/open_common_resource_pool_data"
)

query_common_resource_pool_data = Utility.read_json(
    "../../test_data/training_resource/common_resource_pool_module/query_common_resource_pool_data"
)

claim_data = Utility.read_json(
    "../../test_data/training_resource/common_resource_pool_module/claim_data")


class CommonResourcePoolTest(unittest.TestCase):

    # 开始
    def setUp(self):
        self.session = requests.session()
        self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
        # 登陆(咨询主管:郑雪姣)、解密
        counselor_login_path = "../../test_data/login_data/counselor_login_data"
        decode_path = "../../test_data/login_data/decode_data"
        Service.get_login_decode(self.base_url, self.session,
                                 counselor_login_path, decode_path)
import requests
import unittest
from parameterized import parameterized
from interface.util.Service import Service
from interface.util.Utility import Utility

open_allocating_resource_data = Utility.read_json(
    "../../test_data/training_resource/allocating_resource_module/open_allocating_resource_data")

allocating_resource_data = Utility.read_json(
    "../../test_data/training_resource/allocating_resource_module/query_allocating_resource_data")

commit_allocating_resource_data = Utility.read_json(
    "../../test_data/training_resource/allocating_resource_module/commit_allocating_resource_data")


'''培训资源子模块,分配资源'''

class AllocatingResourceTest(unittest.TestCase):
    # 自定义,初始化driver,窗口最大化,隐式等待
    def setUp(self):
        self.session = requests.session()
        self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
        # 登陆(咨询主管:郑雪姣)、解密
        counselor_login_path = "../../test_data/login_data/counselor_login_data"
        decode_path = "../../test_data/login_data/decode_data"
        Service.get_login_decode(self.base_url, self.session, counselor_login_path, decode_path)

    # 用例,打开分配资源页面
    @parameterized.expand(open_allocating_resource_data)
    def test_open_allocating_resource(self, url, expect):
Beispiel #11
0
    def sql_query_training_resource(cls, query_info, path):
        base_sql = Utility.read_json(path)
        # 1111111
        if query_info["poolType"] == "" and query_info["empName"] == "" and query_info["lastStatus"] == "" and \
                        query_info["source"] == "" and query_info["s_time"] == "" and query_info["e_time"] == "" and \
                query_info["cusInfo"] == "" :
            return base_sql["1"]
        # 1112222
        elif query_info["poolType"] == "" and query_info["empName"] == "" and query_info["lastStatus"] == "" and \
            query_info["source"] != "" and query_info["s_time"] != "" and query_info["e_time"] != "" and \
                query_info["cusInfo"] != "" :
            return base_sql["2"] % (query_info["source"],
                                    query_info["cusInfo"],
                                    query_info["s_time"], query_info["e_time"])

        # 1221122
        elif query_info["poolType"] == "" and query_info["empName"] != "" and query_info["lastStatus"] != "" and \
            query_info["source"] == "" and query_info["s_time"] == "" and query_info["e_time"] != "" and \
                query_info["cusInfo"] != "" :

            # 判断用户信息 类别
            condition = Service.judge_cusInfo(query_info["cusInfo"])
            empName_work_id = Utility.get_connect_one(
                "select work_id from employee where employee_name='%s'" %
                (query_info["empName"]), '../../config/data_base')

            if condition == 1:
                return base_sql["3"][0] % (
                    empName_work_id, query_info["lastStatus"], empName_work_id,
                    query_info["e_time"])
            elif condition == 2:
                return base_sql["3"][1] % (
                    empName_work_id, query_info["lastStatus"], empName_work_id,
                    query_info["e_time"])
            elif condition == 3:
                return base_sql["3"][2] % (
                    empName_work_id, query_info["lastStatus"], empName_work_id,
                    query_info["e_time"])
        # 1222211
        elif query_info["poolType"] == "" and query_info["empName"] != "" and query_info["lastStatus"] != "" and \
            query_info["source"] != "" and query_info["s_time"] != "" and query_info["e_time"] == "" and \
                query_info["cusInfo"] == "" :
            empName_work_id = Utility.get_connect_one(
                "select work_id from employee where employee_name='%s'" %
                (query_info["empName"]), '../../config/data_base')
            return base_sql["4"] % (empName_work_id, query_info["lastStatus"],
                                    query_info["source"], query_info["s_time"])

        # 2121212
        elif query_info["poolType"] != "" and query_info["empName"] == "" and query_info["lastStatus"] != "" and \
                query_info["source"] == "" and query_info["s_time"] != "" and query_info["e_time"] == "" and \
                query_info["cusInfo"] != "":
            condition = Service.judge_cusInfo(query_info["cusInfo"])
            if condition == 1:
                return base_sql["5"][0] % (
                    query_info["poolType"], query_info["lastStatus"],
                    query_info["cusInfo"], query_info["s_time"])
            elif condition == 2:
                return base_sql["5"][1] % (
                    query_info["poolType"], query_info["lastStatus"],
                    query_info["cusInfo"], query_info["s_time"])
            elif condition == 3:
                return base_sql["5"][2] % (
                    query_info["poolType"], query_info["lastStatus"],
                    query_info["cusInfo"], query_info["s_time"])

        # 2122121
        elif query_info["poolType"] != "" and query_info["empName"] == "" and query_info["lastStatus"] != "" and \
                query_info["source"] != "" and query_info["s_time"] == "" and query_info["e_time"] != "" and \
                query_info["cusInfo"] == "":
            return base_sql["6"] % (query_info["poolType"],
                                    query_info["lastStatus"],
                                    query_info["source"], query_info["e_time"])

        # 2211221
        elif query_info["poolType"] != "" and query_info["empName"] != "" and query_info["lastStatus"] == "" and \
                query_info["source"] == "" and query_info["s_time"] != "" and query_info["e_time"] != "" and \
                query_info["cusInfo"] == "":
            empName_work_id = Utility.get_connect_one(
                "select work_id from employee where employee_name='%s'" %
                (query_info["empName"]), '../../config/data_base')
            return base_sql["7"] % (query_info["poolType"], empName_work_id,
                                    query_info["s_time"], query_info["e_time"])

        # 2212112
        elif query_info["poolType"] != "" and query_info["empName"] != "" and query_info["lastStatus"] == "" and \
                query_info["source"] != "" and query_info["s_time"] == "" and query_info["e_time"] == "" and \
                query_info["cusInfo"] != "":
            condition = Service.judge_cusInfo(query_info["cusInfo"])
            empName_work_id = Utility.get_connect_one(
                "select work_id from employee where employee_name='%s'" %
                (query_info["empName"]), '../../config/data_base')
            if condition == 1:
                return base_sql["8"][0] % (
                    query_info["poolType"], empName_work_id,
                    query_info["source"], query_info["cusInfo"])
            elif condition == 2:
                return base_sql["8"][1] % (
                    query_info["poolType"], empName_work_id,
                    query_info["source"], query_info["cusInfo"])
            elif condition == 3:
                return base_sql["8"][2] % (
                    query_info["poolType"], empName_work_id,
                    query_info["source"], query_info["cusInfo"])
Beispiel #12
0
import requests
import unittest
from parameterized import parameterized
from interface.util.Service import Service
from interface.util.Utility import Utility

open_advisory_department = Utility.read_json(
    "../../test_data/training_resource/report_center_data/open_advisory_department_data"
)
'''报表中心子模块,咨询部'''


class AdvisoryDepartmentTest(unittest.TestCase):
    # 自定义,初始化driver,窗口最大化,隐式等待
    def setUp(self):
        self.session = requests.session()
        self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
        # 登陆(admin)、解密
        login_path = "../../test_data/login_data/login_data"
        decode_path = "../../test_data/login_data/decode_data"
        Service.get_login_decode(self.base_url, self.session, login_path,
                                 decode_path)

    # 用例,打开分配资源页面
    @parameterized.expand(open_advisory_department)
    def test_open_advisory_department(self, url, expect):
        open_advisory_department_url = self.base_url + url[
            "open_allocating_resource_url"]
        open_advisory_department_resp = Service.get_no_arguments(
            self.session, open_advisory_department_url)
        if "分配资源" in open_allocating_resource_resp.text:
import re
import unittest
import requests
from parameterized import parameterized
from interface.common.training_resource.TrainingResource import TrainingResource
from interface.config.try_to_encode_and_decode_woniu import WoniuBoss
from interface.util.Service import Service
from interface.util.Utility import Utility


open_training_resource_data = Utility.read_json(
    "../../test_data/training_resource/training_resource_module/open_transferee_data")

training_resource_data = Utility.read_json(
    "../../test_data/training_resource/training_resource_module/training_resource_data")

add_training_resource_data = Utility.read_json(
    "../../test_data/training_resource/training_resource_module/add_training_resource_data")

abandon_training_resource_data = Utility.read_json(
    "../../test_data/training_resource/training_resource_module/abandon_training_resource_data")

show_resume_resource_data = Utility.read_json(
    "../../test_data/training_resource/training_resource_module/show_resume_training_resource_data")

tracking_resource_data = Utility.read_json(
    "../../test_data/training_resource/training_resource_module/tracking_resource_data")

Modify_resource_data = Utility.read_json(
    "../../test_data/training_resource/training_resource_module/Modify_resource_data")
Beispiel #14
0
 def setUp(self):
     self.session = requests.session()
     self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
Beispiel #15
0
import requests
from parameterized import parameterized
from interface.common.login.Login import Login
import unittest
from interface.util.Utility import Utility



 # 打开首页
open_page_data = Utility.read_json("../../test_data/login_data/open_page_data")

# 登陆数据
login_data = Utility.read_json("../../test_data/login_data/login_data")

# 解密数据
decode_data = Utility.read_json("../../test_data/login_data/decode_data")


class LoginTest(unittest.TestCase):
    # 初始化
    def setUp(self):
        self.session = requests.session()
        self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]

    # 测试首页
    @parameterized.expand(open_page_data)
    def test_open_page(self, open_page_url, expect):

        open_page_url = self.base_url + open_page_url["open_page_url"]
        open_page_resp = Login.open_page(self.session,open_page_url)
import requests
import unittest
from parameterized import parameterized
from interface.util.Service import Service
from interface.util.Utility import Utility


# 数据
basic_info_modify_data = Utility.read_json(
    "../../test_data/trainees_management_data/trainees_management_module/basic_info_modify_data")


class TraineesManagementTest(unittest.TestCase):

    # 自定义,初始化driver,窗口最大化,隐式等待
    def setUp(self):
        self.session = requests.session()
        self.base_url = self.base_url = Utility.read_json("../../config/data_base")["BASEURL"]
        # 登陆(咨询主管:李毅)、解密
        teacher_login_path = "../../test_data/login_data/teacher_manage_login_data"
        decode_path = "../../test_data/login_data/decode_data"
        Service.get_login_decode(self.base_url, self.session, teacher_login_path, decode_path)

    # 修改
    @parameterized.expand(basic_info_modify_data)
    def test_basic_info_modify(self, url, expect):
        basic_info_modify_url = self.base_url + url["basic_info_modify_url"]
        print(basic_info_modify_url)
        files = {'fileToUpload':
                     ('basic_info_modify_info.txt', open('C:/Users/wang/Desktop/woniuboss_automation/interface/test_data/trainees_management_data/trainees_management_module/basic_info_modify_info.txt', 'rb'))}
        basic_resp = requests.post(basic_info_modify_url, files=files)