Esempio n. 1
0
 def testListUserFav(self):
     data = {
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin),
         'page': 1
     }
     values = Toolkit.get_response_from_server(IAddress.ListUserFav, data)
     self.assertEqual(4, len(values))
     self.assertEqual(1, values['status'])
     self.assertTrue(values['itemNum'] >= 0 and values['pageNum'] >= 0)
     if len(values['list']) > 0:
         self.assertEqual(18, len(values['list'][0]))
         self.assertTrue(values['list'][0]['beginPrice'] > 0
                         and values['list'][0]['beginTime'] > 0
                         and values['list'][0]['bidNum'] > 0
                         and values['list'][0]['currTime'] > 0
                         and values['list'][0]['endTime'] > 0
                         and values['list'][0]['favId'] > 0
                         and values['list'][0]['id'] > 0
                         and values['list'][0]['maxPrice'] > 0
                         and values['list'][0]['minAddPrice'] >= 0
                         and values['list'][0]['name'] != ''
                         and values['list'][0]['nickname'] != ''
                         and values['list'][0]['remark'] is not None
                         and values['list'][0]['smallImg'] != ''
                         and values['list'][0]['status'] > 0
                         and values['list'][0]['userId'] != ''
                         and values['list'][0]['viewedNum'] >= 0)
         self.assertEqual(2, len(values['list'][0]['buyer']))
         self.assertTrue(values['list'][0]['buyer']['id'] > 0
                         and values['list'][0]['buyer']['nickname'] != '')
         self.assertEqual(2, len(values['list'][0]['seller']))
         self.assertTrue(values['list'][0]['seller']['id'] > 0
                         and values['list'][0]['seller']['nickname'] != '')
Esempio n. 2
0
 def testDeleteUserFav(self):
     data = {
         'favIds': TestData.TempID,
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin)
     }
     values = Toolkit.get_response_from_server(IAddress.DeleteUserFav, data)
     self.assertEqual(1, len(values))
     self.assertEqual(1, values['status'])
Esempio n. 3
0
 def testAddLeaveWord(self):
     data = {
         'itemId': int(Config.auctionId),
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin),
         'comment': 'interface test'
     }
     values = Toolkit.get_response_from_server(IAddress.AddLeaveWord, data)
     self.assertEqual(1, len(values))
     self.assertEqual(1, values['status'])
Esempio n. 4
0
 def testSetDefaultAddress(self):
     data = {
         'id': TestData.TempID,
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin)
     }
     values = Toolkit.get_response_from_server(IAddress.SetDefaultAddress,
                                               data)
     self.assertEqual(1, len(values))
     self.assertEqual(1, values['status'])
Esempio n. 5
0
 def testIsInUserFav(self):
     data = {
         'itemId': int(Config.auctionId),
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin)
     }
     values = Toolkit.get_response_from_server(IAddress.IsInUserFav, data)
     self.assertEqual(2, len(values))
     self.assertEqual(1, values['status'])
     TestData.TempID = values['favId']
Esempio n. 6
0
 def testEditUserFavRemark(self):
     data = {
         'favId': TestData.TempID,
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin),
         'remark': 'interface test'
     }
     values = Toolkit.get_response_from_server(IAddress.EditUserFavRemark,
                                               data)
     self.assertEqual(1, len(values))
     self.assertEqual(1, values['status'])
Esempio n. 7
0
 def testGetBaiInfo(self):
     data = {
         'itemId': int(Config.auctionId),
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin)
     }
     values = Toolkit.get_response_from_server(IAddress.GetBailInfo, data)
     self.assertEqual(6, len(values))
     self.assertEqual(1, values['status'])
     self.assertTrue(values['availableBalance'] != ''
                     and values['balance'] != ''
                     and values['frozenAmount'] != ''
                     and values['lostBalance'] >= 0
                     and values['maxPrice'] >= 0)
