Exemple #1
0
 def test_recent_product_api(self):
     """最近新品"""
     res = ApiFactory.get_home_api().recent_product_api()
     # 断言状态码
     assert res.status_code == 200
     # 断言新品数量大于0
     assert len(res.json()) > 0
     # 断言关键字段
     assert "id" in res.text and "name" in res.text and "price" in res.text
Exemple #2
0
 def test_theme_api(self):
     # 专题栏
     # 请求返回对象
     res = ApiFactory.get_home_api().theme_api()
     # 断言 -状态码
     assert res.status_code == 200
     # 断言 -三个id 1 2 3
     assert 'id":1' in res.text and 'id":2' in res.text and 'id":3'in res.text
     # 断言关键字段 name description topic_img head_img
     assert False not in [i in res.text for i in ["name", "description", "topic_img","head_img"]]
Exemple #3
0
 def test_recent_product_api(self):
     """最近新品"""
     # 请求返回数据
     res = ApiFactory.get_home_api().recent_product_api()
     # 断言状态码
     utils.common_assert_code(res)
     # 断言商品数量大于0
     assert len(res.json()) > 0
     # 断言关键字段
     assert "id" in res.text and "name" in res.text and "price" in res.text
Exemple #4
0
    def test_recent_product(self):
        res = ApiFactory.get_home_api().recent_product_api()
        logging.info("请求地址:{}".format(res.url))
        logging.info("响应数据:{}".format(res.json()))
        # 断言响应状态码
        utils.common_assert_code(res)

        # 断言返回结果大于0
        assert len(res.json()) > 0
        # 断言id,name,price在返回结果中
        assert "id" in res.text and "name" in res.text and "price" in res.text
Exemple #5
0
 def test_recent_product_api(self):
     # 返回请求对象
     res = ApiFactory.get_home_api().recent_product_api()
     # 打印 请求地址 打印请求参数 打印请求响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info(f"响应数据:{res.json()}")
     # 断言状态码
     assert res.status_code == 200
     # 断言新品数量长度大于0
     assert len(res.json()) > 0
     # 断言关键字段
     assert "id" in res.text and 'name' in res.text and 'price' in res.text
Exemple #6
0
 def test_home_api(self):
     """轮播图"""
     res = ApiFactory.get_home_api().banner_api()
     # 打印请求地址 请求参数 请求响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言状态码
     utils.common_assert_code(res)
     # 断言id和name
     assert res.json().get("id") == 1 and res.json().get("name") == "首页置顶"
     # 断言items列表长度大于0
     assert len(res.json().get("items")) > 0
Exemple #7
0
 def test_recent_product_api(self):
     """最新新品"""
     # 请求返回对象
     res = ApiFactory.get_home_api().recent_product_api()
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言 -状态码
     assert res.status_code == 200
     # 断言 -新品数量大于0
     assert len(res.json()) > 0
     # 断言 -关键字段
     assert "id" in res.text and "name" in res.text and "price" in res.text
Exemple #8
0
 def test_home_api(self):
     """轮播图"""
     res = ApiFactory.get_home_api().banner_api()
     # 打印 请求地址 答应请求参数
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言状态码
     assert res.status_code == 200
     # 断言id和name
     assert res.json().get("id") == 1 and res.json().get("name") == "首页置顶"
     # 断言items列表长度大于0
     assert len(res.json().get("items")) > 0
Exemple #9
0
    def test_home_api(self):
        res = ApiFactory.get_home_api().banner_api()
        # 打印请求地址 打印请求参数 打印请求响应数据
        logging.info("请求地址:{}".format(res.url))
        logging.info("响应数据:{}".format(res.json()))
        # 断言响应状态码
        utils.common_assert_code(res)

        # 断言id=1 name=首页置顶
        assert res.json().get("id") == 1 and res.json().get("name") == "首页置顶"
        # 断言返回结果大于0
        assert len(res.json().get("items")) > 0
