class TestMis:
    # 1.初始化
    def setup_class(self):
        # 获取ApiMis对象
        self.mis = ApiMis()

    # 2.登录接口测试方法
    @pytest.mark.parametrize("account,password", read_json("data/mis_login.json"))
    def test_mis_login(self, account, password):
        # 获取登录响应对象
        r = self.mis.api_mis_login(account, password)
        print("后台管理系统登录成功后,请求headers:{}".format(api.headers))
        # 提取token值
        Tool.common_token(r)
        Tool.common_assert(r)

    # 3.查询文章接口测试方法
    def test_mis_search(self):
        # 获取文章查询接口响应对象
        r = self.mis.api_mis_search()
        Tool.common_assert(r, status_code=200)

    # 4.审核文章接口测试方法
    def test_mis_audit(self):
        # 获取审核文章接口响应对象
        r = self.mis.api_mis_audit()
        Tool.common_assert(r)
Esempio n. 2
0
class TestMis:
    def setup_class(self):
        self.mis = ApiMis()

    @pytest.mark.parametrize("account, pwd", read_yaml("mis_login.yaml"))
    def test01_mis_login(self, account, pwd):
        r = self.mis.mis_login(account, pwd)
        Tools.common_token(r)
        try:
            Tools.common_assert(r)
        except Exception as e:
            log.error(e)
            raise

    def test02_mis_search_article(self):
        r = self.mis.mis_search_article()
        try:
            Tools.common_assert(r, statues_code=200)
        except Exception as e:
            log.error(e)
            raise

    def test03_mis_audit_article(self):
        r = self.mis.mis_article_audit()
        #print(r.json())
        try:
            Tools.common_assert(r)
        except Exception as e:
            log.error(e)
            raise
 def setup_class(self):
     """
     初始化
     :return:
     """
     # 获取ApiMis对象
     self.mis = ApiMis()
Esempio n. 4
0
class TestMis(object):
    # 1. 初始化
    def setup_class(self):
        # 获取ApiMis对象
        self.mis = ApiMis()

    # 2. 登录
    @pytest.mark.parametrize("account,password", read_yaml("mis_login.yaml"))
    def test01_mis_login(self, account, password):
        # 1. 调用登录接口
        r = self.mis.api_mis_login(account, password)
        try:
            # 2. 提取token
            Tool.common_token(r)
            print("后台管理系统登录后,请求headers为:", api.headers)
            # 3. 断言
            Tool.common_assert(r)
        except Exception as e:
            # 日志
            log.error(e)
            # 抛异常
            raise

    # 3. 查询文章
    def test02_mis_search(self):
        # 1. 调用查询文章接口
        r = self.mis.api_mis_search()
        print("查询文章成功后:", r.json())
        try:
            # 2. 断言
            Tool.common_assert(r, status_code=200)
        except Exception as e:
            # 日志
            log.error(e)
            # 抛异常
            raise

    # 4. 审核文章
    def test03_mis_audit(self):
        # 1. 调用审核文章接口
        r = self.mis.api_mis_audit()
        try:
            # 2. 断言
            Tool.common_assert(r)
        except Exception as e:
            # 日志
            log.error(e)
            # 抛异常
            raise
Esempio n. 5
0
class TestMis:
    # 1. 初始化
    def setup_class(self):
        # 获取ApiMis对象
        self.mis = ApiMis()

    # 2. 登录接口测试方法
    def test01_mis_login(self, account="testid", password="******"):
        # 1. 调用登录接口
        r = self.mis.api_mis_login(account, password)
        try:
            # 2. 提取token
            Tool.common_token(r)
            # 3. 断言
            Tool.common_assert(r)
        except Exception as e:
            # 日志
            log.error(e)
            # 抛异常
            raise

    # 3. 查询 接口测试方法
    def test02_mis_find(self):
        # 1. 调用查询接口
        r = self.mis.api_mis_find()
        try:
            # 2. 断言 200:为int 不能加引号
            Tool.common_assert(r, status_code=200)
        except Exception as e:
            # 日志
            log.error(e)
            # 抛异常
            raise

    # 4. 审核 接口测试方法
    def test03_mis_audit(self):
        # 1. 调用审核接口
        r = self.mis.api_mis_audit()
        try:
            # 2. 断言
            Tool.common_assert(r)
        except Exception as e:
            # 日志
            log.error(e)
            # 抛异常
            raise