Esempio n. 8
0
 def testGetUserCommissionInfo(self):
     data = {
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin),
         'userId': UserInfo.UserID1
     }
     values = Toolkit.get_response_from_server(
         IAddress.GetUserCommissionInfo, data)
     self.assertEqual(8, len(values))
     self.assertEqual(1, values['status'])
     self.assertTrue(
         values['availableBalance'] != '' and values['balance'] != ''
         and values['frozenAmount'] != '' and values['isActive'] != ''
         and values['isCertified'] != '' and values['isValid'] != ''
         and values['realname'] != '')
Esempio n. 9
0
 def testGetAuction(self):
     data = {'itemId': int(Config.auctionId)}
     values = Toolkit.get_response_from_server(IAddress.GetAuction, data)
     self.assertEqual(2, len(values))
     self.assertEqual(19, len(values['item']))
     self.assertEqual(1, values['status'])
     self.assertEqual(int(Config.auctionId), values['item']['id'])
     self.assertEqual(int(UserInfo.UserID3), values['item']['seller']['id'])
     self.assertEqual(UserInfo.User3, values['item']['seller']['nickname'])
     self.assertTrue(
         len(values['item']['descList']) != 0
         and len(values['item']['imageList']) != 0
         and len(values['item']['shippingList']) != 0
         and len(values['item']['albumList']) != 0
         and values['item']['beginPrice'] != ''
         and values['item']['beginTime'] != ''
         and values['item']['bidNum'] != ''
         and values['item']['buyer']['id'] is not None
         and values['item']['buyer']['nickname'] is not None
         and values['item']['currTime'] != ''
         and values['item']['endTime'] != ''
         and values['item']['maxPrice'] != ''
         and values['item']['minAddPrice'] != ''
         and values['item']['name'] != ''
         and values['item']['promise'] is not None
         and values['item']['seller']['credit'] != ''
         and values['item']['seller']['rate'] != ''
         and values['item']['specialArea'] != ''
         and values['item']['url'] != ''
         and values['item']['viewedNum'] != '')
Esempio n. 10
0
 def add_cash_account(self):
     self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin))
     self.page.go_to(Uri.MCashAccountPage)
     self.page.add_cash_account_btn.click()
     self.page.alipay_chk.click()
     self.page.alipay_txt.send_keys('*****@*****.**')
     self.page.submit_btn_3.click()
Esempio n. 11
0
 def testListAuction(self):
     for i in range(9):
         data = {'type': i, 'page': 1, 'order': 1}
         values = Toolkit.get_response_from_server(IAddress.ListAuction,
                                                   data)
         self.assertTrue(
             int(values['itemNum']) >= 0 and values['pageNum'] >= 0)
         self.assertEqual(1, values['status'])
         if len(values['list']) != 0:
             self.assertEqual(13, len(values['list'][0]))
             self.assertEqual(2, len(values['list'][0]['buyer']))
             self.assertEqual(2, len(values['list'][0]['seller']))
             self.assertTrue(
                 values['list'][0]['beginPrice'] >= 0
                 and values['list'][0]['beginTime'] >= 0
                 and values['list'][0]['bidNum'] >= 0
                 and values['list'][0]['currTime'] >= 0
                 and values['list'][0]['endTime'] >= 0
                 and values['list'][0]['id'] >= 0
                 and values['list'][0]['maxPrice'] >= 0
                 and values['list'][0]['minAddPrice'] >= 0
                 and values['list'][0]['name'] != ''
                 and values['list'][0]['smallImg'] != ''
                 and values['list'][0]['viewedNum'] >= 0
                 and values['list'][0]['buyer']['id'] >= 0
                 and values['list'][0]['buyer']['nickname'] != ''
                 and values['list'][0]['seller']['id'] >= 0
                 and values['list'][0]['seller']['nickname'] != '')
