Ejemplo n.º 1
0
 def personal_center(self, login_data):
     """
     个人中心接口
     :param login_data: a={"name": "user11", "password": "******"} 传入用户名跟密码
     :return:
     """
     session = LoginInterface().get_session(login_data)
     pci_data = {"session": session}
     return SendMethod.send_post(url=self.url, data=pci_data)
Ejemplo n.º 2
0
 def submitoder(self):
     """请求提交订单接口"""
     url = self.url + "?url=/flow/done"
     shipping_id = self.get_shipping_id()  # 获取shipping_id
     pay_id = self.get_pay_id()  # 获取pay_id
     submitoder_data = {
         "shipping_id": shipping_id,
         "session": self.session,
         "pay_id": pay_id
     }
     return SendMethod.send_post(url=url, data=submitoder_data)
Ejemplo n.º 3
0
 def historical_order_interface(self, user_data):
     session = LoginInterface().get_session(user_data)
     data = {
         "session": session,
         "type": "finished",
         "pagination": {
             "count": 10,
             "page": 1
         }
     }
     return SendMethod.send_post(url=self.url, data=data)
 def pending_payment_interface(self, user_data):
     """待付款接口"""
     session = LoginInterface().get_session(user_data)
     data = {
         "session": session,
         "type": "await_pay",
         "pagination": {
             "count": 10,
             "page": 1
         }
     }
     return SendMethod.send_post(url=self.url, data=data)
Ejemplo n.º 5
0
 def cancel_order_interface(self, user_data):
     """
     取消订单接口测试
     :param user_data: 传入用户名密码
     :return:
     """
     session = LoginInterface().get_session(user_data)   # 获取 session(uid,sid)
     goods_id = PendingPaymentInterface().get_order_id(user_data)
     data = {
         "session": session,
         "order_id": goods_id}
     return SendMethod.send_post(url=self.url,data=data)
Ejemplo n.º 6
0
 def collection_list(self, url, session):
     '''查看收藏列表'''
     url = self.url + url
     collection_list_data = {
         "session": session,
         "pagination": {
             "count": 10,
             "page": 1
         },
         "rec_id": 0
     }
     return SendMethod.send_post(url=url, data=collection_list_data)
Ejemplo n.º 7
0
 def addcart(self):
     """请求添加购物车接口"""
     url = self.url + "?url=/cart/create"
     add_cart_data = {
         "spec": [],
         "session": self.session,
         "goods_id": 73,
         "number": 1
     }
     return SendMethod.send_post(
         url=url,
         data=add_cart_data,
     )
Ejemplo n.º 8
0
 def payment_interface(self, user_data):
     """
     付款接口: 需要:付款的商品id
     这里固定选择第一个商品
     :param user_data: 传入登录数据
     :return: 返回付款接口返回值
     """
     # 实例化登录
     session = LoginInterface().get_session(
         user_data)  # 获得session(登录的uid,sid)
     order_id = PendingPaymentInterface().get_order_id(
         user_data)  # 获得单个商品id
     data = {"session": session, "order_id": order_id}
     return SendMethod.send_post(url=self.url, data=data)
Ejemplo n.º 9
0
 def wait_collect_goods(self,user_data):
     """
     待收货接口
     :param user_data: 登录数据(用户名密码,字典格式)
     :return:
     """
     session = LoginInterface().get_session(user_data)
     data = {
         "session": session,
         "type": "shipped",
         "pagination": {
             "count": 10,
             "page": 1}}
     return SendMethod.send_post(url=self.url,data=data)
Ejemplo n.º 10
0
 def to_be_shipped(self, user_data):
     """
     待发货接口测试
     :param user_data:传入登录数据(用户名密码)
     :return:
     """
     session = LoginInterface().get_session(user_data)
     data = {
         "session": session,
         "type": "await_ship",
         "pagination": {
             "count": 10,
             "page": 1
         }
     }
     return SendMethod.send_post(url=self.url, data=data)
Ejemplo n.º 11
0
 def to_be_received(self, data):
     return SendMethod.send_post(self.url, data)
Ejemplo n.º 12
0
 def unpaid_order(self, data):
     return SendMethod.send_post(url=self.url, data=data)