Exemple #10
0
 def test_recent_product_api(self):
     """最近新品"""
     res = ApiFactory.get_home_api().recent_product_api()
     # 打印 请求地址 请求参数 请求响应数据
     logging.info(f"请求地址:{res.url}")
     logging.info(f"请求响应数据:{res.json()}")
     # 断言状态码
     utils.common_assert_code(res)
     # 断言新品数量
     assert len(res.json()) > 0
     # 断言关键字段
     assert 'id' in res.text and 'name' in res.text and 'price' in res.text
Exemple #11
0
 def test_recent_product_api(self):
     """最近新品"""
     res = ApiFactory.get_home_api().recent_product_api()
     # 打印请求地址 请求参数 请求响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言状态码
     utils.common_assert_code(res)
     # 断言新品数量大于0
     assert len(res.json()) > 0
     # 断言关键字段
     assert "id" in res.text and "name" in res.text and "price" in res.text
Exemple #12
0
 def test_recent_api(self):
     """最近新品"""
     # 请求数据
     respond = ApiFactory.get_home_api().recent_product_api()
     logging.info('请求地址:{}'.format(respond.url))
     logging.info('响应数据:{}'.format(respond.json()))
     # 断言状态码
     utils.common_assert_code(respond)
     # 断言关键字段 id name main_img_url
     assert 'id' in respond.text and 'name' in respond.text and 'main_img_url' in respond.text
     # 断言长度
     assert len(respond.json()) > 0
Exemple #13
0
 def test_product_recent_api(self):
     """最近新品"""
     res = ApiFactory.get_home_api().product_recent_api()
     # 打印请求地址,打印请求参数 打印响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言状态码
     utils.common_assert_code(res, 200)
     # 断言新品数量大于0
     assert len(res.json()) > 0
     # 断言关键字段
     assert False not in [i in res.text for i in ['id', 'name', 'price']]
Exemple #14
0
 def test_theme_api(self):
     """专题栏"""
     # 请求返回对象
     res = ApiFactory.get_home_api().theme_api()
     # 打印 请求地址 打印请求参数 打印请求响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info(f"响应数据:{res.json()}")
     # 断言状态码
     assert res.status_code == 200
     # 断言 三个id = 1,2,3
     assert '"id":1' in res.text and '"id":2' in res.text and '"id":3' in res.text
     # 断言关键字段 name description topic_img head_img
     assert False not in [i in res.text for i in ["name", "description", "topic_img", "head_img"]]
Exemple #15
0
 def test_home_api(self):
     """轮播图"""
     # 请求返回数据
     respond = ApiFactory.get_home_api().banner_api()
     logging.info('请求地址:{}'.format(respond.url))
     logging.info('响应数据:{}'.format(respond.json()))
     # 断言状态码
     utils.common_assert_code(respond)
     # 断言id和name
     assert respond.json().get('id') == 1 and respond.json().get(
         'name') == '首页置顶'
     # 断言长度
     assert len(respond.json().get('items')) > 0
Exemple #16
0
    def test_theme_api(self):
        # 请求返回数据
        res = ApiFactory.get_home_api().theme_api()
        # 打印请求地址 请求参数 请求响应数据
        logging.info('请求地址:{}'.format(res.url))
        logging.info('响应数据:{}'.format(res.json()))
        # 断言状态码
        utils.common_assert_code(res)

        # 断言3个id=1 2 3
        assert '"id":1' in res.text and '"id":2' in res.text and '"id":3' in res.text
        # 断言关键字段 name description topic_img head_img
        assert False not in [i in res.text for i in ['name', 'description', 'topic_img', 'head_img']]