Esempio n. 12
0
 def testEditUserAddress(self):
     data = {
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin),
         'id': TestData.TempID,
         'name': 'interface Edit test',
         'area': 1001000000,
         'address': 'interface Edit test',
         'zipCode': '100000',
         'telephone': '',
         'mobile': '12345678'
     }
     values = Toolkit.get_response_from_server(IAddress.ReplaceUserAddress,
                                               data)
     self.assertEqual(2, len(values))
     self.assertTrue(values['id'] == TestData.TempID
                     and values['status'] == 1)
Esempio n. 13
0
 def edit_postal_recharge_form(self):
     self.fundPage.edit_first_row_link.click()
     time.sleep(1)
     self.tempData = Toolkit.get_random_number(6)
     self.fundPage.postal_paper_id_txt.clear()
     self.fundPage.postal_paper_id_txt.send_keys(self.tempData)
     self.fundPage.confirm_btn.click()
Esempio n. 14
0
 def testUserLogin(self):
     data = {
         'username': UserInfo.User2,
         'password': UserInfo.PwdLogin,
         'appId': AppInfo.Android,
         'appName': AppInfo.AppName,
         'apiId': AppInfo.ApiID
     }
     values = Toolkit.get_response_from_server(IAddress.Login, data)
     self.assertEqual(4, len(values))
     self.assertIsNotNone(values['code'])
     self.assertEqual('登录成功', values['info'])
     self.assertEqual(11, len(values['member']))
     self.assertEqual(UserInfo.User2, values['member']['nickname'])
     self.assertEqual(UserInfo.UserID2, values['member']['uid'])
     self.assertEqual(1, values['status'])
     self.assertTrue(values['member']['auction'] >= 0
                     and int(values['member']['bind']) >= 0
                     and values['member']['email'] is not None
                     and values['member']['funds'] >= 0
                     and values['member']['mobile'] is not None
                     and values['member']['photo'] is not None
                     and values['member']['shop'] >= 0
                     and values['member']['shortToken'] != ''
                     and values['member']['token'] != '')
Esempio n. 15
0
 def delete_cash_account(self):
     self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin))
     self.page.go_to(Uri.MCashAccountPage)
     for btn in self.page.del_cash_account_btn:
         btn.click()
         self.page.wait_until_clickable(self.page.confirm_css)
         self.page.confirm_btn.click()
         time.sleep(1)
Esempio n. 16
0
 def receive_trade(self):
     self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin))
     self.page.go_to(Uri.MReceivedAuctionTradePage)
     self.page.wait_until_clickable(self.page.trade_action_css)
     self.page.trade_action_btn.click()
     time.sleep(1)
     self.page.trade_confirm_btn.click()
     time.sleep(1)
Esempio n. 17
0
 def send_order(self):
     self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User3, UserInfo.PwdLogin))
     self.page.go_to(Uri.MSendBookOrderPage)
     self.page.wait_until_clickable(self.page.order_action_css)
     self.page.order_action_btn.click()
     self.page.wait_until_clickable(self.page.book_confirm_css)
     self.page.send_order_num_txt.send_keys('12345678')
     self.page.book_confirm_btn.click()
Esempio n. 18
0
 def do_fund_transfer(self):
     self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User3, UserInfo.PwdLogin))
     self.page.go_to(Uri.MTransferPage)
     self.page.trans_fund_account_txt.send_keys(UserInfo.FundID1)
     self.page.trans_fund_money_txt.send_keys('1')
     self.page.submit_btn_1.click()
     self.page.trans_pay_password.send_keys(UserInfo.PwdPay)
     self.page.submit_btn_2.click()
Esempio n. 19
0
 def add_prod_type(self):
     self.sellerCenterPage.go_to(Uri.ManageProductCategoryPage)
     self.sellerCenterPage.add_prod_type_btn.click()
     self.sellerCenterPage.wait_until_clickable(self.sellerCenterPage.confirm_btn_css)
     self.sellerCenterPage.prod_type_name_txt.send_keys('auto_test')
     self.sellerCenterPage.prod_type_id_txt.send_keys(Toolkit.get_random_number(4))
     self.sellerCenterPage.prod_type_sort_txt.send_keys('1')
     self.sellerCenterPage.confirm_btn.click()
