Exemple #1
0
 def test_update_addr(self):
     """测试修改收货地址"""
     login = LoginInterface()
     login_data = {"name": "a123", "password": "******"}
     session = login.get_session(login_data)
     add_list = AddrListInter()
     addr_id = {"session": session}
     id = add_list.get_addr_id(addr_id)
     update = Updateaddr()
     update_data = {
         "address": {
             "default_address": 0,
             "consignee": "陈良",
             "tel": "151",
             "zipcode": "610000",
             "country": "1",
             "city": "271",
             "id": 0,
             "email": "*****@*****.**",
             "address": "广西壮族自治区淮安县大兴王街z座 892317",
             "province": "24",
             "district": "2714",
             "mobile": ""
         },
         "address_id": id,
         "session": session
     }
     print(update.update_addr(update_data))
     """断言"""
     expect = {'succeed': 1}
     status = update.get_status(update_data)
     actual = status
     self.assertEqual(expect, actual)
Exemple #2
0
 def test_add_addr(self):
     """测试添加收货地址"""
     login = LoginInterface()
     login_data = {"name": "a123", "password": "******"}
     session = login.get_session(login_data)
     add = Add_Addr()
     add_data = {
         "address": {
             "default_address": 0,
             "consignee": "土豆粉",
             "tel": "1888065189",
             "zipcode": "610000",
             "country": "1",
             "city": "271",
             "id": 0,
             "email": "*****@*****.**",
             "address": "天府新谷",
             "province": "24",
             "district": "2716",
             "mobile": ""
         },
         "session": session
     }
     # print(add.add_addr(add_data))
     """断言"""
     expect = {'succeed': 1}
     # status_1 = {"session": session}
     status = add.get_status(add_data)
     actual = status
     self.assertEqual(expect, actual)
     # 断言收货人姓名
     addr = AddrListInter()
     name1 = "土豆粉"
     name2 = addr.get_addr_name(add_data)
     self.assertEqual(name1, name2)
Exemple #3
0
 def test_select_addr(self):
     """测试查看收货地址"""
     login = LoginInterface()
     login_data = {"name": "a123", "password": "******"}
     session = login.get_session(login_data)
     select = AddrListInter()
     data = {"session": session}
     print(select.addr_list(data))
     """断言"""
     expect = {'succeed': 1}
     status = select.get_status(data)
     actual = status
     self.assertEqual(expect, actual)
Exemple #4
0
 def test_delete_addr(self):
     """测试删除收货地址"""
     login = LoginInterface()
     login_data = {"name": "a123", "password": "******"}
     data = login.get_session(login_data)
     delete = Delete_Addr()
     add_list = AddrListInter()
     addr_id = {"session": data}
     id = add_list.get_addr_id(addr_id)
     delete_data = {"address_id": id, "session": data}
     print(delete.delete_addr(delete_data))
     """断言"""
     expect = {'succeed': 1}
     status = delete.get_status(delete_data)
     actual = status
     self.assertEqual(expect, actual)
    def __init__(self, agenda_manager):
        LoginInterface.__init__(self)

        local_save = open(LOCAL_SAVE)
        self.variable = json.load(local_save)
        local_save.close()

        self.login = Login()
        self.login.connect(self.login.cmd_login, QtCore.SIGNAL("clicked()"),
                           self.do_login)

        self.user = dict()

        self.server_manager = ServerManager()

        self.agenda_manager = agenda_manager
Exemple #6
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)
 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)
 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)
Exemple #10
0
class Test_Collection(unittest.TestCase):
    def setUp(self):
        self.login = LoginInterface()  # 实例化登录
        self.collection = CollectionList()  # 实例化收藏

    def test_add_collection(self):
        '''测试添加收藏'''
        login_data = {"name": "yehong", "password": "******"}
        session = self.login.get_session(data=login_data)
        url = "?url=/user/collect/create"
        result = self.collection.add_collection(url=url, session=session)
        self.assertTrue(result, login_data)

    def test_show_list(self):
        '''测试查看收藏列表'''
        login_data = {"name": "yehong", "password": "******"}
        session = self.login.get_session(data=login_data)
        url = "?url=/user/collect/list"
        result = self.collection.collection_list(url=url, session=session)
        self.assertTrue(result, session)

    def test_collection_news(self):
        '''测试查看收藏商品详情'''
        login_data = {"name": "yehong", "password": "******"}
        session = self.login.get_session(data=login_data)
        url = "?url=/goods"
        result = self.collection.collection_news(url=url, session=session)
        self.assertTrue(result, session)

    def test_delete_collection(self):
        '''测试删除收藏'''
        login_data = {"name": "yehong", "password": "******"}
        session = self.login.get_session(data=login_data)
        url = "?url=/user/collect/delete"
        urll = "?url=/user/collect/list"
        rec_id = self.collection.get_rec_id(url=urll, session=session)
        result = self.collection.delect_collection(url=url,
                                                   session=session,
                                                   rec_id=rec_id)
        self.assertTrue(result, self.collection.get_rec_id)
 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)