Exemple #17
0
    def test_home_api(self):
        # 请求返回数据
        res = ApiFactory.get_home_api().banner_api()
        # 打印请求地址 请求参数 请求响应数据
        logging.info('请求地址:{}'.format(res.url))
        logging.info('响应数据:{}'.format(res.json()))
        # 断言状态码
        utils.common_assert_code(res)

        # 断言id和name
        assert res.json().get('id') == 1 and res.json().get('name') == '首页置顶'
        # 断言items列表长度大于0
        assert len(res.json().get('items')) > 0
Exemple #18
0
    def test_recent_product_api(self):
        # 请求返回对象
        res = ApiFactory.get_home_api().recent_product_api()
        # 打印请求地址 请求参数 请求响应数据
        logging.info('请求地址:{}'.format(res.url))
        logging.info('响应数据:{}'.format(res.json()))
        # 断言状态码
        utils.common_assert_code(res)

        # 断言新品数量大于0
        assert len(res.json()) > 0
        # 断言关键字段
        assert 'id' in res.text and 'name' in res.text and 'price' in res.text
Exemple #19
0
 def test_theme_api(self):
     """专题栏"""
     # 请求返回对象
     res = ApiFactory.get_home_api().theme_api()
     # 打印 请求地址 打印请求参数 打印请求响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言 -状态码
     utils.common_assert_code(res)
     # 断言 -三个id=1 2 3
     assert 'id":1' in res.text and 'id":2' in res.text and 'id":3' in res.text
     # 断言关键字段 name description topic_img head_img
     assert False not in [i in res.text for i in ["name", "description", "topic_img", "head_img"]]
Exemple #20
0
 def test_home_api(self):
     """轮播图"""
     # 请求返回数据
     res = ApiFactory.get_home_api().banner_api()
     # 打印 请求地址 请求参数 请求响应数据
     logging.info(f"请求地址:{res.url}")
     logging.info(f"请求响应数据:{res.json()}")
     # 断言状态码
     utils.common_assert_code(res)
     # 断言id和name
     assert res.json().get("id") == 1 and res.json().get("name") == '首页置顶'
     # 断言items列表长度大于0
     assert len(res.json().get("items")) > 0
Exemple #21
0
 def test_home_api(self):
     """轮播图"""
     # 请求返回数据
     res = ApiFactory.get_home_api().banner_api()
     # 打印请求地址 打印请求参数 打印请求响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言状态码
     utils.common_assert_code(res)
     # 断言关键字段
     assert res.json().get("id") == 1 and res.json().get("name") == "首页置顶"
     # 断言轮播图数量
     assert len(res.json().get("items")) > 0
Exemple #22
0
 def test_theme_api(self):
     """专题栏"""
     # 请求返回数据
     res = ApiFactory.get_home_api().theme_api()
     # 断言状态码
     utils.common_assert_code(res)
     # 断言 三个id=1 2 3
     assert 'id":1' in res.text and 'id":2' in res.text and 'id":3' in res.text
     # 断言关键字段 name description topic_img head_img
     assert False not in [
         i in res.text
         for i in ["name", "description", "topic_img", "head_img"]
     ]
Exemple #23
0
 def test_banner_api(self):
     """轮播图"""
     # 请求返回数据
     res = ApiFactory.get_home_api().banner_api()
     # 打印请求地址,打印请求参数 打印响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言状态码
     utils.common_assert_code(res, 200)
     # 断言id和name
     assert res.json().get('id') == 1 and res.json().get('name') == '首页置顶'
     # 断言items列表长度大于0
     assert len(res.json().get('items')) > 0
Exemple #24
0
 def test_theme_api(self):
     """专题栏"""
     # 返回请求数据
     res = ApiFactory.get_home_api().theme_api()
     # 打印 请求参数、请求地址、请求响应数据
     logging.info('请求地址:{}'.format(res.url))
     logging.info('请求响应:{}'.format(res.json()))
     # 断言响应状态码
     utils.common_assert(res)
     # 断言 id存在
     assert 'id":1' in res.text and 'id":2' in res.text and 'id":3' in res.text
     # 断言存在 name,description,topic_img,head_img
     ls = ['name', 'description', 'topic_img', 'head_img']
     assert False not in [i in res.text for i in ls]