Ejemplo n.º 13
0
 def login(self):
     """请求登录接口"""
     return SendMethod.send_post(url=self.url,data=self.data)
Ejemplo n.º 14
0
 def delect_collection(self, url, rec_id, session):
     '''删除收藏'''
     url = self.url + url
     delect_collection_data = {"session": session, "rec_id": rec_id}
     return SendMethod.send_post(url=url, data=delect_collection_data)
Ejemplo n.º 15
0
 def update_addr(self, data):
     """更新收货地址"""
     return SendMethod.send_post(url=self.url, data=data)
Ejemplo n.º 16
0
 def cancel_order(self, data):
     return SendMethod.send_post(self.url, data=data)
Ejemplo n.º 17
0
 def register(self):
     """请求注册接口"""
     return SendMethod.send_post(url=self.url, data=self.register_data)
Ejemplo n.º 18
0
 def to_be_shipped(self, data):
     return SendMethod.send_post(self.url, data)
Ejemplo n.º 19
0
 def pay_order(self,data):
     return SendMethod.send_post(self.url,data)
Ejemplo n.º 20
0
 def show_cart_list(self):
     """请求查看购物车列表接口"""
     # self.addcart()
     url = self.url + "?url=/cart/list"
     cart_list_data = {"session": self.session}
     return SendMethod.send_post(url=url, data=cart_list_data)
Ejemplo n.º 21
0
 def check_order(self):
     """请求去结算接口"""
     url = self.url + "?url=/flow/checkOrder"
     check_data = {"session": self.session}
     return SendMethod.send_post(url=url, data=check_data)
Ejemplo n.º 22
0
 def delete_addr(self,data):
     """删除收货地址"""
     return SendMethod.send_post(url=self.url,data=data)
Ejemplo n.º 23
0
 def buy(self):
     """请求支付接口"""
     url = self.url + "?url=/order/pay"
     order_id = self.get_order_id()  # 获取order_id
     buy_data = {"session": self.session, "order_id": order_id}
     return SendMethod.send_post(url=url, data=buy_data)
Ejemplo n.º 24
0
2.获取session方法

"""
from common.sendmethod import SendMethod
from common.getkeyword import get_keyword


class LoginInterface:
    def __init__(self):
        self.url = "http://ecshop.itsoso.cn/ECMobile/?url=/user/signin"

    def login(self, data):
        """请求登录接口"""
        return SendMethod.send_post(url=self.url, data=data)

    def get_session(self, data):
        """获取登录后的session"""
        response = self.login(data=data)
        return get_keyword(response, "session")


if __name__ == '__main__':
    login = LoginInterface()
    login_data = {"name": "yehong", "password": "******"}
    # print(login.login(data))
    session = login.get_session(data=login_data)
    url = "http://ecshop.itsoso.cn/ECMobile/?url=/user/info"  # 个人中心请求地址
    userinfo_data = {"session": session}  # 个人中心请求参数
    print(SendMethod.send_post(url, userinfo_data))

Ejemplo n.º 25
0
 def login(self,data):
     """请求登录接口"""
     return SendMethod.send_post(self.url,data)
Ejemplo n.º 26
0
 def add_addr(self, data):
     """添加收货地址"""
     return SendMethod.send_post(url=self.url, data=data)
Ejemplo n.º 27
0
 def collection_news(self, url, session):
     '''收藏商品详情'''
     url = self.url + url
     collection_news_data = {"goods_id": 1087, "session": session}
     return SendMethod.send_post(url=url, data=collection_news_data)
Ejemplo n.º 28
0
 def goodsList(self, session):
     '''查看商品列表'''
     showgoods_data = {"goods_id": 1072, "session": session}  # 商品详情请求参数
     return SendMethod.send_post(url=self.url, data=showgoods_data)
Ejemplo n.º 29
0
 def add_collection(self, url, session):
     '''添加收藏'''
     url = self.url + url
     add_collection_data = {"session": session, "goods_id": 1087}
     return SendMethod.send_post(url=url, data=add_collection_data)
Ejemplo n.º 30
0
 def addr_list(self, data):
     """请求查看收货地址列表"""
     return SendMethod.send_post(url=self.url, data=data)