Exemple #12
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)
Exemple #13
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)
Exemple #14
0
class TestShopping(unittest.TestCase):
    def setUp(self):
        """购物前先登录"""
        self.login = LoginInterface()
        login_data = {"name": "user11", "password": "******"}
        self.session = self.login.get_session(data=login_data)
        self.shoppingcart = ShoppingCart()

    def test_create_cart(self):
        """测试添加购物车"""
        url = "?url=/cart/create"
        create_data = {"spec": [], "session": self.session, "goods_id": 84, "number": 1}
        self.shoppingcart.create_cart(url=url, data=create_data)
        """断言"""
        succeed = self.shoppingcart.get_goods_succeed(url=url, data=create_data)
        self.assertEqual(succeed, 1)

    def test_get_cart(self):
        """测试查看购物车"""
        url = "?url=/cart/list"
        get_cart_data = {"session": self.session}
        self.shoppingcart.get_cart(url=url, data=get_cart_data)

        """断言"""
        self.shoppingcart.get_goods_goods_list(url=url,data=get_cart_data)



    def test_upcart(self):
        """测试更新购物车"""
        url = "?url=/cart/update"
        upcart_data = {"new_number": 3, "session": self.session, "rec_id": 21819}
        self.shoppingcart.upcart(url=url, data=upcart_data)


    def test_del_cart(self):
        """测试删除购物车"""
        url = "?url=/cart/delete"
        delcart_data = {"session": self.session, "rec_id": 11385}
        self.shoppingcart.delcart(url=url, data=delcart_data)
Exemple #15
0
 def setUp(self):
     self.login = LoginInterface()  # 实例化登录
     self.collection = CollectionList()  # 实例化收藏
Exemple #16
0
 def setUp(self):
     """购物前先登录"""
     self.login = LoginInterface()
     login_data = {"name": "user11", "password": "******"}
     self.session = self.login.get_session(data=login_data)
     self.shoppingcart = ShoppingCart()
Exemple #17
0
from common.sendmethod import SendMethod

from interface.login_interface import LoginInterface


class Upcart:
    def __init__(self):
        """初始化请求地址"""
        self.url = "http://ecshop.itsoso.cn/ECMobile/?url=/cart/update"

    def upcart(self, data):
        """更新购物车接口"""
        return SendMethod.sendmethod(url=self.url, data=data)


if __name__ == '__main__':
    login = LoginInterface()
    login_data = {"name": "user11", "password": "******"}
    session = login.get_session(login_data)
    upcart_data = {"new_number": 3, "session": session, "rec_id": 21140}  #更新购物车请求参数
    upcart = Upcart()
    print(upcart.upcart(upcart_data))
 def setUp(self):
     self.show = ShowGoodsList()  # 实例化商品详情
     self.login = LoginInterface()  # 实例化登录
 def test_show(self):
     login_data = {"name": "yehong", "password": "******"}
     session = LoginInterface().get_session(data=login_data)
     show = ShowGoodsList()
     result = show.goodsList("id")
     self.assertTrue(result, show.get_goodsList("id"))
Exemple #20
0
    # def get_id(self, url, session):
    #     '''获取商品id'''
    #     response = self.collection_news(url=url, session=session)
    #     id = get_keyword(response, keyword="id")
    #     return id

    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)


if __name__ == '__main__':
    login = LoginInterface()
    login_data = {"name": "yehong", "password": "******"}
    session = LoginInterface().get_session(data=login_data)
    collection = CollectionList()

    # 添加收藏
    url = "?url=/user/collect/create"
    result = collection.add_collection(url=url, session=session)
    print(result)

    # 查看商品列表
    url = "?url=/user/collect/list"
    result = collection.get_rec_id(url=url, session=session)
    print(result)

    # 查看收藏商品详情
Exemple #21
0
 def setUp(self):
     """登录"""
     self.login_data= {"name": "xiaohei666", "password": "******"}
     return LoginInterface().get_session(self.login_data)