def test_MemberBatch_relatedApi_status_01(self): """驗證 會員批次 - 匯入大量帳號 狀態""" self.upload = UploadFile('document/memberSearchBatch.xlsx', 'filename', 'memberSearchBatch.xlsx') data = self.upload.Upload_file() response_data = self.memberBatch.importAndGetLargeAccount(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉
def test_NewLuckyWheelBaseTest_relatedApi_status_04(self): """驗證 时来运转 - 更新入口圖片""" self.upload = UploadFile('image/jpg/test_jpg.jpg', 'ImageFile', 'test_jpg.jpg') data = self.upload.Upload_file() response_data = self.newLuckyWheel.uploadImages(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file()
def test_MissionReward__relatedApi_status_03(self): """驗證 任务挑战 - 上傳任務圖片 狀態""" self.upload = UploadFile('image/jpg/test_jpg.jpg', 'ImageFile', 'test_jpg.jpg') data = self.upload.Upload_file() response_data = self.missionReward.uploadImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file()
def create_missionReward(self, mode): self.upload = UploadFile('image/jpg/test_jpg.jpg', 'ImageFile', 'test_jpg.jpg') data = self.upload.Upload_file() response_data = self.missionReward.uploadImage(data) self.upload.Close_file() self.system = system_config_Setting() BeginTime = (datetime.now() + timedelta(hours=-12)).strftime("%Y/%m/%d %H:%M:%S") EndTime = (datetime.now() + timedelta(hours=-11)).strftime("%Y/%m/%d %H:%M:%S") receiveBonusLimitTime = (datetime.now() + timedelta(hours=+12)).strftime( "%Y/%m/%d %H:%M:%S") # 領獎 if mode == 1: data = { "taskCount": 1, "activityStartTime": BeginTime, "item": [{ "title": "A", "type": 2, "img": { "$ngfBlobUrl": "blob:" + self.config.Master_config() + '/' }, "setting": 1, "bonus": 1, "auditTimes": 1, "imgStatus": 2, "imgErrorMsg": "", "imageUrl": response_data[1]['ReturnObject'], "errorFile": 'null', "category": 'null', "categoryFullName": 'null', "gameCategoryPropertyNames": 'null' }], "name": "QA_Test", "activityEndTime": EndTime, "receiveBonusLimitTime": receiveBonusLimitTime, "receiveBonusDays": 1, "registerStartTime": "", "registerEndTime": "", "completeBonus": 1, "completeAuditTimes": 1, "memberLevelSettingIds": [self.system.getMemberLevelId()] } return data
def test_LuckyWheelManagement_relatedApi_status_08(self): """驗證 幸运转盘 - 上傳圖片 狀態""" self.upload = UploadFile('image/jpg/test_jpg.jpg', # 檔案路徑 'imageFile', # 上傳欄位 'test_jpg.jpg' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.luckyWheelManagement.uploadRewardImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉檔案
def get_QRcode_Url(self): # 取得商戶的上傳URL self.upload = UploadFile( 'image/png/groupAccount.png', # 檔案路徑 'qrCodeFile', # 上傳欄位 'groupAccount.png' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.groupAccount.updateImage(data) self.upload.Close_file() return response_data[1]['QrCodeUrl']
def test_BlockListManagement_relatedApi_status_13(self): """驗證 封鎖名單管理-檢查IP匯入範本上傳 狀態""" self.upload = UploadFile( 'document/ipBlockManagement.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'ipBlockManagement.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.blockListManagement.ipCheckImportExcel(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉
def test_MemberImport_relatedApi_status_05(self): """驗證 會員匯入 - 上傳Excel 狀態""" self.upload = UploadFile( 'document/memberImport.xlsx', # 檔案路徑 'filebase', # 上傳欄位 'memberImport.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.memberImport.getExcelSum(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 實作關閉檔案物件方法
def test_SlideShow_relatedApi_status_05(self): """ 大圖輪播 - 上傳png圖檔 狀態""" self.upload = UploadFile( 'image/png/test_png.png', # 檔案路徑 'ImageFile', # 上傳欄位 'test_png.png' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() response_data = self.slideShow.UploadSlideShowImageV2(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file()
def test_GroupAccount_relatedApi_status_38(self): """驗證 公司入款帐户管理 - 更新圖片""" self.upload = UploadFile( 'image/png/groupAccount_api.png', # 檔案路徑 'qrCodeFile', # 上傳欄位 'groupAccount_api.png' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.groupAccount.updateImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file()
def test_DepositImport_baseApi_status_03(self): """優惠匯入 - 上傳Excel 狀態""" self.upload = UploadFile( 'document/depositImport-A.xlsx', # 檔案路徑 'filebase', # 上傳欄位 'depositImport-A.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.DepositImport.getExcelSum(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉檔案
def red_RedEnvelope_create(self): # 建立紅包活動 self.upload = UploadFile('document/red.xlsx', # 檔案路徑 'fileBase', # 上傳欄位 'red.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 startTime = (datetime.now() + timedelta(hours = -11.99)).strftime("%Y/%m/%d %H:%M:%S") # 開始時間-美東時間 endTime = (datetime.now() + timedelta(hours = +11)).strftime("%Y/%m/%d %H:%M:%S") # 結束時間 - 後天 data = {'Name': (None, 'QA_Revoke_redEnvelope'), 'Password': (None, master_config.Master_Password), 'StartTime': (None, startTime), # 有其他參數上傳用這種mode 'EndTime': (None, endTime), 'Description': (None, 'QA_automation'), self.upload.upload_name: ( self.upload.filename, self.upload.open_file, self.upload.file_type, {'Expires': '0'})} self.redEnvelopeManagement.addRedEnvelope(data)
def test_BlockListManagement_relatedApi_status_08(self): """驗證 封鎖名單管理- 銀行帳戶匯入範本上傳 狀態""" self.upload = UploadFile( 'document/bankAccountBlockManagement.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'bankAccountBlockManagement.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.blockListManagement.bankAccountImportExcel(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 # step 2:刪除匯入資料 data = {"take": 100, "skip": 0, "search": {"tab": "2"}} response_data = self.blockListManagement.bankAccountGetList(data) getId = response_data[1]['ReturnObject'][0]['Id'] data = [getId] self.blockListManagement.bankAccountDeleteBankBlocks(data)
def test_RedEnvelopeManagement_relatedApi_status_04(self): """ 紅包派送 - 紅包匯入 狀態 2019/12/03""" # 1205 self.upload = UploadFile('document/red.xlsx', # 檔案路徑 'fileBase', # 上傳欄位 'red.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 startTime = (datetime.now() + timedelta(hours = -11.99)).strftime("%Y/%m/%d %H:%M:%S") # 開始時間-美東時間 endTime = (datetime.now() + timedelta(hours = +11)).strftime("%Y/%m/%d %H:%M:%S") # 結束時間 - 後天 data = {'Name': (None, 'QA_automation_redEnvelope'), 'Password': (None, master_config.Master_Password), 'StartTime': (None, startTime), # 有其他參數上傳用這種mode 'EndTime': (None, endTime), 'Description': (None, 'QA_automation'), self.upload.upload_name: ( self.upload.filename, self.upload.open_file, self.upload.file_type, {'Expires': '0'})} response_data = self.redEnvelopeManagement.addRedEnvelope(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉
def test_MemberImport_relatedApi_status_06(self): """驗證 會員匯入 - 開始匯入 狀態""" self.upload = UploadFile( 'document/memberImport.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'memberImport.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = { 'password': (None, master_config.Master_Password), 'isFilterBank': (None, 'true'), # 有其他參數上傳用這種mode self.upload.upload_name: (self.upload.filename, self.upload.open_file, self.upload.file_type, { 'Expires': '0' }) } response_data = self.memberImport.submit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file()
def test_DepositImport_baseApi_status_04(self): """優惠匯入 - 優惠匯入-立刻 狀態""" # ReserveTime = (datetime.now() + timedelta(hours = 1)).strftime("%Y/%m/%d %H:%M:%S") # 設定一個小時後開始進行優惠匯入 # print(ReserveTime) self.upload = UploadFile( 'document/depositImport-A.xlsx', # 檔案路徑 'Filebase', # 上傳欄位 'depositImport-A.xlsx' # 上傳檔名 ) data = { 'password': (None, master_config.Master_Password), # 有其他參數上傳用這種mode self.upload.upload_name: (self.upload.filename, self.upload.open_file, self.upload.file_type, { 'Expires': '0' }) } response_data = self.DepositImport.submitDepositImport(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉
class LuckyWheelManagementBaseTest(unittest.TestCase): """ 幸运转盘 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.luckyWheelManagement = ActivityManagement.LuckyWheelManagement(self.__http) self.user.login() def tearDown(self): self.user.logout() def getId(self): # 取得Id data = {"Size": 100, "IsPending": True, "IsStart": True, "IsEnd": True} response_data = self.luckyWheelManagement.getEventList(data) Id = response_data[1]['Response'][0]['ID'] return Id @staticmethod def create_LuckyWheel_mode(mode): # 讀取系統檔案來決定獎品數量 BeginTime = (datetime.now() + timedelta(hours = -12)).strftime("%Y/%m/%d %H:%M:%S") EndTime = (datetime.now() + timedelta(hours = -11)).strftime("%Y/%m/%d %H:%M:%S") if mode == 6: data = {"Name": "QA_test", "Type": 0, "StartDate": BeginTime, "EndDate": EndTime, "RewardCount": mode, "EventDescription": "QA_automation", "RewardInfoList": [{"Type": "1", "Name": "A", "TypeDescription": "再来一次", "Probability": 10}, {"Type": "2", "Name": "B", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "3", "Name": "C", "TypeDescription": "奖品", "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "D", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 20}, {"Type": "2", "Name": "E", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 30}, {"Type": "1", "Name": "F", "TypeDescription": "再来一次", "Probability": 20}]} return data elif mode == 8: data = {"Name": "QA_test", "Type": 0, "StartDate": BeginTime, "EndDate": EndTime, "RewardCount": mode, "EventDescription": "QA_automation", "RewardInfoList": [{"Type": "1", "Name": "A", "TypeDescription": "再来一次", "Probability": 10}, {"Type": "2", "Name": "B", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "3", "Name": "C", "TypeDescription": "奖品", "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "D", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "E", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 30}, {"Type": "1", "Name": "F", "TypeDescription": "再来一次", "Probability": 20}, {"Type": "2", "Name": "G", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 5}, {"Type": "2", "Name": "H", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 5}, ]} return data elif mode == 10: data = {"Name": "QA_test", "Type": 0, "StartDate": BeginTime, "EndDate": EndTime, "RewardCount": mode, "EventDescription": "QA_automation", "RewardInfoList": [{"Type": "1", "Name": "A", "TypeDescription": "再来一次", "Probability": 10}, {"Type": "2", "Name": "B", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "3", "Name": "C", "TypeDescription": "奖品", "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "D", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "E", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "1", "Name": "F", "TypeDescription": "再来一次", "Probability": 10}, {"Type": "2", "Name": "G", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "H", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "I", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "J", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, ]} return data elif mode == 12: data = {"Name": "QA_test", "Type": 0, "StartDate": BeginTime, "EndDate": EndTime, "RewardCount": mode, "EventDescription": "QA_automation", "RewardInfoList": [{"Type": "1", "Name": "A", "TypeDescription": "再来一次", "Probability": 10}, {"Type": "2", "Name": "B", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "3", "Name": "C", "TypeDescription": "奖品", "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "D", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "2", "Name": "E", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 10}, {"Type": "1", "Name": "F", "TypeDescription": "再来一次", "Probability": 10}, {"Type": "2", "Name": "G", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 20}, {"Type": "2", "Name": "H", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 5}, {"Type": "2", "Name": "I", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 5}, {"Type": "2", "Name": "J", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 5}, {"Type": "2", "Name": "K", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 3}, {"Type": "2", "Name": "L", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 10, "Probability": 2}, ]} return data def test_LuckyWheelManagement_relatedApi_status_01(self): """驗證 幸运转盘 - 取得列表資料 頁面 狀態""" response_data = self.luckyWheelManagement.index({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_02(self): """驗證 幸运转盘 - 取得列表資料 狀態""" data = {"Size": 100, "IsPending": True, "IsStart": True, "IsEnd": True} response_data = self.luckyWheelManagement.getEventList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_03(self): """驗證 幸运转盘 - 取得入口圖片 狀態""" data = {"EventName": "LuckyWheelManagement"} response_data = self.luckyWheelManagement.getImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_04(self): """驗證 幸运转盘 - 預覽網址 狀態""" response_data = self.luckyWheelManagement.getPortalUrl({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_05(self): """驗證 幸运转盘 - 新增幸運輪盤 頁面 狀態""" response_data = self.luckyWheelManagement.createAndModify({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_06(self): """驗證 幸运转盘 - 取得獎品種類 狀態""" response_data = self.luckyWheelManagement.getRewardTypeList({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_07(self): """驗證 幸运转盘 - 取得幸運輪盤活動時間 狀態""" response_data = self.luckyWheelManagement.getEventList({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_08(self): """驗證 幸运转盘 - 上傳圖片 狀態""" self.upload = UploadFile('image/jpg/test_jpg.jpg', # 檔案路徑 'imageFile', # 上傳欄位 'test_jpg.jpg' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.luckyWheelManagement.uploadRewardImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉檔案 def test_LuckyWheelManagement_relatedApi_status_09(self): """驗證 幸运转盘 - 新增活動 狀態""" data = self.create_LuckyWheel_mode(self.config.LuckyWheel()) response_data = self.luckyWheelManagement.createNewEvent(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_10(self): """驗證 幸运转盘 - 幸運輪盤詳細頁面 狀態""" response_data = self.luckyWheelManagement.detail({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_11(self): """驗證 幸运转盘 - 幸運輪盤詳細資料 狀態""" Id = self.getId() data = {"EventID": Id} response_data = self.luckyWheelManagement.getEventDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_12(self): """驗證 幸运转盘 - 序號管理頁面 狀態""" response_data = self.luckyWheelManagement.serialNumber({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_13(self): """驗證 幸运转盘 - 序號管理名單 狀態""" Id = self.getId() data = {"eventID": Id, "skip": 0, "take": 100, "searchNumber": 'null'} response_data = self.luckyWheelManagement.getSerialNumberList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_14(self): """驗證 幸运转盘 - 產生序號 狀態""" Id = self.getId() BeginTime = (datetime.now() + timedelta(hours = -12)).strftime("%Y/%m/%d %H:%M:%S") EndTime = (datetime.now() + timedelta(hours = -11)).strftime("%Y/%m/%d %H:%M:%S") data = {"EventID": Id, "RaffleCount": 10, "UsageCount": 20, "StartDate": BeginTime, "EndDate": EndTime, "BatchCount": 10} response_data = self.luckyWheelManagement.createSerialNumber(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_15(self): """驗證 幸运转盘 - Portal 抽獎 狀態""" Id = self.getId() data = {"eventID": Id, "skip": 0, "take": 100} response_data = self.luckyWheelManagement.getSerialNumberList(data) # 1.查詢新增的序號 serialNumber = response_data[1]['Response'][0]['SerialNumber'] # 2.取得序號 self.portal = Portal_test() self.portal.luckyWheel(self.config.test_Member_config(), self.config.test_Password_config(), Id, serialNumber) newData = {"eventID": Id, "skip": 0, "take": 100} response_data = self.luckyWheelManagement.getSerialNumberList(newData) # 4.查詢已使用抽獎序號 validateData = response_data[1]['Response'][0]['UseRecordCount'] self.assertEqual(validateData, 1) def test_LuckyWheelManagement_relatedApi_status_16(self): """驗證 幸运转盘 - 匯出序號管理名單 狀態""" Id = self.getId() data = {"eventId": Id, "searchNumber": 'null'} response_data = self.luckyWheelManagement.exportExcel(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_17(self): """驗證 幸运转盘 - 中獎名單頁面 狀態""" response_data = self.luckyWheelManagement.rewardRecord({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_18(self): """驗證 幸运转盘 - 中獎名單 狀態""" Id = self.getId() data = {"EventID": Id, "Size": 100} response_data = self.luckyWheelManagement.getRewardRecord(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_19(self): """驗證 幸运转盘 - 派發獎勵 狀態""" Id = self.getId() data = {"EventID": Id, "Size": 100} response_data = self.luckyWheelManagement.getRewardRecord(data) eventId = response_data[1]['Response'][0]['EventID'] recordsIDs = response_data[1]['Response'][0]['ID'] data = {"eventID": eventId, "recordIDs": recordsIDs} response_data = self.luckyWheelManagement.sendRewards(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_20(self): """驗證 幸运转盘 - 中獎名單統計 狀態""" Id = self.getId() data = {"EventID": Id} response_data = self.luckyWheelManagement.getRewardStatistics(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_LuckyWheelManagement_relatedApi_status_21(self): """驗證 幸运转盘 - 立即下架 狀態""" Id = self.getId() data = {"EventID": Id} response_data = self.luckyWheelManagement.eventOff(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class DepositImportBaseTest(unittest.TestCase): """優惠匯入 - 相關 API 調用狀態""" def setUp(self): self.__http = HttpRequest() self.user = User(self.__http) self.DepositImport = account_management.DepositImport(self.__http) self.user.login() def test_DepositImport_baseApi_status_01(self): """優惠匯入 - 優惠匯入頁面 狀態""" response_data = self.DepositImport.index({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_DepositImport_baseApi_status_02(self): """優惠匯入 - 取得優惠匯入列表 狀態""" data = {"take": 100, "skip": 0} response_data = self.DepositImport.getList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_DepositImport_baseApi_status_03(self): """優惠匯入 - 上傳Excel 狀態""" self.upload = UploadFile( 'document/depositImport-A.xlsx', # 檔案路徑 'filebase', # 上傳欄位 'depositImport-A.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.DepositImport.getExcelSum(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉檔案 def test_DepositImport_baseApi_status_04(self): """優惠匯入 - 優惠匯入-立刻 狀態""" # ReserveTime = (datetime.now() + timedelta(hours = 1)).strftime("%Y/%m/%d %H:%M:%S") # 設定一個小時後開始進行優惠匯入 # print(ReserveTime) self.upload = UploadFile( 'document/depositImport-A.xlsx', # 檔案路徑 'Filebase', # 上傳欄位 'depositImport-A.xlsx' # 上傳檔名 ) data = { 'password': (None, master_config.Master_Password), # 有其他參數上傳用這種mode self.upload.upload_name: (self.upload.filename, self.upload.open_file, self.upload.file_type, { 'Expires': '0' }) } response_data = self.DepositImport.submitDepositImport(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 def test_DepositImport_baseApi_status_06(self): """優惠匯入 - 檢查沖銷 狀態""" data = {'take': 100, 'skip': 0} getList = self.DepositImport.getList(data) getId = getList[1]['Records'][0]['Id'] data = {'Id': getId} response_data = self.DepositImport.checkRevocation(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_DepositImport_baseApi_status_07(self): """優惠匯入 - 優惠沖銷 狀態""" data = {'take': 100, 'skip': 0} getList = self.DepositImport.getList(data) getId = getList[1]['Records'][0]['Id'] data = { 'password': master_config.Master_Password, 'portalMemo': '@QA_automation', 'memo': '@QA_automation', 'recordId': getId } response_data = self.DepositImport.revoke(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_DepositImport_baseApi_status_08(self): """優惠匯入 - 取得優惠沖銷詳細 狀態""" data = {'take': 100, 'skip': 0} getList = self.DepositImport.getList(data) getId = getList[1]['Records'][0]['Id'] data = {'Id': getId} response_data = self.DepositImport.getRevokeDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_DepositImport_baseApi_status_05(self): """優惠匯入 - 優惠匯入-預約時間 狀態""" ReserveTime = (datetime.now() + timedelta(hours=-11)).strftime( "%Y/%m/%d %H:%M:%S") # 設定一個小時後開始進行優惠匯入 # print(ReserveTime) self.upload = UploadFile( 'document/depositImport-B.xlsx', # 檔案路徑 'Filebase', # 上傳欄位 'depositImport-B.xlsx' # 上傳檔名 ) data = { 'password': (None, master_config.Master_Password), 'ReserveTime': (None, ReserveTime), # 有其他參數上傳用這種mode self.upload.upload_name: (self.upload.filename, self.upload.open_file, self.upload.file_type, { 'Expires': '0' }) } response_data = self.DepositImport.submitDepositImport(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() def test_DepositImport_baseApi_status_09(self): """優惠匯入 - 取消預約匯入 狀態""" data = {'take': 100, 'skip': 0} getList = self.DepositImport.getList(data) getId = getList[1]['Records'][0]['Id'] data = {'RecordId': getId} response_data = self.DepositImport.cancelReserveImport(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class GroupAccountBaseTest(unittest.TestCase): """ 公司入款帐户 - 相關 API 調用狀態""" def setUp(self): self.__http = HttpRequest() self.user = User(self.__http) self.groupAccount = system_management.GroupAccount(self.__http) self.user.login() def tearDown(self): self.user.logout() def GetNewGroupAccountId(self, PersonName): response_data = self.groupAccount.getList({}) for i in range(len(response_data[1]['Accounts'])): if response_data[1]['Accounts'][i]['PersonName'] == PersonName: get_id = response_data[1]['Accounts'][i]['Id'] return get_id def get_QRcode_Url(self): # 取得商戶的上傳URL self.upload = UploadFile( 'image/png/groupAccount.png', # 檔案路徑 'qrCodeFile', # 上傳欄位 'groupAccount.png' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.groupAccount.updateImage(data) self.upload.Close_file() return response_data[1]['QrCodeUrl'] def create_groupAccount(self, account_type): # 其他方式建立商戶 QRCodeUrl = self.get_QRcode_Url() data = { 'Type': account_type, 'PersonName': '@QA_automation-' + account_type, 'QRCodeUrlFile': { '$ngfBlobUrl': 'blob:http://master.fnjtd.com/' + self.user.info() }, 'Memo': '@QA_automation', 'AvailableMinutes': 1, 'MemberLevelSettingIds': [21], 'QRCodeUrl': QRCodeUrl } return data def test_GroupAccount_relatedApi_status_01(self): """驗證 公司入款帐户管理 - 取得頁面""" response_data = self.groupAccount.list({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_02(self): """驗證 公司入款帐户管理 - 取得公司入款帳戶列表""" response_data = self.groupAccount.getList({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_03(self): """驗證 公司入款帐户管理 - 取得所有公司入款帳戶類型""" response_data = self.groupAccount.getAllGroupAccountType({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_04(self): """驗證 公司入款帐户管理 - 取得新增頁面""" response_data = self.groupAccount.create({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_05(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶(微信支付)""" data = self.create_groupAccount('wechat') response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_06(self): """驗證 公司入款帐户管理 - 公司入款帳戶(微信支付)是否存在""" PersonName = '@QA_automation-wechat' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} Name = self.groupAccount.getDetail(data) self.assertEqual(Name[1]['Detail']['PersonName'], PersonName) def test_GroupAccount_relatedApi_status_07(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶(微信支付)""" PersonName = '@QA_automation-wechat' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_08(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶(支付寶)""" data = self.create_groupAccount('Alipay') response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_09(self): """驗證 公司入款帐户管理 - 公司入款帳戶(支付寶)是否存在""" PersonName = '@QA_automation-Alipay' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} Name = self.groupAccount.getDetail(data) self.assertEqual(Name[1]['Detail']['PersonName'], PersonName) def test_GroupAccount_relatedApi_status_10(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶(支付寶)""" PersonName = '@QA_automation-Alipay' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_11(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶(財付通)""" data = self.create_groupAccount('Tenpay') response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_12(self): """驗證 公司入款帐户管理 - 公司入款帳戶(財付通)是否存在""" PersonName = '@QA_automation-Tenpay' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} Name = self.groupAccount.getDetail(data) self.assertEqual(Name[1]['Detail']['PersonName'], PersonName) def test_GroupAccount_relatedApi_status_13(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶(財付通)""" PersonName = '@QA_automation-Tenpay' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_14(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶(QQ掃碼)""" data = self.create_groupAccount('QQWallet') response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_15(self): """驗證 公司入款帐户管理 - 公司入款帳戶(QQ掃碼)是否存在""" PersonName = '@QA_automation-QQWallet' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} Name = self.groupAccount.getDetail(data) self.assertEqual(Name[1]['Detail']['PersonName'], PersonName) def test_GroupAccount_relatedApi_status_16(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶(QQ掃碼)""" PersonName = '@QA_automation-QQWallet' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_17(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶(東京)""" data = self.create_groupAccount('JD') response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_18(self): """驗證 公司入款帐户管理 - 公司入款帳戶(東京)是否存在""" PersonName = '@QA_automation-JD' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} Name = self.groupAccount.getDetail(data) self.assertEqual(Name[1]['Detail']['PersonName'], PersonName) def test_GroupAccount_relatedApi_status_19(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶(東京)""" PersonName = '@QA_automation-JD' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_20(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶(銀聯)""" data = self.create_groupAccount('UnionPay') response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_21(self): """驗證 公司入款帐户管理 - 公司入款帳戶(銀聯)是否存在""" PersonName = '@QA_automation-UnionPay' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} Name = self.groupAccount.getDetail(data) self.assertEqual(Name[1]['Detail']['PersonName'], PersonName) def test_GroupAccount_relatedApi_status_22(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶(銀聯)""" PersonName = '@QA_automation-UnionPay' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_23(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶(百度)""" data = self.create_groupAccount('BaiduWallet') response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_24(self): """驗證 公司入款帐户管理 - 公司入款帳戶(百度)是否存在""" PersonName = '@QA_automation-BaiduWallet' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} Name = self.groupAccount.getDetail(data) self.assertEqual(Name[1]['Detail']['PersonName'], PersonName) def test_GroupAccount_relatedApi_status_25(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶(百度)""" PersonName = '@QA_automation-BaiduWallet' getId = self.GetNewGroupAccountId(PersonName) data = {"id": getId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_26(self): """驗證 公司入款帐户管理 - 新增公司入款帳戶""" data = { "Type": "General", "BankName": "API - 銀行", "PersonName": "API - 測試", "NetPoint": "吉林省松原市", "Account": "12345678987654321", "Memo": "新增測試", "AvailableMinutes": 20, "MemberLevelSettingIds": [21] } response_data = self.groupAccount.createSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_27(self): """驗證 公司入款帐户管理 - 廣播更新""" getId = self.GetNewGroupAccountId('API - 測試') data = {"id": getId} response_data = self.groupAccount.broadcastSumInfoUpdated(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_28(self): """驗證 公司入款帐户管理 - 確認 CDN 上 QRCode 圖片""" response_data = self.groupAccount.confirmAllCdnQrCodeImage({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_29(self): """驗證 公司入款帐户管理 - 停用公司入款帳戶""" getId = self.GetNewGroupAccountId('API - 測試') data = {"id": getId} response_data = self.groupAccount.disable(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_30(self): """驗證 公司入款帐户管理 - 啟用公司入款帳戶""" getId = self.GetNewGroupAccountId('API - 測試') data = {"id": getId} response_data = self.groupAccount.active(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_31(self): """驗證 公司入款帐户管理 - 取得詳細頁面""" response_data = self.groupAccount.detail({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_32(self): """驗證 公司入款帐户管理 - 取得公司入款帳戶詳細資料""" getId = self.GetNewGroupAccountId('API - 測試') data = {"id": getId} response_data = self.groupAccount.getDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_33(self): """驗證 公司入款帐户管理 - 取得修改頁面""" response_data = self.groupAccount.modify({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_34(self): """驗證 公司入款帐户管理 - 變更目前累積(調整)(歸零)""" getNewCreateGroupAccountId = self.GetNewGroupAccountId('API - 測試') data = {"Id": getNewCreateGroupAccountId, "targetNumber": 10} response_data = self.groupAccount.adjustSum(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_35(self): """驗證 公司入款帐户管理 - 更新有效分鐘數""" getNewCreateGroupAccountId = self.GetNewGroupAccountId('API - 測試') data = {"Id": getNewCreateGroupAccountId, "args": 10} response_data = self.groupAccount.updateAvailableMinutes(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_36(self): """驗證 公司入款帐户管理 - 修改公司入款帳戶詳細資料""" getNewCreateGroupAccountId = self.GetNewGroupAccountId('API - 測試') data = { "Id": getNewCreateGroupAccountId, "BankName": "API - 銀行-modify", "PersonName": "API - 測試 -modify", "NetPoint": "吉林省松原市", "Account": "12345678987654321", "IsDisabled": False, "Memo": "新增測試", "IsDeleted": False, "LevelSettings": [{ "Id": 21, "Name": "QA_Test" }], "Sum": 0, "Type": "General", "QRCodeUrl": None, "CdnIsValid": True, "AvailableMinutes": 20, "typeSetting": { "Key": "General", "Value": "ENUM_GroupAccountType_General", "PropertyList": [{ "Type": 1, "PropertyName": "BankName", "PropertyLangKey": "GROUPACCOUNT_Bank", "InputType": 1, "PlaceholderLangKey": "GROUPACCOUNT_BankPlaceHolder", "MaxLength": 50, "Required": True, "Sort": 1 }, { "Type": 1, "PropertyName": "PersonName", "PropertyLangKey": "PAYMENT_Payee", "InputType": 1, "PlaceholderLangKey": "GROUPACCOUNT_PayeePlaceHolder", "MaxLength": 50, "Required": True, "Sort": 2 }, { "Type": 1, "PropertyName": "NetPoint", "PropertyLangKey": "GROUPACCOUNT_BankBranch", "InputType": 1, "PlaceholderLangKey": "GROUPACCOUNT_BankBranchPlaceHolder", "MaxLength": 50, "Required": True, "Sort": 3 }, { "Type": 1, "PropertyName": "Account", "PropertyLangKey": "GROUPACCOUNT_BankAccount", "InputType": 1, "PlaceholderLangKey": "GROUPACCOUNT_BankAccountPlaceHolder", "MaxLength": 50, "Required": True, "Sort": 4 }, { "Type": 1, "PropertyName": "Memo", "PropertyLangKey": "MEMBERTRAN_ExportColumeNote", "InputType": 2, "PlaceholderLangKey": "", "MaxLength": 50, "Required": False, "Sort": 5 }], "isSelected": True }, "MemberLevelSettingIds": [21] } response_data = self.groupAccount.updateSubmit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_37(self): """驗證 公司入款帐户管理 - 刪除公司入款帳戶詳細資料""" getNewCreateGroupAccountId = self.GetNewGroupAccountId( 'API - 測試 -modify') data = {"id": getNewCreateGroupAccountId} response_data = self.groupAccount.delete(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GroupAccount_relatedApi_status_38(self): """驗證 公司入款帐户管理 - 更新圖片""" self.upload = UploadFile( 'image/png/groupAccount_api.png', # 檔案路徑 'qrCodeFile', # 上傳欄位 'groupAccount_api.png' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.groupAccount.updateImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file()
class RedEnvelopeManagementBaseTest(unittest.TestCase): """ 红包派送 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 參數設定 self.__http = HttpRequest() self.user = User(self.__http) self.redEnvelopeManagement = ActivityManagement.RedEnvelopeManagement(self.__http) self.user.login() self.portal = Portal_test() def tearDown(self): self.user.logout() def red_RedEnvelope_create(self): # 建立紅包活動 self.upload = UploadFile('document/red.xlsx', # 檔案路徑 'fileBase', # 上傳欄位 'red.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 startTime = (datetime.now() + timedelta(hours = -11.99)).strftime("%Y/%m/%d %H:%M:%S") # 開始時間-美東時間 endTime = (datetime.now() + timedelta(hours = +11)).strftime("%Y/%m/%d %H:%M:%S") # 結束時間 - 後天 data = {'Name': (None, 'QA_Revoke_redEnvelope'), 'Password': (None, master_config.Master_Password), 'StartTime': (None, startTime), # 有其他參數上傳用這種mode 'EndTime': (None, endTime), 'Description': (None, 'QA_automation'), self.upload.upload_name: ( self.upload.filename, self.upload.open_file, self.upload.file_type, {'Expires': '0'})} self.redEnvelopeManagement.addRedEnvelope(data) def getId(self): data = {"take": 100, "skip": 0, "search": {}, 'connectionId': self.user.info() } response_data = self.redEnvelopeManagement.getList(data) return response_data[1]['ReturnObject'][0]['Id'] def end_redEnvelope(self): # 先沖銷紅包 data = {"take": 100, "skip": 0, "search": {}, 'connectionId': self.user.info()} response_data = self.redEnvelopeManagement.getList(data) for i in range(len(response_data[1])): if response_data[1]['ReturnObject'][i]['Name'] == 'QA_automation_redEnvelope' and \ response_data[1]['ReturnObject'][i]['Status'] == 2: data = {"Id": response_data[1]['ReturnObject'][i]['Id']} self.redEnvelopeManagement.suspendActivity(data) def test_RedEnvelopeManagement_Get_List_Data(self): """驗證 红包派送 - 取得列表資料""" data = {"take": 100, "skip": 0, "search": {}, 'connectionId': self.user.info()} response_data = self.redEnvelopeManagement.getList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_RedEnvelopeManagement_relatedApi_status_02(self): """驗證 红包派送 - 取得狀態資料 """ response_data = self.redEnvelopeManagement.getAllStatus({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_RedEnvelopeManagement_relatedApi_status_03(self): """驗證 红包派送 - 詳細資料""" Id = self.getId() data = {"id": Id} response_data = self.redEnvelopeManagement.get_detail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_RedEnvelopeManagement_relatedApi_status_04(self): """ 紅包派送 - 紅包匯入 狀態 2019/12/03""" # 1205 self.upload = UploadFile('document/red.xlsx', # 檔案路徑 'fileBase', # 上傳欄位 'red.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 startTime = (datetime.now() + timedelta(hours = -11.99)).strftime("%Y/%m/%d %H:%M:%S") # 開始時間-美東時間 endTime = (datetime.now() + timedelta(hours = +11)).strftime("%Y/%m/%d %H:%M:%S") # 結束時間 - 後天 data = {'Name': (None, 'QA_automation_redEnvelope'), 'Password': (None, master_config.Master_Password), 'StartTime': (None, startTime), # 有其他參數上傳用這種mode 'EndTime': (None, endTime), 'Description': (None, 'QA_automation'), self.upload.upload_name: ( self.upload.filename, self.upload.open_file, self.upload.file_type, {'Expires': '0'})} response_data = self.redEnvelopeManagement.addRedEnvelope(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 def test_RedEnvelopeManagement_relatedApi_status_05(self): """紅包派送 - 更新備註 狀態 2020/02/21""" Id = self.getId() data = {"Id": Id, "NewValue": "@QA_automation_Import-redEnvelope"} response_data = self.redEnvelopeManagement.updateMemo(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_RedEnvelopeManagement_relatedApi_status_06(self): """紅包派送 - 立即中止紅包 狀態 2020/02/21""" Id = self.getId() data = {"Id": Id} SetDelayTime() response_data = self.redEnvelopeManagement.suspendActivity(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_RedEnvelopeManagement_relatedApi_status_07(self): """紅包派送 - 沖銷紅包 狀態 """ # step 1:先沖銷自動化測試產生的紅包 self.end_redEnvelope() # step 2:匯入紅包->手機領取->驗證紅包 self.red_RedEnvelope_create() # 匯入紅包 SetDelayTime() Id = self.getId() # 取得ID response_result = self.portal.RedEnvelope_Received(self.config.test_Member_config(), self.config.test_Password_config(), Id) # 領取紅包 SetDelayTime() if response_result: data = {"Id": Id, "RevokePortalMemo": "@QA_automation-RevokeRedEnvelope", "Password": master_config.Master_Password} self.redEnvelopeManagement.revoke(data) data = {"id": Id} response_data = self.redEnvelopeManagement.get_detail(data) revoke_member_count = 1 # 預計會員沖銷人數1人 self.assertEqual(revoke_member_count, response_data[1]['ReturnObject']['MemberCount'], '會員領錯紅包,請先將紅包都結束') elif response_result == '會員沒有領到紅包': self.assertNotEqual(response_result, '會員沒有領到紅包', '會員沒有領到紅包')
class SlideShowBaseTest(unittest.TestCase): """ 大圖輪播 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.slideShow = PortalManagement.SlideShow(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() def tearDown(self): self.user.logout() def getWebsiteId(self): response_data = self.PortalManagement.getWebsiteList({}) for i in range(len(response_data[1]['ReturnObject'])): if self.config.siteName_config( ) == response_data[1]['ReturnObject'][i]['Name']: Id = response_data[1]['ReturnObject'][i]['Id'] return Id def test_SlideShow_relatedApi_status_01(self): """ 大圖輪播 - 取得電腦版資訊 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "1"} response_data = self.slideShow.GetSlideShowInfo(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SlideShow_relatedApi_status_02(self): """ 大圖輪播 - 取得手機版資訊 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "2"} response_data = self.slideShow.GetSlideShowInfo(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SlideShow_relatedApi_status_03(self): """ 大圖輪播 - 取得橫向手機版資訊 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "3"} response_data = self.slideShow.GetSlideShowInfo(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SlideShow_relatedApi_status_04(self): """ 大圖輪播 - 上傳jpg圖檔 狀態""" self.upload = UploadFile( 'image/jpg/test_jpg.jpg', # 檔案路徑 'ImageFile', # 上傳欄位 'test_jpg.jpg' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() response_data = self.slideShow.UploadSlideShowImageV2(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() def test_SlideShow_relatedApi_status_05(self): """ 大圖輪播 - 上傳png圖檔 狀態""" self.upload = UploadFile( 'image/png/test_png.png', # 檔案路徑 'ImageFile', # 上傳欄位 'test_png.png' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() response_data = self.slideShow.UploadSlideShowImageV2(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() def test_SlideShow_relatedApi_status_06(self): """ 大圖輪播 - 上傳gif圖檔 狀態""" sleep(5) self.upload = UploadFile( 'image/gif/test_gif.gif', # 檔案路徑 'ImageFile', # 上傳欄位 'test_gif.gif' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() response_data = self.slideShow.UploadSlideShowImageV2(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() def test_SlideShow_relatedApi_status_07(self): """ 大圖輪播 - 電腦版更新大圖輪播 狀態""" data = { "currentWebsiteId": self.getWebsiteId(), "currentDevice": "1", "currentSlideShowItems": [{ "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/88b73347665e41048daa90f5d8fa8140.jpg", "link": "", "sort": 0 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/1848916a567847a88b3ed5d763acb701.jpg", "link": "", "sort": 1 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/63e11f4c2a5d4f03a6e85eca762e73eb.jpg", "link": "", "sort": 2 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/1cc66874bf72401b9e6960f52eba55d2.jpg", "link": "", "sort": 3 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/50ccb91baa274a20845043cf34adb33e.jpg", "link": "", "sort": 4 }], "copyToSlideShowItems": [] } response_data = self.slideShow.SaveSlideShowChangesV2(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SlideShow_relatedApi_status_08(self): """ 大圖輪播 - 手機版更新大圖輪播 狀態""" data = { "currentWebsiteId": self.getWebsiteId(), "currentDevice": 2, "currentSlideShowItems": [{ "url": "/Cdn2Redirect/PortalManagement/Image/SlideShow/de0d274c32a44975b0cc60c1104513d2.png", "link": "", "sort": 0 }], "copyToSlideShowItems": [] } response_data = self.slideShow.SaveSlideShowChangesV2(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SlideShow_relatedApi_status_09(self): """ 大圖輪播 - 橫向手機版更新大圖輪播 狀態""" data = { "currentWebsiteId": self.getWebsiteId(), "currentDevice": 3, "currentSlideShowItems": [{ "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/c3e3294d56fb4bc3bdce68db3fb9f145.gif", "link": "", "sort": 0 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/69d4ed6d057e40eda901a43451087541.jpg", "link": "", "sort": 1 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/394da2470f244c8d8cea390826646c26.png", "link": "", "sort": 2 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/017cf1efd91e4379a3a0a6667406b1ff.png", "link": "", "sort": 3 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/8bb52541b5c94ca38b75640baf720042.jpg", "link": "", "sort": 4 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/fb3ed80d1f164a4a8f58e965855365f4.jpg", "link": "", "sort": 5 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/a18a7b57bc5b487b8228a4a5f97990b8.jpg", "link": "", "sort": 6 }, { "url": "/Cdn2Redirect/PortalManagement/AB005/SlideShow/b67e897370cb492a8e8dd528a8444c01.jpg", "link": "", "sort": 7 }], "copyToSlideShowItems": [] } response_data = self.slideShow.SaveSlideShowChangesV2(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class MemberImportBaseTest(unittest.TestCase): """會員匯入 - 相關 API 調用狀態""" def setUp(self): self.__http = HttpRequest() self.user = User(self.__http) self.memberImport = member_and_agent.MemberImport(self.__http) self.user.login() def tearDown(self): self.user.logout() def test_MemberImport_relatedApi_status_01(self): """驗證 會員匯入 - 會員匯入頁面 狀態""" response_data = self.memberImport.index({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberImport_relatedApi_status_02(self): """驗證 會員匯入 - 會員匯入紀錄 狀態""" response_data = self.memberImport.getRecord({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberImport_relatedApi_status_03(self): """驗證 會員匯入 - 確認是否有會員匯入 狀態""" response_data = self.memberImport.checkHasMemberImporting({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberImport_relatedApi_status_04(self): """驗證 會員匯入 - 下載範本 狀態""" response_data = self.memberImport.downloadExample({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberImport_relatedApi_status_05(self): """驗證 會員匯入 - 上傳Excel 狀態""" self.upload = UploadFile( 'document/memberImport.xlsx', # 檔案路徑 'filebase', # 上傳欄位 'memberImport.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.memberImport.getExcelSum(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 實作關閉檔案物件方法 def test_MemberImport_relatedApi_status_06(self): """驗證 會員匯入 - 開始匯入 狀態""" self.upload = UploadFile( 'document/memberImport.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'memberImport.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = { 'password': (None, master_config.Master_Password), 'isFilterBank': (None, 'true'), # 有其他參數上傳用這種mode self.upload.upload_name: (self.upload.filename, self.upload.open_file, self.upload.file_type, { 'Expires': '0' }) } response_data = self.memberImport.submit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file()
class MissionRewardBaseTest(unittest.TestCase): """ 任务挑战 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.missionReward = ActivityManagement.MissionReward(self.__http) self.user.login() def tearDown(self): self.user.logout() def getId(self): data = {"take": 100, "skip": 0, "search": {}} response_data = self.missionReward.getList(data) return response_data[1][0]['Id'] @classmethod def Master_login(cls): cls.__http = HttpRequest() cls.user = User(cls.__http) cls.thirdPartyPayment = account_management.ThirdPartyPayment( cls.__http) cls.user.login() def create_missionReward(self, mode): self.upload = UploadFile('image/jpg/test_jpg.jpg', 'ImageFile', 'test_jpg.jpg') data = self.upload.Upload_file() response_data = self.missionReward.uploadImage(data) self.upload.Close_file() self.system = system_config_Setting() BeginTime = (datetime.now() + timedelta(hours=-12)).strftime("%Y/%m/%d %H:%M:%S") EndTime = (datetime.now() + timedelta(hours=-11)).strftime("%Y/%m/%d %H:%M:%S") receiveBonusLimitTime = (datetime.now() + timedelta(hours=+12)).strftime( "%Y/%m/%d %H:%M:%S") # 領獎 if mode == 1: data = { "taskCount": 1, "activityStartTime": BeginTime, "item": [{ "title": "A", "type": 2, "img": { "$ngfBlobUrl": "blob:" + self.config.Master_config() + '/' }, "setting": 1, "bonus": 1, "auditTimes": 1, "imgStatus": 2, "imgErrorMsg": "", "imageUrl": response_data[1]['ReturnObject'], "errorFile": 'null', "category": 'null', "categoryFullName": 'null', "gameCategoryPropertyNames": 'null' }], "name": "QA_Test", "activityEndTime": EndTime, "receiveBonusLimitTime": receiveBonusLimitTime, "receiveBonusDays": 1, "registerStartTime": "", "registerEndTime": "", "completeBonus": 1, "completeAuditTimes": 1, "memberLevelSettingIds": [self.system.getMemberLevelId()] } return data def test_MissionReward__relatedApi_status_01(self): """驗證 任务挑战 - 取得列表資料""" data = {"take": 100, "skip": 0, "search": {}} response_data = self.missionReward.getList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MissionReward__relatedApi_status_02(self): """驗證 任务挑战 - 取得任務種類 狀態""" response_data = self.missionReward.getConditionType({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MissionReward__relatedApi_status_03(self): """驗證 任务挑战 - 上傳任務圖片 狀態""" self.upload = UploadFile('image/jpg/test_jpg.jpg', 'ImageFile', 'test_jpg.jpg') data = self.upload.Upload_file() response_data = self.missionReward.uploadImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() def test_MissionReward__relatedApi_status_04(self): """驗證 任务挑战 - 新增任務挑戰 狀態""" data = self.create_missionReward(1) response_data = self.missionReward.create(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MissionReward__relatedApi_status_05(self): """驗證 任务挑战 - 任務詳細資料 狀態""" Id = self.getId() data = {"Id": Id} response_data = self.missionReward.getDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MissionReward__relatedApi_status_06(self): """驗證 任务挑战 - 修改領獎期限 狀態""" Id = self.getId() NewTime = (datetime.now() + timedelta(hours=+12)).strftime( "%Y/%m/%d %H:%M:%S") # 領獎 data = {"Id": Id, "NewTime": NewTime} response_data = self.missionReward.updateReceiveBonusLimitTime(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MissionReward__relatedApi_status_07(self): """驗證 任务挑战 - 取得任務挑戰名稱 狀態""" Id = self.getId() data = {"Id": Id} response_data = self.missionReward.getEventName(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MissionReward__relatedApi_status_08(self): """驗證 任务挑战 - 取得任務挑戰參與名單 狀態""" Id = self.getId() data = {"id": Id, "take": 100, "skip": 0, "search": {}} response_data = self.missionReward.getJoinList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MissionReward__relatedApi_status_09(self): """驗證 任务挑战 - Portal任務挑戰 狀態""" self.portal = Portal_test() self.portal.OnlineDeposit_Create_V2(self.config.test_Member_config(), self.config.test_Password_config()) self.portal.OnlineDeposit_Send_V2(self.config.test_Member_config(), self.config.test_Password_config()) MissionRewardBaseTest.Master_login() # 線上支付看板-同意 data = {"count": 25, "query": {"isDTPP": 'true', "search": 'null'}} response_data = self.thirdPartyPayment.load_new(data) getId = response_data[1]['Data'][0]['Id'] data = {'id': getId} self.thirdPartyPayment.allow_dTPP_manual(data) Id = self.getId() validateData = self.portal.MissionReward( self.config.test_Member_config(), self.config.test_Password_config(), Id) self.assertEqual(validateData, True) def test_MissionReward__relatedApi_status_10(self): """驗證 任务挑战 - 立即下架 狀態""" Id = self.getId() NewEndTime = (datetime.now() + timedelta(hours=-12)).strftime( "%Y/%m/%d %H:%M:%S") # 領獎 data = {"Id": Id, "NewEndTime": NewEndTime} response_data = self.missionReward.eventOff(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class NewLuckyWheelBaseTest(unittest.TestCase): """ 时来运转 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.newLuckyWheel = ActivityManagement.NewLuckyWheel(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() def tearDown(self): self.user.logout() def create_NewLuckyWheel_mode(self, mode): # 讀取系統檔案來決定獎品數量 self.system = system_config_Setting() self.gameHall = GameHallType() BeginTime = (datetime.now() + timedelta(hours=-12)).strftime("%Y/%m/%d %H:%M:%S") EndTime = (datetime.now() + timedelta(hours=-11)).strftime("%Y/%m/%d %H:%M:%S") if mode == 6: data = { "RewardInfoList": [{ "status": 2, "RewardType": "1", "RewardTitle": "A", "RewardName": "1st", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "再来一次", "Probability": 10 }, { "status": 2, "RewardType": "2", "RewardTitle": "B", "RewardName": "2nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 11, "Probability": 50 }, { "status": 2, "RewardType": "3", "RewardTitle": "C", "RewardName": "3nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖品", "Stock": 1, "Probability": 10 }, { "status": 2, "RewardType": "2", "RewardTitle": "D", "RewardName": "4th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "谢谢参与" }, { "status": 2, "RewardType": "2", "RewardTitle": "E", "RewardName": "5th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "F", "RewardName": "6th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }], "RewardCount": mode, "BeginTime": BeginTime, "DailyOpenTimes": [], "LotterySettings": [{ "DepositAmount": 1, "GameCategories": self.gameHall.GameCategories(), "categoriesText": "(全选)", "CommissionAmount": 1, "LotteryCount": 1, "isInsert": 'true' }], "Name": 'QA_test', "EndTime": EndTime, "EntranceVisible": 'true', "LotteryBaseCount": 5, "DepositType": 1, "MemberLevelIds": [self.system.getMemberLevelId()], "Description": "<p>@QA_automation</p>\n" } return data elif mode == 8: data = { "RewardInfoList": [{ "status": 2, "RewardType": "1", "RewardTitle": "A", "RewardName": "1st", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "再来一次", "Probability": 10 }, { "status": 2, "RewardType": "2", "RewardTitle": "B", "RewardName": "2nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 11, "Probability": 30 }, { "status": 2, "RewardType": "3", "RewardTitle": "C", "RewardName": "3nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖品", "Stock": 1, "Probability": 10 }, { "status": 2, "RewardType": "2", "RewardTitle": "D", "RewardName": "4th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "E", "RewardName": "5th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "F", "RewardName": "6th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "G", "RewardName": "7th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "H", "RewardName": "8th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }], "RewardCount": mode, "BeginTime": BeginTime, "DailyOpenTimes": [], "LotterySettings": [{ "DepositAmount": 1, "GameCategories": self.gameHall.GameCategories(), "categoriesText": "(全选)", "CommissionAmount": 1, "LotteryCount": 1, "isInsert": 'true' }], "Name": "QA_test", "EndTime": EndTime, "EntranceVisible": 'true', "LotteryBaseCount": 5, "DepositType": 1, "MemberLevelIds": [self.system.getMemberLevelId()], "Description": "<p>@QA_automation</p>\n" } return data elif mode == 10: data = { "RewardInfoList": [{ "status": 2, "RewardType": "1", "RewardTitle": "A", "RewardName": "1st", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "再来一次", "Probability": 10 }, { "status": 2, "RewardType": "2", "RewardTitle": "B", "RewardName": "2nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 11, "Probability": 10 }, { "status": 2, "RewardType": "3", "RewardTitle": "C", "RewardName": "3nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖品", "Stock": 1, "Probability": 10 }, { "status": 2, "RewardType": "2", "RewardTitle": "D", "RewardName": "4th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "E", "RewardName": "5th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "F", "RewardName": "6th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "G", "RewardName": "7th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "H", "RewardName": "8th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "I", "RewardName": "9th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "J", "RewardName": "10th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }], "RewardCount": mode, "BeginTime": BeginTime, "DailyOpenTimes": [], "LotterySettings": [{ "DepositAmount": 1, "GameCategories": self.gameHall.GameCategories(), "categoriesText": "(全选)", "CommissionAmount": 1, "LotteryCount": 1, "isInsert": 'true' }], "Name": "QA_test", "EndTime": EndTime, "EntranceVisible": 'true', "LotteryBaseCount": 5, "DepositType": 1, "MemberLevelIds": [self.system.getMemberLevelId()], "Description": "<p>@QA_automation</p>\n" } return data elif mode == 12: data = { "RewardInfoList": [{ "status": 2, "RewardType": "1", "RewardTitle": "A", "RewardName": "1st", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "再来一次", "Probability": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "B", "RewardName": "2nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖金", "Price": 1, "Audit": 1, "Stock": 11, "Probability": 19 }, { "status": 2, "RewardType": "3", "RewardTitle": "C", "RewardName": "3nd", "ImageUrl": '', "uploadImgErrorMessage": "", "TypeDescription": "奖品", "Stock": 1, "Probability": 10 }, { "status": 2, "RewardType": "2", "RewardTitle": "D", "RewardName": "4th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "E", "RewardName": "5th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "F", "RewardName": "6th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 10, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "G", "RewardName": "7th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 20, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "H", "RewardName": "8th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 5, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "I", "RewardName": "9th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 5, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "J", "RewardName": "10th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 5, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "K", "RewardName": "11th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 3, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }, { "status": 2, "RewardType": "2", "RewardTitle": "L", "RewardName": "12th", "ImageUrl": '', "uploadImgErrorMessage": "", "Probability": 2, "TypeDescription": "奖金", "Stock": 1, "Price": 1, "Audit": 1 }], "RewardCount": mode, "BeginTime": BeginTime, "DailyOpenTimes": [], "LotterySettings": [{ "DepositAmount": 1, "GameCategories": self.gameHall.GameCategories(), "categoriesText": "(全选)", "CommissionAmount": 1, "LotteryCount": 1, "isInsert": 'true' }], "Name": "QA_test", "EndTime": EndTime, "EntranceVisible": 'true', "LotteryBaseCount": 5, "DepositType": 1, "IsShowRewardRecord": 'true', "MemberLevelIds": [self.system.getMemberLevelId()], "Description": "<p>@QA_automation</p>\n" } return data def getLuckyWheelId(self): data = { "skip": 0, "take": 100, "search": { "AllState": False, "Status": [0, 1] } } response_data = self.newLuckyWheel.getList(data) print(response_data) for i in range(len(response_data[1]['ReturnObject'])): if response_data[1]['ReturnObject'][i]['Name'] == 'QA_test': Id = response_data[1]['ReturnObject'][i]['Id'] return Id def test_NewLuckyWheelBaseTest_relatedApi_status_01(self): """驗證 时来运转 - 取得列表資料""" data = { "skip": 0, "take": 100, "search": { "AllState": True, "Status": [0, 1, 2] } } response_data = self.newLuckyWheel.getList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_02(self): """驗證 时来运转 - 取得入口圖片""" data = {"EventName": "NewLuckyWheel"} response_data = self.newLuckyWheel.getImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_03(self): """驗證 时来运转 - 更新入口圖片""" data = { "EventName": "NewLuckyWheel", "WebImageUrl": "/CdnRedirect/Web.Portal/_Common/Content/Views/Shared/images/Service/NewLuckyWheel.gif", "WebIsShow": 'true', "MobileImageUrl": "/CdnRedirect/Web.Mobile/_Common/Content/Views/Shared/images/Service/NewLuckyWheel.gif", "MobileIsShow": 'true' } response_data = self.newLuckyWheel.updateEntranceImage(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_04(self): """驗證 时来运转 - 更新入口圖片""" self.upload = UploadFile('image/jpg/test_jpg.jpg', 'ImageFile', 'test_jpg.jpg') data = self.upload.Upload_file() response_data = self.newLuckyWheel.uploadImages(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() def test_NewLuckyWheelBaseTest_relatedApi_status_05(self): """驗證 时来运转 - 預覽Portal""" response_data = self.newLuckyWheel.getPortalUrl({}) status_code = response_data[0] self.assertEqual( bool(status_code == common_config.Status_Code), bool(self.config.Portal_config() + '/' == response_data[1]['PortalUrl'])) def test_NewLuckyWheelBaseTest_relatedApi_status_06(self): """驗證 时来运转 - 取得全時來運轉時間列表""" response_data = self.newLuckyWheel.getAllLuckyWheelTimeList({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_07(self): """驗證 时来运转 - 取得獎勵列表""" response_data = self.newLuckyWheel.getRewardTypeList({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_08(self): """驗證 时来运转 - 新增時來運轉""" data = self.create_NewLuckyWheel_mode(self.config.NewLuckyWheel()) response_data = self.newLuckyWheel.create(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_09(self): """驗證 时来运转 - 取得時來運轉詳細資料 狀態""" # step1:取得詳細資料Id Id = self.getLuckyWheelId() data = {"luckyWheelId": Id} response_data = self.newLuckyWheel.getDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) # def test_NewLuckyWheelBaseTest_relatedApi_status_10(self): # """驗證 时来运转 - 修改時來運轉 狀態""" # Id = self.getLuckyWheelId() # data = {"luckyWheelId": Id} # response_data = self.newLuckyWheel.getDetail(data) # BeginTime = (datetime.now() + timedelta(hours = -12)).strftime("%Y/%m/%d %H:%M:%S") # EndTime = (datetime.now() + timedelta(hours = -11)).strftime("%Y/%m/%d %H:%M:%S") # luckyWheelInfo = response_data[1]['ReturnObject'] # # luckyWheelInfo['BeginTime'] = BeginTime # # luckyWheelInfo['EndTime'] = EndTime # luckyWheelInfo['MemberLevelIds'] = [luckyWheelInfo['MemberLevels'][0]['Id']] # # print(luckyWheelInfo) # data = {"luckyWheelInfo": luckyWheelInfo, 'luckyWheelId': Id} # response_data = self.newLuckyWheel.modifyLuckyWheelInfo(data) # status_code = response_data[0] # self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_11(self): """驗證 时来运转 - Portal時來運轉 狀態""" sleep(60) Id = self.getLuckyWheelId() self.portal = Portal_test() validateData = self.portal.newLuckyWheel( self.config.test_Member_config(), self.config.test_Password_config(), Id) self.assertEqual(validateData, True) def test_NewLuckyWheelBaseTest_relatedApi_status_12(self): """驗證 时来运转 - 剩餘抽獎次數名單 狀態""" Id = self.getLuckyWheelId() data = {"luckyWheelId": Id, "take": 25, "skip": 0} response_data = self.newLuckyWheel.joinMemberDetailList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_13(self): """驗證 时来运转 - 匯出剩餘抽獎次數名單 狀態""" Id = self.getLuckyWheelId() data = {"luckyWheelId": Id} response_data = self.newLuckyWheel.exportMemberLuckyDrawCount(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_14(self): """驗證 时来运转 - 添加次數 狀態""" Id = self.getLuckyWheelId() data = { "luckyWheelId": Id, "accounts": self.config.test_Member_config(), "count": 10 } response_data = self.newLuckyWheel.manualSupply(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_15(self): """驗證 时来运转 - 抽獎名單-取得時來運轉名字 狀態""" Id = self.getLuckyWheelId() data = {"luckyWheelId": Id} response_data = self.newLuckyWheel.getNewLuckyWheelName(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_16(self): """驗證 时来运转 - 抽獎名單-取得中獎名單 狀態""" Id = self.getLuckyWheelId() data = { "search": { "RewardStatus": [0, 1], "RewardTypes": ["0", "1", "2", "3"] }, "luckyWheelId": Id, "skip": 0, "take": 100 } response_data = self.newLuckyWheel.getRewardRecords(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_17(self): """驗證 时来运转 - 抽獎名單-派發獎品獎金 狀態""" Id = self.getLuckyWheelId() data = { "search": { "RewardStatus": [0, 1], "RewardTypes": ["2", "3"] }, "luckyWheelId": Id, "skip": 0, "take": 100 } response_data = self.newLuckyWheel.getRewardRecords(data) sentRewardId = response_data[1]['ReturnObject'][0]['Id'] data = {"luckyWheelId": Id, "recordIds": sentRewardId} response_data = self.newLuckyWheel.sendRewards(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_18(self): """驗證 时来运转 - 抽獎名單-總抽獎次數 狀態""" Id = self.getLuckyWheelId() data = { "search": { "RewardStatus": [0, 1], "RewardTypes": ["0", "1", "2", "3"] }, "luckyWheelId": Id } response_data = self.newLuckyWheel.getCalculationCount(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_19(self): """驗證 时来运转 - 抽獎名單-中獎統計圖 狀態""" Id = self.getLuckyWheelId() data = {"luckyWheelId": Id} response_data = self.newLuckyWheel.getRewardStatistics(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_20(self): """驗證 时来运转 - 中獎人名單開關 狀態""" Id = self.getLuckyWheelId() data = {"luckyWheelId": Id, "isShow": 'true'} response_data = self.newLuckyWheel.modifyShowRewardRecord(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_NewLuckyWheelBaseTest_relatedApi_status_21(self): """驗證 时来运转 - 立即下架 狀態""" Id = self.getLuckyWheelId() data = {"luckyWheelId": Id} response_data = self.newLuckyWheel.luckyWheelOff(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class BlockListManagementBaseTest(unittest.TestCase): """封鎖名單管理 - 相關 API 調用狀態""" def setUp(self): self.__http = HttpRequest() self.user = User(self.__http) self.blockListManagement = system_management.BlockListManagement( self.__http) self.user.login() def tearDown(self): self.user.logout() def test_BlockListManagement_relatedApi_status_01(self): """驗證 封鎖名單管理-取得銀行帳戶列表 狀態""" data = {"take": 100, "skip": 0, "search": {"tab": "2"}} response_data = self.blockListManagement.bankAccountGetList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_02(self): """驗證 封鎖名單管理-取得銀行列表 狀態""" response_data = self.blockListManagement.bankAccountGetGroupBank({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_03(self): """驗證 封鎖名單管理-匯出銀行封鎖名單Excel 狀態""" response_data = self.blockListManagement.bankAccountExportExcel({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_04(self): """驗證 封鎖名單管理-新增銀行帳戶封鎖名單 狀態""" data = { "bankName": "农业银行", "bankAccount": "123456", "memo": "@QA_automation" } response_data = self.blockListManagement.bankAccountAddBankAccountBlockInfo( data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_05(self): """驗證 封鎖名單管理-刪除銀行帳戶封鎖名單 狀態""" data = {"take": 100, "skip": 0, "search": {"tab": "2"}} response_data = self.blockListManagement.bankAccountGetList(data) getId = response_data[1]['ReturnObject'][0]['Id'] data = [getId] response_data = self.blockListManagement.bankAccountDeleteBankBlocks( data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_06(self): """驗證 封鎖名單管理-下載銀行帳戶匯入範本 狀態""" response_data = self.blockListManagement.bankAccountDownloadSampleExcel( {}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_07(self): """驗證 封鎖名單管理-檢查銀行帳戶匯入範本上傳 狀態""" self.upload = UploadFile( 'document/bankAccountBlockManagement.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'bankAccountBlockManagement.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.blockListManagement.bankAccountCheckImportExcel( data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 def test_BlockListManagement_relatedApi_status_08(self): """驗證 封鎖名單管理- 銀行帳戶匯入範本上傳 狀態""" self.upload = UploadFile( 'document/bankAccountBlockManagement.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'bankAccountBlockManagement.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.blockListManagement.bankAccountImportExcel(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 # step 2:刪除匯入資料 data = {"take": 100, "skip": 0, "search": {"tab": "2"}} response_data = self.blockListManagement.bankAccountGetList(data) getId = response_data[1]['ReturnObject'][0]['Id'] data = [getId] self.blockListManagement.bankAccountDeleteBankBlocks(data) def test_BlockListManagement_relatedApi_status_09(self): """驗證 封鎖名單管理-取得IP列表 狀態""" data = {"take": 100, "skip": 0, "search": {"tab": "1"}} response_data = self.blockListManagement.ipGetList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_10(self): """驗證 封鎖名單管理-匯出銀IP鎖名單Excel 狀態""" response_data = self.blockListManagement.ipExportExcel({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_11(self): """驗證 封鎖名單管理-新增IP封鎖名單 狀態""" data = {"ipv4": "127.0.0.1", "memo": "@QA_automation"} response_data = self.blockListManagement.ipAddIPBlockInfo(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_12(self): """驗證 封鎖名單管理-刪除銀行帳戶封鎖名單 狀態""" data = {"take": 100, "skip": 0, "search": {"tab": "1"}} response_data = self.blockListManagement.ipGetList(data) getId = response_data[1]['ReturnObject'][0]['Id'] data = [getId] response_data = self.blockListManagement.ipDeleteIPBlocks(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_13(self): """驗證 封鎖名單管理-檢查IP匯入範本上傳 狀態""" self.upload = UploadFile( 'document/ipBlockManagement.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'ipBlockManagement.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.blockListManagement.ipCheckImportExcel(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 def test_BlockListManagement_relatedApi_status_14(self): """驗證 封鎖名單管理- IP匯入範本上傳 狀態""" self.upload = UploadFile( 'document/ipBlockManagement.xlsx', # 檔案路徑 'importFile', # 上傳欄位 'ipBlockManagement.xlsx' # 上傳檔名 ) # 先實例上傳檔案物件 data = self.upload.Upload_file() # 實作上傳檔案物件方法 response_data = self.blockListManagement.ipImportExcel(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 # step 2:刪除匯入資料 data = {"take": 100, "skip": 0, "search": {"tab": "1"}} response_data = self.blockListManagement.ipGetList(data) getId = response_data[1]['ReturnObject'][0]['Id'] data = [getId] self.blockListManagement.ipDeleteIPBlocks(data) def test_BlockListManagement_relatedApi_status_15(self): """驗證 封鎖名單管理- 取得國別阻擋名單 狀態""" response_data = self.blockListManagement.getCountrySetting({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_16(self): """驗證 封鎖名單管理- 取得白名單IP名單 狀態""" response_data = self.blockListManagement.getWhiteListSetting({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_17(self): """驗證 封鎖名單管理- 更新國別阻擋名單 狀態""" data = {"blockedCountryList": []} response_data = self.blockListManagement.updateCountryBlockSetting( data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_18(self): """驗證 封鎖名單管理- 檢查新增白名單IP 狀態""" data = {"ip": "127.0.0.1"} response_data = self.blockListManagement.checkWhiteIpWhenAdd(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BlockListManagement_relatedApi_status_19(self): """驗證 封鎖名單管理- 更新白名單IP 狀態""" data = { "whiteListSettings": [ "211.23.116.131", "118.163.212.115", "211.23.224.148", "59.125.28.220", "111.11.15.2", "113.141.163.16", "211.22.163.139" ], "whiteListMemos": [ "菲律宾代理ABIN办公室", "菲律宾代理ASA办公室", "", "业务使用", "", "陝西02", "MIS+Infra辦公室" ] } response_data = self.blockListManagement.updateWhiteListSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class MemberBatchBaseTest(unittest.TestCase): """會員批次 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.agentDetail = member_and_agent.AgentDetail(self.__http) self.memberBatch = member_and_agent.MemberBatch(self.__http) self.user.login() def tearDown(self): self.user.logout() def getDiscountSettingId(self): response_data = self.agentDetail.getAllDiscountSettings({}) for i in range(len(response_data[1])): if self.config.DiscountSetting_2_config( ) == response_data[1][i]['Text']: Id = response_data[1][i]['Value'] return Id def test_MemberBatch_relatedApi_status_01(self): """驗證 會員批次 - 匯入大量帳號 狀態""" self.upload = UploadFile('document/memberSearchBatch.xlsx', 'filename', 'memberSearchBatch.xlsx') data = self.upload.Upload_file() response_data = self.memberBatch.importAndGetLargeAccount(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) self.upload.Close_file() # 關閉 def test_MemberBatch_relatedApi_status_02(self): """驗證 會員批次 - 會員批次頁面 狀態""" response_data = self.memberBatch.batch_page({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_03(self): """驗證 會員批次 - 清除樣板 狀態 """ # 不確定 response_data = self.memberBatch.clearTemp({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_04(self): """驗證 會員批次 - 取得會員狀態 狀態""" response_data = self.memberBatch.getMemberStates({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_05(self): """驗證 會員批次 - 批次會員資料 狀態""" data = { 'search': { 'Account': self.config.test_Member_config() }, 'take': 3000, 'skip': 0, 'isSuper': 'false' } response_data = self.memberBatch.getBatchData(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_06(self): """驗證 會員批次 - 強制取回餘額寶 狀態""" data = { 'search': { 'Account': self.config.test_Member_config() }, 'isSuper': 'false', 'batchParam': { 'isAll': 'true' } } response_data = self.memberBatch.batchWithdrawYuebao(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_07(self): """驗證 會員批次 - 批次修改會員狀態 狀態""" data = { 'search': { 'Account': self.config.batch_Member_config() }, 'isSuper': 'false', 'batchParam': { 'isAll': 'true' }, "newState": "1" } response_data = self.memberBatch.batchUpdateMemberState(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_08(self): """驗證 會員批次 - 批次修改會員等級 狀態""" data = { 'search': { 'Account': self.config.batch_Member_config() }, 'isSuper': 'false', 'batchParam': { 'isAll': 'true' }, 'levelId': self.getDiscountSettingId() } response_data = self.memberBatch.batchUpdateMemberLevel(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_09(self): """驗證 會員批次 - 批次時時歸水歸零 狀態""" data = { 'search': { 'Account': self.config.batch_Member_config() }, 'isSuper': 'false', 'batchParam': { 'isAll': 'true' }, 'password': master_config.Master_Password } response_data = self.memberBatch.anyTimeDiscountBatchReset(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_10(self): """驗證 會員批次 - 批次人工存入 狀態""" # Step1 先從人工存入取得 Token self.memberDeposit = member_and_agent.MemberDeposit(self.__http) depositToken = self.memberDeposit.deposit_token({}) # Step2 使用批次人工存入 data = { 'search': { 'Account': self.config.batch_Member_config() }, 'isSuper': 'false', 'batchParam': { 'isAll': 'true' }, 'depositParams': { 'AuditType': 'None', 'Type': 4, 'DepositToken': depositToken[1], 'Amount': 0.1, 'Memo': '@0.1', 'PortalMemo': '@0.1', 'Password': master_config.Master_Password, 'AmountString': '0.1', 'TimeStamp': time.time() } } response_data = self.memberBatch.depositSubmitForMemberBatchDeposit( data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_11(self): """驗證 會員批次 - 批次修改會員標籤 狀態""" # Step1 批次修改會員標籤 data = { 'search': { 'Account': self.config.batch_Member_config() }, 'isSuper': 'false', 'batchParam': { 'isAll': 'true' }, 'newTags': [self.config.batchTag_config()], 'addTagIds': [], 'deleteTagIds': [] } response_data = self.memberBatch.batchAddOrDeleteMemberTags(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) # Step2 驗證更改完畢後刪除標籤 # 呼叫取得會員標籤 API 後取最後一筆資料 self.memberTags = member_and_agent.MemberTags(self.__http) getMemberTagsData = self.memberTags.getTags({}) for i in range(len(getMemberTagsData[1]['ReturnObject'])): if getMemberTagsData[1]['ReturnObject'][i][ 'Name'] == self.config.batchTag_config(): self.getTagsId = getMemberTagsData[1]['ReturnObject'][i]['Id'] data = { 'search': { 'MemberTagIds': self.getTagsId }, 'isSuper': 'false', 'batchParam': { 'isAll': 'true' }, 'newTags': [], 'addTagIds': [], 'deleteTagIds': [self.getTagsId] } self.memberBatch.batchAddOrDeleteMemberTags(data) def test_MemberBatch_relatedApi_status_12(self): """驗證 會員批次 - 批次更新簡訊驗證 狀態""" # Step1 批次修改簡訊驗證 data = { "search": { 'Account': self.config.batch_Member_config() }, "isSuper": 'false', "batchParam": { "isAll": 'true' }, "isEnable": 'false' } response_data = self.memberBatch.batchUpdateMemberSmsValidation(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_13(self): """驗證 會員批次 - 批次更新電子郵件驗證 狀態""" # Step1 批次修改電子郵件驗證 data = { "search": { 'Account': self.config.batch_Member_config() }, "isSuper": 'false', "batchParam": { "isAll": 'true' }, "isEnable": 'false' } response_data = self.memberBatch.batchUpdateMemberEmailValidation(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_14(self): """驗證 會員批次 - 批次停用二次驗證 狀態""" data = { "search": { 'Account': self.config.batch_Member_config() }, "isSuper": 'false', "batchParam": { "isAll": 'true' }, "isEnable": 'false' } response_data = self.memberBatch.batchDisableMemberGoogleAuthenticator( data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_MemberBatch_relatedApi_status_15(self): """驗證 會員批次 - 批次停用裝置驗證 狀態""" data = { "search": { 'Account': self.config.batch_Member_config() }, "isSuper": 'false', "batchParam": { "isAll": 'true' }, "isEnable": 'false' } response_data = self.memberBatch.batchDisableMemberGpkAuthenticator( data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)