Exemple #25
0
 def test_recent_product_api(self):
     """最近新品"""
     # 返回请求数据
     res = ApiFactory.get_home_api().recent_product_api()
     # 打印 请求参数、请求地址、请求响应数据
     logging.info('请求地址:{}'.format(res.url))
     logging.info('请求响应:{}'.format(res.json()))
     # 断言响应状态码
     assert res.status_code == 200
     utils.common_assert(res)
     # 断言新品数量大于0
     assert len(res.json()) > 0
     # 断言关键字段
     assert 'id' in res.text and 'name' in res.text and 'price' in res.text
Exemple #26
0
 def test_recent_api(self):
     """最近新品"""
     # 请求返回数据
     res = ApiFactory.get_home_api().recent_product_api()
     # 打印请求地址  打印请求参数 打印请求响应数据
     logging.info("请求地址:{}".format(res.url))
     logging.info("响应数据:{}".format(res.json()))
     # 断言状态码
     assert res.status_code == 200
     # 断言新品数量大于0
     assert len(res.json())
     # 断言关键字段
     assert False not in [
         i in res.text for i in ["id", "name", "price", "stock"]
     ]
Exemple #27
0
    def test_theme_api(self):
        res = ApiFactory.get_home_api().theme_api()
        # 打印请求地址 打印请求参数 打印请求响应数据
        logging.info("请求地址:{}".format(res.url))
        logging.info("响应数据:{}".format(res.json()))
        # 断言响应状态码
        utils.common_assert_code(res)

        # 断言id=1,2,3
        assert 'id":1' in res.text and 'id":2' in res.text and 'id":3' in res.text
        # 断言返回结果中包含name,description,topic_img,head_img
        assert False not in [
            i in res.text
            for i in ["name", "description", "topic_img", "head_img"]
        ]
Exemple #28
0
 def test_theme_api(self):
     """专题栏"""
     res = ApiFactory.get_home_api().theme_api()
     # 打印 请求地址 请求参数 请求响应数据
     logging.info(f"请求地址:{res.url}")
     logging.info(f"请求响应数据:{res.json()}")
     # 断言状态码
     utils.common_assert_code(res)
     # 断言3个id
     assert 'id":1' in res.text and 'id":2' in res.text and 'id":3' in res.text
     # 断言关键字段
     assert False not in [
         i in res.text
         for i in ["name", "description", "topic_img", "head_img"]
     ]
Exemple #29
0
 def test_theme_api(self):
     """专题栏"""
     # 请求数据
     respond = ApiFactory.get_home_api().theme_api()
     logging.info('请求地址:{}'.format(respond.url))
     logging.info('响应数据:{}'.format(respond.json()))
     # 断言状态码
     utils.common_assert_code(respond)
     # 断言三个 id = 1, 2, 3
     assert 'id":1' in respond.text and 'id":2' in respond.text and 'id":3' in respond.text
     # 断言关键字段 name description head_img topic_img
     assert False not in [
         i in respond.text
         for i in ['name', 'description', 'head_img', 'topic_img']
     ]
Exemple #30
0
    def test_recent_product_api(self):
        """最近新品"""
        # 请求返回数据
        res = ApiFactory.get_home_api().recent_product_api()
        # 打印请求地址,请求参数,请求响应数据
        logging.info(f"请求地址:{res.url}")
        logging.info(f"请求地址:{res.json()}")

        # 断言状态码
        utils.common_assert_code(res)
        # 断言3个id
        assert '"id":1' in res.text and '"id":2' in res.text and '"id":3' in res.text
        # 断言新品数量大于0
        assert len(res.json()) > 0
        # 断言关键字段name,description,topic_img,head_img
        assert "id" in res.text and "name" in res.text and "price" in res.text