Esempio n. 20
0
 def fill_postal_recharge_form(self):
     self.fundPage.go_to(Uri.PostalRechargePage)
     self.fundPage.add_postal_recharge_btn.click()
     self.tempData = Toolkit.get_random_number(6)
     self.fundPage.postal_paper_id_txt.send_keys(self.tempData)
     self.fundPage.postal_amount_txt.send_keys('0.01')
     self.fundPage.postal_remark_txt.send_keys('测试用,无需处理!')
     self.fundPage.postal_confirm_btn.click()
     self.fundPage.wait_until_clickable(self.fundPage.postal_result_box_css)
Esempio n. 21
0
 def do_cash_back(self):
     self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin))
     self.page.go_to(Uri.MCashBackPage)
     self.page.cash_txt.send_keys('2')
     time.sleep(1)
     self.page.submit_btn_1.click()
     self.page.cash_back_pass_txt.send_keys(UserInfo.PwdPay)
     time.sleep(1)
     self.page.submit_btn_2.click()
Esempio n. 22
0
 def edit_delivery_info(self):
     self.bookOrderPage.go_to(Uri.BookSellerReceivingOrderPage)
     self.search_order(TestData.TempID)
     self.bookOrderPage.edit_delivery_info_link.click()
     time.sleep(1)
     self.bookOrderPage.delivery_sheet_num_txt.clear()
     self.bookOrderPage.delivery_sheet_num_txt.send_keys(
         Toolkit.get_random_number(8))
     self.bookOrderPage.edit_delivery_confirm_btn.click()
Esempio n. 23
0
    def testChangeMyMaxPrice(self):
        auction_info = Toolkit.get_response_from_server(
            IAddress.GetAuction, {'itemId': int(Config.auctionId)})
        max_price = auction_info['item']['maxPrice']
        min_add_price = auction_info['item']['minAddPrice']

        data = {
            'itemId': int(Config.auctionId),
            'price': max_price + min_add_price * 2,
            'token': Toolkit.get_user_token(UserInfo.User2, UserInfo.PwdLogin)
        }
        values = Toolkit.get_response_from_server(IAddress.ChangeMyMaxPrice,
                                                  data)
        self.assertEqual(6, len(values))
        self.assertEqual(1, values['status'])
        self.assertEqual(UserInfo.User2, values['buyer'])
        self.assertTrue(values['beginTime'] != '' and values['currTime'] != ''
                        and values['endTime'] != '' and values['price'] != '')
Esempio n. 24
0
    def eval(self, user_type, eval_type):
        if user_type == 'buyer':
            self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin))
            if eval_type == 'order':
                self.page.go_to(Uri.MBuyerEvalOrderPage)
                self.page.wait_until_clickable(self.page.order_action_css)
                self.page.order_action_btn.click()
            if eval_type == 'trade':
                self.page.go_to(Uri.MBuyerEvalTradePage)
                self.page.wait_until_clickable(self.page.trade_action_css)
                self.page.trade_action_btn.click()
        if user_type == 'seller':
            self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User3, UserInfo.PwdLogin))
            self.page.go_to(Uri.MSellerEvalOrderPage)
            self.page.wait_until_clickable(self.page.order_action_css)
            self.page.order_action_btn.click()

        self.page.eval_content_txt.send_keys('automation test')
        self.page.submit_eval_btn.click()
Esempio n. 25
0
 def edit_prod_type(self):
     self.sellerCenterPage.edit_prod_type_link.click()
     self.sellerCenterPage.wait_until_clickable(self.sellerCenterPage.confirm_btn_css)
     self.sellerCenterPage.prod_type_name_txt.clear()
     self.sellerCenterPage.prod_type_name_txt.send_keys('auto_edit')
     self.sellerCenterPage.prod_type_id_txt.clear()
     self.sellerCenterPage.prod_type_id_txt.send_keys(Toolkit.get_random_number(4))
     self.sellerCenterPage.prod_type_sort_txt.clear()
     self.sellerCenterPage.prod_type_sort_txt.send_keys('2')
     self.sellerCenterPage.confirm_btn.click()