class TestMis:
    def setup_class(self):
        """
        初始化
        :return:
        """
        # 获取ApiMis对象
        self.mis = ApiMis()

    @pytest.mark.parametrize("account, pwd", read_txt("mis_login.txt"))
    def test01_mis_login(self, account, pwd):
        """
        管理员 登录测试方法
        :param account: 管理员账号
        :param pwd: 密码
        :return:
        """
        # 调用登录接口方法
        rep = self.mis.api_mis_login(account, pwd)
        # 提取token
        ToolsInter.get_token(rep)
        # 断言
        print(rep.json())
        ToolsInter.assert_common(rep)

    def test02_mis_search(self):
        """
        查询文章测试用例
        :return:
        """
        # 调用查询接口方法
        rep = self.mis.api_mis_search()
        # 断言

        ToolsInter.assert_common(rep, code=200)

    def test03_mis_audit(self):
        """
        审核文章测试用例
        :return:
        """
        # 调用审核接口 方法
        rep = self.mis.api_mis_audit()
        # 断言
        ToolsInter.assert_common(rep)
Esempio n. 7
0
class TestMis:
    # 1. 初始化
    def setup_class(self):
        # 获取ApiMis对象
        self.mis = ApiMis()
        log.info("正在获取ApiMis对象:{}".format(self.mis))

    # 2. 登录 接口测试方法
    def test01_mis_login(self, user=api.mis_user, pwd=api.mis_pwd):
        # 调用登录接口
        r = self.mis.api_mis_login(user, pwd)
        try:
            # 提取token
            Tool.common_token(r)
            # 断言
            Tool.common_assert(r)
        except Exception as e:
            log.error(e)
            raise

    # 3. 查询 接口测试方法
    def test02_mis_find(self):
        # 调用查询接口
        r = self.mis.api_mis_find()
        try:
            # 断言
            Tool.common_assert(r, status_code=200)
        except Exception as e:
            log.error(e)
            raise

    # 4. 审核 接口测试方法
    def test03_mis_audit(self):
        # 调用登录接口
        r = self.mis.api_mis_audit()
        try:
            # 断言
            Tool.common_assert(r)
        except Exception as e:
            log.error()
            raise
Esempio n. 8
0
class TestMis:
    # 初始化
    def setup_class(self):
        # 后去ApiMis对象
        self.mis = ApiMis()
        # 获取Tool对象
        self.tool = Tool()

    # 登录
    @pytest.mark.parametrize("account,password", read_yaml("mis_login.yaml"))
    def test01_mis_login(self, account, password):
        # 调用登录业务方法
        response = self.mis.api_mis_login(account, password)
        print("后台登录数据:", response.json())
        # 断言
        self.tool.assert_code_message(response)
        # 提取 token
        self.tool.get_token(response)
        print("提取的token值为:", api.headers)
        print("--" * 50)

    # 查询
    def test02_mis_search(self):
        # 调用查询业务方法
        response = self.mis.api_search_article()
        print("--" * 50)
        print("查询结果为:", response.json())
        # 断言
        self.tool.assert_code_message(response, code=200)

    # 审核
    def test03_mis_audit(self):
        # 调用审核业务方法
        response = self.mis.api_audit()
        print("--" * 50)
        print("审核结果为:", response.json())
        # 断言
        self.tool.assert_code_message(response)
 def setup_class(self):
     # 获取ApiMis对象
     self.mis = ApiMis()
Esempio n. 10
0
 def setup_class(self):
     self.mis = ApiMis()
Esempio n. 11
0
 def setup_class(self):
     # 后去ApiMis对象
     self.mis = ApiMis()
     # 获取Tool对象
     self.tool = Tool()
Esempio n. 12
0
 def setup_class(self):
     # 获取ApiMis对象
     self.mis = ApiMis()
     log.info("正在获取ApiMis对象:{}".format(self.mis))