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)
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)
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 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)
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)
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)
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, )
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)
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)
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)
def search_shop(method, url, data): return SendMethod.send_method(method, url, data)
def check_order(method, url, data): return SendMethod.send_method(method, url, data)
def shop_car_list(method, url, data): return SendMethod.send_method(method, url, data)
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)
def cancel_order(self, data): return SendMethod.send_post(self.url, data=data)
def delcart(self, url, data): """移除购物车""" url = self.url + url return SendMethod.sendmethod(url=url, data=data)
def history_order(self, data): return SendMethod().send_post(self.url, data)
def click_submit(method, url, data): """点击提交""" return SendMethod.send_method(method=method, url=url, data=data)
def login(self,data): """请求登录接口""" return SendMethod.send_post(self.url,data)
def wait_pay_list(method, url, data): """查看待付款订单""" return SendMethod.send_method(method=method, url=url, data=data)
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)
def pay(method, url, data): """付款""" return SendMethod.send_method(method=method, url=url, data=data)
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)
def del_order(method, url, data): """取消订单""" return SendMethod.send_method(method=method, url=url, data=data)
def del_shop_car(method, url, data): return SendMethod.send_method(method, url, data)
def create_cart(self, url, data): """添加购物车接口""" url = self.url + url return SendMethod.sendmethod(url=url, data=data)
def clikc_submit(method, url, data): return SendMethod.send_method(method, url, data)
def get_cart(self, url, data): """查看购物车""" url = self.url + url return SendMethod.sendmethod(url=url, data=data)
def click_shop(method, url, data): return SendMethod.send_method(method, url, data)
def upcart(self, url, data): """更新购物车接口""" url = self.url + url return SendMethod.sendmethod(url=url, data=data)