Esempio n. 26
0
 def testListUserAddress(self):
     data = {
         'token': Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin)
     }
     values = Toolkit.get_response_from_server(IAddress.ListUserAddress,
                                               data)
     self.assertEqual(2, len(values))
     if len(values['list']) != 0:
         self.assertEqual(9, len(values['list'][0]))
         self.assertTrue(values['list'][0]['address'] != ''
                         and values['list'][0]['area'] != ''
                         and values['list'][0]['areaDesc'] != ''
                         and values['list'][0]['def'] != ''
                         and values['list'][0]['id'] != ''
                         and values['list'][0]['mobile'] is not None
                         and values['list'][0]['name'] != ''
                         and values['list'][0]['telephone'] is not None
                         and values['list'][0]['zipCode'] != '')
     self.assertEqual(1, values['status'])
Esempio n. 27
0
 def testSearchUserByName(self):
     data = {'key': 'autotest', 'page': 1, 'type': 1}
     values = Toolkit.get_response_from_server(IAddress.SearchUser, data)
     self.assertEqual(1, values['status'])
     self.assertEqual(4, len(values))
     self.assertTrue(values['itemNum'] >= 0 and values['pageNum'] >= 0)
     if len(values['list']) > 0:
         self.assertEqual(3, len(values['list'][0]))
         self.assertTrue(values['list'][0]['avatar'] != ''
                         and values['list'][0]['nickName'] != ''
                         and values['list'][0]['userId'] != 0)
Esempio n. 28
0
 def testUserRegister(self):
     name = 'autotest_' + Toolkit.get_random_value().lower()
     data = {
         'username': name,
         'password': UserInfo.PwdLogin,
         'appId': AppInfo.Android,
         'appName': AppInfo.AppName
     }
     values = Toolkit.get_response_from_server(IAddress.Register, data)
     self.assertEqual(4, len(values))
     self.assertIsNotNone(values['code'])
     self.assertEqual('注册成功', values['info'])
     self.assertEqual(6, len(values['member']))
     self.assertEqual(name, values['member']['nickname'])
     self.assertEqual(1, values['status'])
     self.assertTrue(values['member']['email'] is not None
                     and values['member']['mobile'] is not None
                     and values['member']['photo'] != ''
                     and values['member']['token'] != ''
                     and values['member']['uid'] != '')
Esempio n. 29
0
 def testSearchUserByID(self):
     data = {'key': UserInfo.UserID1, 'page': 1, 'type': 2}
     values = Toolkit.get_response_from_server(IAddress.SearchUser, data)
     self.assertEqual(4, len(values))
     self.assertEqual(1, values['status'])
     self.assertEqual(1, values['pageNum'])
     self.assertEqual(1, values['itemNum'])
     self.assertEqual(1, len(values['list']))
     self.assertTrue(values['list'][0]['avatar'] != '')
     self.assertEqual(UserInfo.User1, values['list'][0]['nickName'])
     self.assertEqual(int(UserInfo.UserID1), values['list'][0]['userId'])
Esempio n. 30
0
 def pay_order(self):
     self.page.go_to(Uri.MLoginPage, token=Toolkit.get_user_token(UserInfo.User1, UserInfo.PwdLogin))
     self.page.go_to(Uri.MBuyerPayOrderPage)
     self.page.wait_until_clickable(self.page.order_action_css)
     self.page.order_action_btn.click()
     self.page.wait_until_clickable(self.page.pay_step2_css)
     time.sleep(1)
     self.page.pay_step2_btn.click()
     time.sleep(1)
     self.page.pay_pass_txt.send_keys(UserInfo.PwdPay)
     self.page.pay_step3_btn.click()