def test_01search_by_email(self): #1.查询 rd_email = get_rd_value("/api/admin/credit/list", store_id,self.token,"account") data = {"store_id":store_id,"page_size":10,"page":1,"operator":"sunny_hong","token":self.token,"account":rd_email} result = public_post("/api/admin/credit/list",data) assert len(json.loads(result)["data"]["data"]) > 0 assert json.loads(result)["msg"] == "ok"
def test_04search_by_ctime(self): '''创建时间查询''' rd_ctime = get_rd_value("/api/admin/coupon/dealList", store_id, self.token, "ctime") # print(rd_ctime) if rd_ctime is None: return "list is null" data = { "store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "account": "", "code_type": 1, "asin": "", "receive": "", "code": "", "country": "", "start_time": rd_ctime, "end_time": rd_ctime } result = public_post("/api/admin/coupon/dealList", data) assert json.loads(result)["msg"] == "ok" assert len(json.loads(result)["data"]["data"]) > 0
def test_02search_by_ctime(self): '''邮件发送时间查询''' rd_ctime = get_rd_value("/api/admin/email/list", store_id, self.token, "ctime") data = {"store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "account": "", "start_time": rd_ctime, "end_time": rd_ctime} result = public_post("/api/admin/email/list", data) # print(result) assert json.loads(result)["msg"] == "ok"
def test_01search_by_email(self): '''邮箱查询''' rd_to_email = get_rd_value("/api/admin/email/list",store_id,self.token,"to_email") data = {"store_id": store_id,"page_size": 10,"page": 1,"operator":"sunny_hong", "token": self.token, "account": rd_to_email} result = public_post("/api/admin/email/list", data) # print(result) assert json.loads(result)["msg"] == "ok"
def test_03search_by_country(self): """站点查询""" rd_country = get_rd_value("/api/admin/activity/apply/list", store_id, self.token, "country") if rd_country is None: return "list is null" data = {"store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "audit_status": "", "account": "", "country": rd_country, "sku": ""} result = public_post("/api/admin/activity/apply/list", data) assert json.loads(result)["code"] == 1 assert json.loads(result)["data"]["pagination"]["total"] > 0
def test_04search_by_time(self): '''查询上传时间''' created_at = get_rd_value("/api/admin/activity/product/list", store_id, self.token, "created_at") # print(created_at) if created_at is None: return "list is null" data = {"store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "created_at": created_at} result = public_post("/api/admin/product/list", data) assert len(json.loads(result)["data"]["data"]) > 0
def test_01search_by_asin(self): """查询asin""" rd_asin = get_rd_value("/api/admin/activity/product/list",store_id,self.token,"asin") # print(rd_asin) if rd_asin is None: return "list is null" data = {"store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "asin": rd_asin} result = public_post("/api/admin/product/list", data) assert len(json.loads(result)["data"]["data"]) > 0
def test_04search_by_invite_time(self): """邀请时间查询""" rd_invite_time = get_rd_value("/api/admin/invite/list", store_id, self.token, "ctime") if rd_invite_time is None: return "list is null" data = {"store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "account": "", "country": "", "invite_code":"" , "source": "", "order_by_data": "","start_at":rd_invite_time,"end_at":rd_invite_time} result = public_post("/api/admin/invite/list", data) assert json.loads(result)["code"] == 1 assert json.loads(result)["data"]["pagination"]["total"] > 0
def test_07action(self): '''启用deal产品''' id = get_frist_value("/api/admin/activity/product/list", store_id, self.token, "id") if id is None: return "list is null" data ={"store_id":store_id,"operator":"sunny_hong","token":self.token, "product_status":"1","mb_type":4,"country":"DE","product_id":id,"act_type":9} result = public_post("/api/admin/activity/product/operate", data) # print(result) assert json.loads(result)["data"] == 1
def test_05import(self): '''导入通用折扣码''' if store_id in ["9","10","8","3","5","6"]: return "list is null" with open(r"F:\test_1_brand\data\deal-common (1).xlsx", "rb") as f: file = {"file": f.read()} data = {"store_id": store_id, "operator": "sunny_hong","token": self.token,"mb_type": 4} result = public_post("/api/admin/activity/product/importUniversal", data, file) print(result) assert json.loads(result)["code"] == 1
def test_01search_by_email(self): """邀请关系列表邮箱查询""" # 1.1随机获取list邮箱 rd_email = get_rd_value("/api/admin/invite/list",store_id,self.token,"account") if rd_email is None: return "list is null" data = {"store_id":store_id,"page_size":10,"page":1,"operator":"sunny_hong","token":self.token,"account":rd_email, "country":"","invite_code":"","source":"","order_by_data":""} result = public_post("/api/admin/invite/list",data) assert json.loads(result)["code"] == 1 assert json.loads(result)["data"]["pagination"]["total"] > 0
def test_06edit(self): '''编辑产品''' id = get_frist_value("/api/admin/activity/product/list", store_id, self.token, "id") if id is None: return "list is null" data = {"product_id":id,"name":"Mpow H16 Noise Cancelling Kopfhörer-test","sku":"BHMPBH372AB-DEAS1-test", "asin":"B07SX3YNN1-test","activity_name":"summer-sale2-test", "act_type":9,"store_id":store_id,"operator":"sunny_hong","token":self.token} result = public_post("/api/admin/activity/product/edit", data) # print(result) assert json.loads(result)["msg"] == "ok" assert json.loads(result)["data"] == 1
def test_08delete_product(self): '''删除Deal产品''' #1.获取导入的第一个产品id id = get_frist_value("/api/admin/activity/product/list", store_id, self.token, "id") if id is None: return "list is null" # print(id) data = {"store_id": store_id, "operator": "sunny_hong", "token": self.token, "product_id[]": id} result = public_post("/api/admin/activity/product/delete", data) # print(result) assert json.loads(result)["msg"] == "ok" assert json.loads(result)["data"] == 1
def test_03search_by_mb_type(self): '''查询模板类型''' mb_type = get_rd_value("/api/admin/activity/product/list", store_id, self.token, "mb_type") # print(mb_type) if mb_type is None: return "list is null" if mb_type == 3: mb_type+=1 data = {"store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "mb_type": mb_type} result = public_post("/api/admin/product/list", data) # print(len(json.loads(result)["data"]["data"])) assert len(json.loads(result)["data"]["data"]) > 0
def test_04delete_product(self): '''删除产品''' delete_id = get_frist_value("/api/admin/product/list", store_id, self.token, "id") # print(delete_id) data = { "store_id": store_id, "id": delete_id, "operator": "sunny_hong", "token": self.token } result = public_post("/api/admin/product/delete", data) assert json.loads(result)["code"] == 1 assert json.loads(result)["msg"] == "ok"
def test_02add_product(self): '''添加产品''' data = { "store_product_id": self.store_product_id, "credit": "10", "qty": "10", "product_status": "0", "store_id": store_id, "operator": "sunny_hong", "token": self.token } result = public_post("/api/admin/product/addedit", data) assert json.loads(result)["code"] == 1 assert json.loads(result)["msg"] == "ok"
def test_05import(self): """导入""" if store_id in ["9"]: return "list is null" with open(r"F:\test_1_brand\data\deal_coupon_template (1).xlsx", "rb") as f: file = {"file": f.read()} data = { "store_id": store_id, "operator": "sunny_hong", "token": self.token, "use_type": 1 } result = public_post("/api/admin/coupon/importDeal", data, file) # print(result) assert json.loads(result)["code"] == 1
def test_02search_by_sku(self): '''随机查询产品sku''' rd_sku = get_rd_value("/api/admin/product/list", store_id, self.token, "sku") # print(rd_sku) data = { "store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "store_product_id": "", "sku": rd_sku } result = public_post("/api/admin/product/list", data) assert len(json.loads(result)["data"]["data"]) > 0
def test_03search(self): #1.查询 rd_email = get_rd_value("/api/admin/order/list", store_id, self.token, "account") data = { "store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "orderno": "", "country": "", "act_id": "", "account": rd_email } result = public_post("/api/admin/order/list", data) assert json.loads(result)["code"] == 1
def test_01search(self): """审核页面查询""" # 1.1随机获取list邮箱 rd_email = get_rd_value("/api/admin/share/list", store_id, self.token, "account") data = { "store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "audit_status": "", "account": rd_email, "country": "" } result = public_post("/api/admin/share/list", data) assert json.loads(result)["code"] == 1
def test_01search_by_product_id(self): '''随机查询产品id''' rd_id = get_rd_value("/api/admin/product/list", store_id, self.token, "store_product_id") print(rd_id) if rd_id is None: return "list is null" data = { "store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "store_product_id": rd_id, "sku": "" } result = public_post("/api/admin/product/list", data) print(len(json.loads(result)["data"]["data"])) assert len(json.loads(result)["data"]["data"]) > 0
def test_04search_by_audit_status(self): """审核状态查询""" rd_audit_num = None rd_audit_status_txt = get_rd_value("/api/admin/activity/apply/list", store_id, self.token, "audit_status") # print(rd_audit_status_txt) if rd_audit_status_txt is None: return "list is null" if rd_audit_status_txt == "未审核": rd_audit_num = "0" elif rd_audit_status_txt == "已通过": rd_audit_num = "1" elif rd_audit_status_txt == "未通过": rd_audit_num = "2" elif rd_audit_status_txt == "其他": rd_audit_num = "3" data = {"store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "audit_status": rd_audit_num, "account": "", "country": "", "sku": ""} result = public_post("/api/admin/activity/apply/list", data) assert json.loads(result)["code"] == 1 assert json.loads(result)["data"]["pagination"]["total"] > 0
def test_03edit(self): '''编辑''' edit_id = get_frist_value("/api/admin/product/list", store_id, self.token, "id") data = { "id": edit_id, "store_product_id": self.store_product_id, "credit": "20", "qty": "20", "sku": "", "name": "", "status": 1, "expire_time": self.now_time, "product_status": "下架", "store_id": store_id, "operator": "sunny_hong", "token": self.token } result = public_post("/api/admin/product/edit", data) assert json.loads(result)["code"] == 1 assert json.loads(result)["msg"] == "ok"
def test_01search_by_asin(self): '''查询asin''' rd_asin = get_rd_value("/api/admin/coupon/dealList", store_id, self.token, "asin") # print(rd_asin) if rd_asin is None: return "list is null" data = { "store_id": store_id, "page_size": 10, "page": 1, "operator": "sunny_hong", "token": self.token, "account": "", "code_type": 1, "asin": rd_asin, "receive": "" } result = public_post("/api/admin/coupon/dealList", data) assert json.loads(result)["msg"] == "ok" assert len(json.loads(result)["data"]["data"]) > 0