Ejemplo n.º 1
0
    def test_api_login(self):
        data = self.dal.datas[0]
        res = dbshop_login(**data)

        # then
        self.assertEqual("success", res["status"], "登录失败")

        # out
        global token
        token = res["result"]["user_token"]
    def test_api_statistics(self, user_name, user_password, user_unionid):

        res = dbshop_login(user_name, user_password, user_unionid)

        # out
        global token
        token = res["result"]["user_token"]
        #
        url, data, method = TestApiStatistics.urls[1], TestApiStatistics.datas[
            1], TestApiStatistics.methods[1]

        data.update({"user_token": token})
        # when
        res = ConfigHttp(url=url, data=data, method=method).request().json()

        self.assertEqual(6, res["result"][0]["favorites_num"], " 失败")
Ejemplo n.º 3
0
    def test_api_orderlist(self):
        user_name, user_password, user_unionid = TestApiLogin.datas[0][
            "user_name"], TestApiLogin.datas[0][
                "user_password"], TestApiLogin.datas[0]["user_unionid"]

        login_res = dbshop_login(user_name, user_password, user_unionid)

        token = login_res["result"]["user_token"]

        url, data, method, expected = TestApiOrderlist.urls[
            0], TestApiOrderlist.datas[0], TestApiOrderlist.methods[
                0], TestApiOrderlist.expecteds[0]

        data.update({"user_token": token})

        res = ConfigHttp(url=url, params=data, method=method).request().json()

        self.mylog.debug("---test_api_orderlist----,响应结果为{}".format(res))

        self.assertEqual(res['status'], expected)
Ejemplo n.º 4
0
    def test_apijob_addgoodsask(self, user_name, user_password, user_unionid,
                                goods_ask_content, goods_id):

        login_res = dbshop_login(user_name, user_password, user_unionid)

        token = login_res["result"]["user_token"]

        url, data, method, expected = TestApijobAddgoodsask.urls[0], TestApijobAddgoodsask.datas[0], \
                                      TestApijobAddgoodsask.methods[0], TestApijobAddgoodsask.expecteds[0]

        data.update({
            "user_token": token,
            "goods_id": goods_id,
            "goods_ask_content": goods_ask_content
        })

        res = ConfigHttp(url=url, data=data, method=method).request()

        self.mylog.debug("----test_apijob_addgoodsask----,相应结果为{}".format(res))

        self.assertEqual(["添加商品咨询成功!"], expected)
Ejemplo n.º 5
0
    def test_api_sumbitordergoods(self):

        data = self.dal.datas[0]
        login_res = dbshop_login(**data)

        #global token

        token= login_res["result"]["user_token"]

        url,data,method,expected = self.dal.urls[1],self.dal.datas[1],self.dal.methods[1],self.dal.expecteds[1]

        data.update (
            {
            "user_token": token
        })

        res = ConfigHttp(url=url,data=data,method=method).request().json()

        self.mylog.debug("----提交评价信息------".format(res))

        self.assertEqual("商品评价添加完成!",expected)
Ejemplo n.º 6
0
# -*- codeing = utf-8

from apitest.api.debugtalk import dbshop_login

login_res = dbshop_login("test1", "123456", 1)

print(login_res)

token = login_res["result"]["user_token"]
print(token)