def test_update_supplier_infor_05(df_login_xadmin, delete_register, taxpayerType, companyName, legalPeople, companyAddress, taxpayerNumber, bankCode, simpleName, basicAccount, bankName, bankAccountName, mainName, mainPhone, expected): ''' 验证修改公司信息字段的有效性 ''' # s = df_login_xadmin # DF_Login(s) print("测试第一步") with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :新增公司信息后,修改公司信息字段"): update_infor = update_supplier_infor(s, taxpayerType=taxpayerType, companyName=companyName, legalPeople=legalPeople, companyAddress=companyAddress, taxpayerNumber=taxpayerNumber, bankCode=bankCode, simpleName=simpleName, basicAccount=basicAccount, bankName=bankName, bankAccountName=bankAccountName, mainName=mainName, mainPhone=mainPhone) with allure.step("step3 :断言"): assert update_infor['data'] == expected['data'] assert update_infor['succ'] == expected['succ']
def test_add_supplier_cards_02( self, df_login_xadmin, delete_register, delete_account_infor, delete_cards_infor, delete_changing_code, supplierFullName, businessType, supplierType, supplierStatus, returnSupplier, contacts, contactsPhone, remark, bizType, supplierCode, supplierShortName, taxType, plannedDeliveryTime, minOrderAmount, orderCalendar, manualPriceRevision, autoConfirmOrders, settleCompany, payType, drawer, settlePeriod, settleMethod, accountPeriodStartDay, accountPeriod, grossProfitCompensate, paymentFreeze, generateZeroSettleSheet, checkStock, checkCost, expected): ''' 验证新增卡号数据的有效性 ''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :点击新增卡号按钮"): save_supplier_information(s) kk = check_supplier_information(s) # 公司信息档案详情 print("@##@#@#@#@##@#@#", kk) supplier_hk = kk['data']['accountList'][0]['companyId'] print("########sssssssssssss", supplier_hk) Add_supplier_card(s).get_companys(supplier_hk) supplier_card = Add_supplier_card(s).add_supplier_cards( supplierFullName=supplierFullName, businessType=businessType, supplierType=supplierType, supplierStatus=supplierStatus, returnSupplier=returnSupplier, contacts=contacts, contactsPhone=contactsPhone, remark=remark, bizType=bizType, supplierCode=supplierCode, supplierShortName=supplierShortName, taxType=taxType, plannedDeliveryTime=plannedDeliveryTime, minOrderAmount=minOrderAmount, orderCalendar=orderCalendar, manualPriceRevision=manualPriceRevision, autoConfirmOrders=autoConfirmOrders, settleCompany=settleCompany, payType=payType, drawer=drawer, settlePeriod=settlePeriod, settleMethod=settleMethod, accountPeriodStartDay=accountPeriodStartDay, accountPeriod=accountPeriod, grossProfitCompensate=grossProfitCompensate, paymentFreeze=paymentFreeze, generateZeroSettleSheet=generateZeroSettleSheet, checkStock=checkStock, checkCost=checkCost) print("@@@@@@@--------", supplier_card) with allure.step("step3 :断言"): assert supplier_card['data'] == expected['data'] assert supplier_card['succ'] == expected['succ']
def test_import_company_10(df_login_xadmin): ''' 验证公司档案信息模板导入功能有效性 ''' s = df_login_xadmin DF_Login(s) list_company = import_company(s, name="供商公司導入模板.xls") # 效验字段,文件里会有多种情况 assert list_company['succ'] == True assert list_company['code'] == 0
def test_card_list_01(self, df_login_xadmin): ''' 验证查询卡号管理列表功能有效性 ''' s = df_login_xadmin DF_Login(s) card_list = Add_supplier_card(s).card_list() assert card_list['succ'] == True assert card_list['data']['pageSize'] == 20
def test_find_supplier_infor_07(df_login_xadmin): ''' 验证当页数,页码为空时,无法查询 ''' s = df_login_xadmin DF_Login(s) find_infor = find_supplier_infor(s, pageSize="", currentPage="") assert find_infor['code'] == 100 assert find_infor['succ'] == False
def test_add_commmodity_03(self, df_login_xadmin): with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理"): pass with allure.step("step3 :点击新增商品按钮"): result = commodity_information(s).add_commmodity() with allure.step("step4 :断言"): assert result['result'] == '商品20111110系統內已存在'
def test_find_account_cards_12(df_login_xadmin): ''' 验证查看账号卡号功能的有效性(没有卡号) :return: ''' s = df_login_xadmin DF_Login(s) find_cards = find_account_cards(s) assert find_cards['succ'] == True assert find_cards['data']['pageSize'] == 20
def test_import_ware(self, df_login_xadmin, delete__ware): '''验证模板导入批量商品配置有效性''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理/商品配置/货架组级门店管理"): pass with allure.step("step3 :已创建好的货架组,点击分配门店"): result = commodity_information(s).import_ware() with allure.step("step4: 断言"): assert result['result'] == '導入貨架組級-商品數據文件成功'
def test_relate_shelfgrouplevel_10(self, df_login_xadmin): '''验证货架组关联门店功能的有效性''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理/商品配置/货架组级门店管理"): pass with allure.step("step3 :已创建好的货架组,点击分配门店"): result = commodity_information(s).relate_shelfgrouplevel() with allure.step("step4: 断言"): assert result['result'] == '操作成功'
def test_add_shelves_07(self, df_login_xadmin, delete_shelfgrouplevel): '''验证新增货架组功能有效性''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理/商品配置"): pass with allure.step("step3: 点击新增货架组"): result = commodity_information(s).add_shelves(name="柬埔寨货架11") with allure.step("step4: 断言"): assert result['result'] == '操作成功'
def select_commodity_info_04(self): with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理"): pass with allure.step("step3: 新增商品后,点击查询该商品的查看功能键"): result = commodity_information(s).select_commodity_info( rfId=20111110) assert result['code'] == 'success' assert result['result'] == '操作成功'
def test_download_template_08(df_login_xadmin): ''' 验证公司信息模板下载的有效性 ''' with allure.step("step1 :登录 "): s = df_login_xadmin DF_Login(s) with allure.step("step2 :点击下载模板按钮 "): load_template = supplier_loadown_template(s) with allure.step("step3 :断言 "): assert load_template == 200
def test_update_commodity_05(self, df_login_xadmin): with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理"): pass with allure.step("step3: 新增商品后,点击修改商品"): result = commodity_information(s).update_commodity_info() with allure.step("step4: 断言"): assert result['result'] == '操作成功' assert result['data'] == None
def test_import_commodity_01(self, df_login_xadmin): with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统-品类管理页"): pass with allure.step("step3 :点击导入功能按钮,选择要上传的文件"): import_group = commodity_information(s).import_source_group() with allure.step("step4 :断言"): assert import_group['code'] == 'success' assert import_group['data'] == None
def test_save_supplier_information_01(df_login_xadmin, delete_register, delete_account_infor): ''' 新建公司信息,如果数据库中有这条数据就先删除该数据 ''' s = df_login_xadmin DF_Login(s) save = save_supplier_information(s) # delete_account_infor() '''新建公司失败''' assert save['code'] == 0 assert save['message'] == None
def test_add_shelves_09(self, df_login_xadmin, delete_shelfgrouplevel): '''验证修改货架组信息功能的有效性''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理/商品配置"): pass with allure.step("step3: 点击新增货架组"): result = commodity_information(s).update_shelves( name="柬埔寨货架13", code="JPZ011", purchaseCatId="859380", id="98") with allure.step("step4: 断言"): assert result['result'] == '操作成功'
def test_get_query_02(self, df_login_xadmin, test_input, expected, title): with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统列表页"): pass with allure.step("step3 :输入商家商品编码,点击查询"): result = commodity_information(s).get_query_ware( test_input["rfIds"], test_input["skuIds"], test_input["itemNums"], test_input["sapTitle"]) with allure.step("step4 :断言"): assert result['result'] == expected['result']
def test_import_company_09(df_login_xadmin): ''' 验证公司档案信息模板导入功能有效性 ''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :编辑相对应的模板,点击导入"): list_company = import_company(s, name="供商公司導入模板 (5).xls") with allure.step("step3 :断言"): assert list_company['succ'] == True assert list_company['code'] == 0
def test_check_supplier_information_04(df_login_xadmin, delete_register): ''' 验证输入有效的id,查询公司信息详情有效性 前置:登录 用例步骤:1.先将数据库的数据进行清理 2.新增供应商公司档案 3.点击查看该公司档案详情 ''' s = df_login_xadmin DF_Login(s) with allure.step("step1 :删除数据后新增.点击查看该公司档案详情"): check_supplier = check_supplier_information(s) with allure.step("step2 :断言"): assert check_supplier['succ'] == True assert check_supplier['code'] == 0
def test_approve_supplier_card_17(self, df_login_xadmin, delete_register, delete_account_infor, delete_cards_infor, delete_changing_code): ''' 验证审核有效性 ''' s = df_login_xadmin DF_Login(s) save_supplier_information(s) kk = check_supplier_information(s) # 公司信息档案详情 print("@##@#@#@#@##@#@#", kk) supplier_hk = kk['data']['accountList'][0]['companyId'] print("########sssssssssssss", supplier_hk) Add_supplier_card(s).get_companys(supplier_hk) supplier = Add_supplier_card(s).add_supplier_cards( supplierFullName="深圳大源源呐939", businessType="1", supplierType="1", supplierStatus="1", returnSupplier="1", contacts="22222", contactsPhone="18571519920", remark="", bizType="TO_C", supplierCode="9999011", supplierShortName="11111", taxType="Z1", plannedDeliveryTime="1", minOrderAmount="0", orderCalendar="23", manualPriceRevision="1", autoConfirmOrders="0", settleCompany="10039", payType="1", drawer="", settlePeriod="2", settleMethod="2", accountPeriodStartDay="0", accountPeriod="30", grossProfitCompensate="2", paymentFreeze="0", generateZeroSettleSheet="0", checkStock="0", checkCost="0") approve = Add_supplier_card(s).approve_supplier_card( source_id='9999011', status='4') print("#@@@@@@@", approve) assert approve['data'] == "駁回審批完成" assert approve['succ'] == True
def test_query_list_06(self, df_login_xadmin, test_input, excepted, title): with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :进入到商品系统管理"): pass with allure.step("step3: 进入到商品配置中的货架组配置页,点击查询"): result = commodity_information(s).query_list_shelves( test_input['pageSize'], test_input['currentPage'], test_input['name'], test_input['code'], test_input['purchaseCatId']) with allure.step("step4: 断言"): assert result['result'] == excepted['result'] assert result['code'] == excepted['code']
def test_find_account_list_11(df_login_xadmin, pageSize, currentPage, supplierName, expected): ''' 验证点击账号管理列表接口查询有效性 ''' with allure.step("step1 : 登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 : 点击账号管理列表查询按钮"): find_list = find_account_list(s, pageSize=pageSize, currentPage=currentPage, supplierName=supplierName) with allure.step("step3 : 断言"): assert find_list['succ'] == expected['succ'] assert find_list['code'] == expected['code']
def test_find_supplier_infor_06(df_login_xadmin, pageSize, currentPage, companyName, expected): ''' 验证查询公司档案列表有效性 ''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :点击查询按钮,或输入查询条件,再进行查询"): find_infor = find_supplier_infor(s, pageSize=pageSize, currentPage=currentPage, companyName=companyName) with allure.step("step3 :断言"): assert find_infor['succ'] == expected['succ'] assert find_infor['code'] == expected['code']
def test_update_account_information_13(df_login_xadmin, mobile, contacts, email, status, expected): ''' 验证修改账号信息的有效性 ''' with allure.step("step1 : 登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 : 修改账号信息字段"): account_information = update_account_information(s, mobile=mobile, contacts=contacts, email=email, status=status) print("@@@@@@@", account_information) with allure.step("step3 : 断言"): assert account_information['succ'] == expected["succ"] assert account_information['code'] == expected['code']
def test_add_company_information_02(df_login_xadmin, taxpayerType, companyName, legalPeople, companyAddress, taxpayerNumber, bankCode, simpleName, basicAccount, bankName, bankAccountName, expected): with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :新增公司信息"): add_supplier = save_supplier_information( s, taxpayerType=taxpayerType, companyName=companyName, legalPeople=legalPeople, companyAddress=companyAddress, taxpayerNumber=taxpayerNumber, bankCode=bankCode, simpleName=simpleName, basicAccount=basicAccount, bankName=bankName, bankAccountName=bankAccountName) with allure.step("step3 :断言"): assert add_supplier['succ'] == expected['succ']
def account_resetpwd_14(df_login_xadmin): ''' 验证修改密码的有效性 ''' with allure.step("step1 :登录"): s = df_login_xadmin DF_Login(s) with allure.step("step2 :获取新增公司信息的供商账号字段"): account_reset = find_supplier_infor(s) account_resets = account_reset['data']['list'][0]['groupNo'] with allure.step("step3 :获取账号管理中的与新增公司信息的供商名称相对应的数据"): account_list = find_account_list(s, pageSize="20", currentPage="1", supplierName="深圳大源源呐939") print(account_list['data']['list'][0]['mobile']) account_lists = account_list['data']['list'][0]['mobile'] with allure.step("step4 :点击修改密码按钮"): accountet = account_resetPWD(s, supplierAccount=account_resets, contactsPhone=account_lists) with allure.step("step5 :断言"): assert accountet['data'] == "密碼重置完成,信息已發送到該供應商聯系電話上" assert accountet['succ'] == True
cur_path = os.path.join(real_path, "shelfGroupLevelWare.xlsx") print(cur_path) url = "https://testware-partner.dmall.com.hk/shelfgrouplevel/importware" headers = {"Referer": "https://testpartner.dmall.com.hk/"} f = { "file": ("shelfGroupLevelWare.xlsx", open(cur_path, "rb"), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ) } r = self.s.post(url, headers=headers, files=f, verify=False) logger.debug("返回日志:%s" % r.json()) return r.json() if __name__ == "__main__": s = requests.session() DF_Login(s) # get_query_ware(s) # print("@@@@@@@@@@@@@@@@@---------",) # cc=commodity_information(s).import_source_group() # print("#@@@@@@@@@@@@@@@@@@@@@@@@@",cc) # print(cc['code']) # # commodity_information(s).add_shelves(name="柬埔寨货架11") # commodity_information(s).update_shelves(name="柬埔寨货架13",code="JPZ011",purchaseCatId="859380",id="98") commodity_information(s).import_ware()
headers = { "Referer": "https://testpartner.dmall.com.hk/", "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" } body = { "form_data": changing_id } r = self.s.post(url, data=body, headers=headers, verify=False) logger.debug("返回日志:%s" % r.json()) return r.json() if __name__ == "__main__": s = requests.session() df_login = DF_Login(s) # save_supplier_information(s) # cc= Add_supplier_card(s) # check_supplier_information(s) # kk = check_supplier_information(s) # 公司信息档案详情 # print("@##@#@#@#@##@#@#",kk) # supplier_hk = kk['data']['accountList'][0]['companyId'] # print("########",supplier_hk) # Add_supplier_card(s).get_companys(supplier_hk) # Add_supplier_card(s).add_supplier_cards(supplierFullName="深圳大源源呐939",businessType="1",supplierType="1",supplierStatus="1", # returnSupplier="1",contacts="22222",contactsPhone="18571519920",remark="",bizType="TO_C", # supplierCode="9999910",supplierShortName="11111",taxType="Z1", # plannedDeliveryTime="1",minOrderAmount="0",orderCalendar="23", # manualPriceRevision="1",autoConfirmOrders="0",settleCompany="10039",payType="1", # drawer="",settlePeriod="2",settleMethod="2",accountPeriodStartDay="0",accountPeriod="30",
def df_login_xadmin(request): s = requests.session() DF_Login(s) return s