def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.registerCopyWriting = PortalManagement.RegisterCopywriting(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login()
def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.siteParameter = PortalManagement.MobileMenu(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login()
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 setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.AnnouncementManagement = PortalManagement.AnnouncementManagement(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login()
def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.discount = account_management.Discount(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login()
class RegisterCopyWritingBaseTest(unittest.TestCase): """ 會員註冊文案 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.registerCopyWriting = PortalManagement.RegisterCopywriting(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 getOtherWebsiteId(self): response_data = self.PortalManagement.getWebsiteList({}) for i in range(len(response_data[1]['ReturnObject'])): if self.config.other_Website_config() == response_data[1]['ReturnObject'][i]['Name']: Id = response_data[1]['ReturnObject'][i]['Id'] return Id def test_ModifyRegisterCopywriting_relatedApi_status_01(self): """ 會員註冊文案 - 取得文案 狀態""" data = {"WebsiteId": self.getWebsiteId()} response_data = self.registerCopyWriting.GetRegisterCopywriting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_ModifyRegisterCopywriting_relatedApi_status_02(self): """ 會員註冊文案 - 修改文案 狀態""" # 直接取得文案 data = {"WebsiteId": self.getWebsiteId()} response_data = self.registerCopyWriting.GetRegisterCopywriting(data) getCopyWriting = response_data[1]['Copywriting'] getAgreementSetting = response_data[1]['AgreementSetting'] data = {"websiteId": self.getWebsiteId(), "copywriting": getCopyWriting, "agreementSetting": getAgreementSetting} response_data = self.registerCopyWriting.ModifyRegisterCopywriting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_ModifyRegisterCopywriting_relatedApi_status_03(self): """ 會員註冊文案 - 複製到其他網站 狀態""" data = {"FromWebsiteId": self.getWebsiteId(), "ToWebsiteIdList": [self.getOtherWebsiteId()]} response_data = self.registerCopyWriting.CopyRegisterCopywriting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
def getWebsiteId(cls): cls.config = systemSetting() cls.__http = HttpRequest() cls.user = User(cls.__http) cls.AnnouncementManagement = PortalManagement.AnnouncementManagement( cls.__http) cls.PortalManagement = PortalManagement(cls.__http) cls.user.login() response_data = cls.PortalManagement.getWebsiteList({}) for i in range(len(response_data[1]['ReturnObject'])): if cls.config.siteName_config( ) == response_data[1]['ReturnObject'][i]['Name']: Id = response_data[1]['ReturnObject'][i]['Id'] return Id
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 setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.home = Home(self.__http) self.siteParameter = PayoutMerchantManagement(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login()
def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.home = Home(self.__http) self.siteParameter = GPKRewardRecords(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login()
class PortalManagementBaseTest(unittest.TestCase): """ 網站版面 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.siteParameter = PortalManagement.PortalManagement(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() # 登出 def tearDown(self): self.user.logout() # 取站台ID 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_GetProductSetting_relatedApi_status_01(self): """ 網站版面 - 取得網站版面獲取產品設置 電腦&直向&橫向 狀態""" ID = self.getWebsiteId() deviceType = [1, 2, 3] for x in deviceType: data = {"device": x, "websiteId": ID} response_data = self.siteParameter.GetProductSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SaveProductSetting_relatedApi_status_02(self): """ 網站版面 - 修改標題名稱&前台顯示站名 電腦&直向&橫向 狀態""" ID = self.getWebsiteId() menu = random.randint(1, 50) deviceType = [1, 2, 3] for i in deviceType: data = { "websiteId": ID, "device": i, "titleName": "Stage 测试站" + str(menu), "portalSiteName": "Stage 测试站" + str(menu) } response_data = self.siteParameter.SaveProductSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class SiteParameterBaseTest(unittest.TestCase): """ 財務中心 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.siteParameter = PortalManagement.FinanceCenter(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() # 登出 def tearDown(self): self.user.logout() # 取站台ID 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 getType(self, Hdata): response_data = self.siteParameter.GetFinanceCenterSubCategory(Hdata) return response_data def test_GetFinanceCenterSubCategory_relatedApi_status_01(self): """ 財務中心 - 取得財務中心目前列表 直向&橫向 狀態""" ID = self.getWebsiteId() deviceType = [2, 3] for x in deviceType: data = {"websiteId": ID, "device": x} response_data = self.siteParameter.GetFinanceCenterSubCategory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GetOnlinePaymentDirectSetting_relatedApi_status_02(self): """ 財務中心 - 取得財務中心取得裝置種類狀態 直向&橫向 狀態""" ID = self.getWebsiteId() deviceType = [2, 3] for x in deviceType: data = {"websiteId": ID, "deviceType": x} response_data = self.siteParameter.GetOnlinePaymentDirectSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GetFinanceCenterDetailSetting_relatedApi_status_03(self): """ 財務中心 - 取得財務中心詳細資料列表狀態 直向&橫向 狀態""" ID = self.getWebsiteId() deviceType = [2, 3] for x in deviceType: data = {"websiteId": ID, "device": x} response_data = self.siteParameter.GetFinanceCenterDetailSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateFinanceCenterSubCategory_relatedApi_status_04(self): """ 財務中心 - 修改推廣圖標文字狀態 直向 狀態""" menu = random.randint(1, 50) Type_data = [] ID = self.getWebsiteId() Hdata = {"websiteId": ID, "device": "2"} TData = self.getType(Hdata) for i in range(len(TData[1]['ReturnObject'])): x = TData[1]['ReturnObject'][i] del x['WebSiteId'] del x['Device'] Type_data.append(x) Type_data[0]['RecommendTitle'] = '自動化' + str(menu) data = { "websiteId": ID, "device": "2", "financeCenterTypeList": Type_data } response_data = self.siteParameter.UpdateFinanceCenterSubCategory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateFinanceCenterSubCategory_relatedApi_status_05(self): """ 財務中心 - 修改推廣內容狀態 直向 狀態""" menu = random.randint(1, 50) Type_data = [] ID = self.getWebsiteId() Hdata = {"websiteId": ID, "device": "2"} TData = self.getType(Hdata) for i in range(len(TData[1]['ReturnObject'])): x = TData[1]['ReturnObject'][i] del x['WebSiteId'] del x['Device'] Type_data.append(x) Type_data[0]['RecommendContent'] = '這是個測試推廣內容的文字數:' + str(menu) data = { "websiteId": ID, "device": "2", "financeCenterTypeList": Type_data } response_data = self.siteParameter.UpdateFinanceCenterSubCategory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateFinanceCenterSubCategory_relatedApi_status_06(self): """ 財務中心 - 修改推廣圖標文字狀態 橫向 狀態""" menu = random.randint(1, 50) Type_data = [] ID = self.getWebsiteId() Hdata = {"websiteId": ID, "device": "3"} TData = self.getType(Hdata) for i in range(len(TData[1]['ReturnObject'])): x = TData[1]['ReturnObject'][i] del x['WebSiteId'] del x['Device'] Type_data.append(x) Type_data[0]['RecommendTitle'] = '自動化' + str(menu) data = { "websiteId": ID, "device": "3", "financeCenterTypeList": Type_data } response_data = self.siteParameter.UpdateFinanceCenterSubCategory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateFinanceCenterSubCategory_relatedApi_status_07(self): """ 財務中心 - 修改推廣內容狀態 橫向 狀態""" menu = random.randint(1, 50) Type_data = [] ID = self.getWebsiteId() Hdata = {"websiteId": ID, "device": "3"} TData = self.getType(Hdata) for i in range(len(TData[1]['ReturnObject'])): x = TData[1]['ReturnObject'][i] del x['WebSiteId'] del x['Device'] Type_data.append(x) Type_data[0]['RecommendContent'] = '這是個測試推廣內容的文字數:' + str(menu) data = { "websiteId": ID, "device": "3", "financeCenterTypeList": Type_data } response_data = self.siteParameter.UpdateFinanceCenterSubCategory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateFinanceCenterSubCategory_relatedApi_status_08(self): """ 財務中心 - 公司入款顯示關閉 狀態""" Type_data = [] ID = self.getWebsiteId() Hdata = {"websiteId": ID, "device": "2"} TData = self.getType(Hdata) for i in range(len(TData[1]['ReturnObject'])): x = TData[1]['ReturnObject'][i] del x['WebSiteId'] del x['Device'] Type_data.append(x) Type_data[0]['IsOpen'] = 'false' data = { "websiteId": ID, "device": "2", "financeCenterTypeList": Type_data } response_data = self.siteParameter.UpdateFinanceCenterSubCategory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateFinanceCenterSubCategory_relatedApi_status_09(self): """ 財務中心 - 公司入款顯示開啟 狀態""" Type_data = [] ID = self.getWebsiteId() Hdata = {"websiteId": ID, "device": "2"} TData = self.getType(Hdata) for i in range(len(TData[1]['ReturnObject'])): x = TData[1]['ReturnObject'][i] del x['WebSiteId'] del x['Device'] Type_data.append(x) Type_data[0]['IsOpen'] = 'True' data = { "websiteId": ID, "device": "2", "financeCenterTypeList": Type_data } response_data = self.siteParameter.UpdateFinanceCenterSubCategory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class MobileThemeManagementBaseTest(unittest.TestCase): """ 主題設置 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.siteParameter = PortalManagement.MobileTheme(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() # 登出 def tearDown(self): self.user.logout() # 取站台ID 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 getThemeId(self, ID, databool): data = {"WebSiteId": ID, "IsHorizontal": databool} response_data = self.siteParameter.GetMobileTheme(data) ThemeId = response_data[1]['ReturnObject']['ThemeList'][0]['ThemeId'] return ThemeId def getMobileThemeSettingId(self, ID, databool): data = {"WebSiteId": ID, "IsHorizontal": databool} index = {"ThemeId": "", "ThemeName": ""} response_data = self.siteParameter.GetMobileTheme(data) for i in range( len(response_data[1]['ReturnObject']['ThemeList'][0] ['ColorCollection'])): index["ThemeId"] = response_data[1]['ReturnObject']['ThemeList'][ 0]['ColorCollection'][i]['MobileThemeSettingId'] index["ThemeName"] = response_data[1]['ReturnObject']['ThemeList'][ 0]['ColorCollection'][i]['Name'] return index def test_BeforeLoggingIn_relatedApi_status_01(self): """ 主題設置 - 獲取主題設置獲取手機域名 直向&橫向 狀態""" ID = self.getWebsiteId() IsHorizontalType = ["false", "true"] for i in IsHorizontalType: data = {"WebSiteId": ID, "IsHorizontal": i} response_data = self.siteParameter.GetMobileTheme(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_GetMobileTheme_relatedApi_status_02(self): """ 主題設置 - 獲取手機 - 色系列表 直向&橫向 狀態""" ID = self.getWebsiteId() IsHorizontalType = ["false", "true"] for i in IsHorizontalType: data = {"WebSiteId": ID, "IsHorizontal": i} response_data = self.siteParameter.GetMobileThemeDomain(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AddColor_relatedApi_status_03(self): """ 主題設置 - 新增另存色系tag 直向 狀態""" ID = self.getWebsiteId() ThemeId = self.getThemeId(ID, "false") data = { "WebsiteId": ID, "ColorName": "極緻黑", "NewColorCode": { "--login-bg": "#1C1717", "--login-color": "#ff3682", "--login-input-bg": "#ff8929", "--login-input-color": "#fff", "--login-btn-bg": "#ff3c6d", "--login-btn-color": "#fff", "--header-bg-top": "#fff", "--header-bg-bottom": "#d5d5d6", "--header-domain-color": "#1C1717", "--header-domain-color2": "#e83347", "--btn01-bg": "#ec692e", "--btn01-color": "#fff", "--btn02-bg": "#df3070", "--btn02-color": "#fff", "--news-bg": "#ea073f", "--news-color": "#fff", "--lobby-bg": "#fff", "--lobby-color": "#ea073f", "--lobby-color2": "#1C1717", "--game-bg": "#ea073f", "--game-color": "#fff", "--footer-bg-top": "#1C1717", "--footer-bg-bottom": "#cacacc", "--footer-color": "#1C1717", "--footer-line": "#ddd", "--profile-bg": "#fff", "--profile-color": "#ea073f", "--nav-bg": "#ea073f", "--nav-color": "#fff", "--nav-color2": "#f6527a", "--page-title-bg": "#5a158c", "--page-title-color": "#fff", "--content-bg": "#fff", "--content-color": "#000", "--content-color2": "#fe0095", "--promo-btn-bg": "#df3070", "--promo-btn-color": "#fff", "--promo-title-bg": "#ea073f", "--promo-title-color": "#fff", "--promo-content-bg": "#fff", "--promo-content-color": "#5a158c" }, "ThemeId": ThemeId, "IsHorizontal": "false" } response_data = self.siteParameter.AddColor(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AddColor_relatedApi_status_04(self): """ 主題設置 - 新增另存色系tag 橫向 狀態""" ID = self.getWebsiteId() ThemeId = self.getThemeId(ID, "true") data = { "WebsiteId": ID, "ColorName": "極緻黑橫向版", "NewColorCode": { "--primary-bg": "#18204e", "--primary-light-bg": "#18204e", "--primary-dark-bg": "#3a4278", "--primary-border": "#8e8bdc", "--table-border": "#334192", "--table-bg": "#13193d", "--text-color": "#fff", "--light-text-color": "#ff0", "--light-color": "#afbdff", "--title-top-bg": "#5e6ebc", "--title-bottom-bg": "#212c6d", "--btn01-top-bg": "#fffdf8", "--btn01-bottom-bg": "#d57d00", "--btn01-border": "#fff100", "--btn01-text-border": "#c37700", "--btn02-top-bg": "#b9e2f4", "--btn02-bottom-bg": "#8a77d5", "--btn02-border": "#e8c8f7", "--btn02-text-border": "#7261b4" }, "ThemeId": ThemeId, "IsHorizontal": "true" } response_data = self.siteParameter.AddColor(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateColorName_relatedApi_status_05(self): """ 主題設置 - 修改色系tag名稱 直向 狀態""" ID = self.getWebsiteId() nemu = self.getMobileThemeSettingId(ID, "false") data = { "MobileThemeSettingId": nemu["ThemeId"], "NewName": nemu["ThemeName"] + "1", "IsHorizontal": "false" } response_data = self.siteParameter.UpdateColorName(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_UpdateColorName_relatedApi_status_06(self): """ 主題設置 - 修改色系tag名稱 橫向 狀態""" ID = self.getWebsiteId() nemu = self.getMobileThemeSettingId(ID, "true") nemu["ThemeName"] = "咖啡色" data = { "MobileThemeSettingId": nemu["ThemeId"], "NewName": nemu["ThemeName"], "IsHorizontal": "true" } response_data = self.siteParameter.UpdateColorName(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_DeleteColor_relatedApi_status_07(self): """ 主題設置 - 刪除色系tag名稱 直向 狀態""" ID = self.getWebsiteId() ThemeId = self.getThemeId(ID, "false") nemu = self.getMobileThemeSettingId(ID, "false") data = { "WebsiteId": ID, "MobileThemeSettingId": nemu["ThemeId"], "ThemeId": ThemeId, "IsHorizontal": "false" } response_data = self.siteParameter.DeleteColor(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_DeleteColor_relatedApi_status_08(self): """ 主題設置 - 刪除色系tag名稱 橫向 狀態""" ID = self.getWebsiteId() ThemeId = self.getThemeId(ID, "true") nemu = self.getMobileThemeSettingId(ID, "true") data = { "WebsiteId": ID, "MobileThemeSettingId": nemu["ThemeId"], "ThemeId": ThemeId, "IsHorizontal": "true" } response_data = self.siteParameter.DeleteColor(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SaveMobileTheme_relatedApi_status_09(self): """ 主題設置 - 更換預設版型 - 切換D版 直向 狀態""" ID = self.getWebsiteId() ThemeId = self.getThemeId(ID, "false") data = { "WebsiteId": ID, # 站台id "ThemeId": ThemeId, # 預設版型id "MobileThemeSettingId": 1, # 色系 id "ColorCode": "null", "DefaultThemeTypeId": 5, # 1: 預設,2: A版 "DefaultMobileThemeSettingId": 5, "IsHorizontal": "false" } response_data = self.siteParameter.SaveMobileTheme(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SaveMobileTheme_relatedApi_status_10(self): """ 主題設置 - 更換預設版型 - 切換預設版 直向 狀態""" ID = self.getWebsiteId() ThemeId = self.getThemeId(ID, "false") data = { "WebsiteId": ID, # 站台id "ThemeId": ThemeId, # 預設版型id "MobileThemeSettingId": 1, # 色系 id "ColorCode": "null", "DefaultThemeTypeId": 1, # 1: 預設,5:D版 "DefaultMobileThemeSettingId": 1, "IsHorizontal": "false" } response_data = self.siteParameter.SaveMobileTheme(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SaveMobileTheme_relatedApi_status_11(self): """ 主題設置 - 更換版型 - 切換D版 直向 狀態""" ID = self.getWebsiteId() data = { "WebsiteId": ID, # 站台id "ThemeId": 5, # 預設版型id "MobileThemeSettingId": 2, # 色系 id "ColorCode": "null", "DefaultThemeTypeId": 1, # 1: 預設,5:D版 "DefaultMobileThemeSettingId": 1, "IsHorizontal": "false" } response_data = self.siteParameter.SaveMobileTheme(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_SaveMobileTheme_relatedApi_status_12(self): """ 主題設置 - 更換版型 - 切換預設 直向 狀態""" ID = self.getWebsiteId() data = { "WebsiteId": ID, # 站台id "ThemeId": 1, # 預設版型id "MobileThemeSettingId": 1, # 色系 id "ColorCode": "null", "DefaultThemeTypeId": 1, # 1: 預設,5:D版 "DefaultMobileThemeSettingId": 1, "IsHorizontal": "false" } response_data = self.siteParameter.SaveMobileTheme(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class AnnouncementManagementBaseTest(unittest.TestCase): """ 公告管理 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.AnnouncementManagement = PortalManagement.AnnouncementManagement(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 getOtherWebsiteId(self): response_data = self.PortalManagement.getWebsiteList({}) for i in range(len(response_data[1]['ReturnObject'])): if self.config.other_Website_config() == response_data[1]['ReturnObject'][i]['Name']: Id = response_data[1]['ReturnObject'][i]['Id'] return Id def getId(self, mode): data = {"WebsiteId": self.getWebsiteId(), "Device": mode} response_data = self.AnnouncementManagement.getAnnouncementList(data) Id = response_data[1]['List'][0]['Id'] return Id def updateMarqueeContent(self, mode): data = {"WebsiteId": self.getWebsiteId(), "Device": mode} response_data = self.AnnouncementManagement.getMarqueeContent(data) content = response_data[1]['ReturnObject'] data = {"WebsiteId": self.getWebsiteId(), "Device": mode, 'Content': content} return data def test_AnnouncementManagement_relatedApi_status_01(self): """ 公告管理-取得電腦版公告列表 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "1"} response_data = self.AnnouncementManagement.getAnnouncementList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_02(self): """ 公告管理-取得直向手機版公告列表 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "2"} response_data = self.AnnouncementManagement.getAnnouncementList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_03(self): """ 公告管理-取得橫向手機版公告列表 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "3"} response_data = self.AnnouncementManagement.getAnnouncementList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_04(self): """ 公告管理 - 檢查教程需要觀看 狀態""" data = {"tutorial": 1} response_data = self.AnnouncementManagement.checkTutorialNeedWatch(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_05(self): """ 公告管理-取得電腦版設定 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "1"} response_data = self.AnnouncementManagement.getAnnouncementSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_06(self): """ 公告管理-取得直向手機板設定 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "2"} response_data = self.AnnouncementManagement.getAnnouncementSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_07(self): """ 公告管理-取得橫向手機版設定 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "3"} response_data = self.AnnouncementManagement.getAnnouncementSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_08(self): """ 公告管理-更新電腦版設定 狀態""" data = { "WebsiteId": self.getWebsiteId(), "Device": "1", "PopupWhenChangedEnable": 'true', "PopupFrequencyEnable": 'true', "PopupFrequency": 1, "PopupHeader": "@QA_automation" + common_config.TodayDate, "PopupWhenRefreshPage": 'true', "NeedSynchronize": 'false' } response_data = self.AnnouncementManagement.updateAnnouncementSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_09(self): """ 公告管理-更新直向手機板設定 狀態""" data = { "WebsiteId": self.getWebsiteId(), "Device": "2", "PopupWhenChangedEnable": 'true', "PopupFrequencyEnable": 'true', "PopupFrequency": 1, "PopupHeader": "", "PopupWhenRefreshPage": 'true', "NeedSynchronize": 'false' } response_data = self.AnnouncementManagement.updateAnnouncementSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_10(self): """ 公告管理-更新橫向手機板設定 狀態""" data = { "WebsiteId": self.getWebsiteId(), "Device": "3", "PopupWhenChangedEnable": 'true', "PopupFrequencyEnable": 'true', "PopupFrequency": 1, "PopupHeader": "", "PopupWhenRefreshPage": 'true', "NeedSynchronize": 'false' } response_data = self.AnnouncementManagement.updateAnnouncementSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_11(self): """ 公告管理-新增電腦版公告 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "1", "Title": "@QA_automation_Portal", "Sort": 1, "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} response_data = self.AnnouncementManagement.addAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_12(self): """ 公告管理-新增直向手機板公告 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "2", "Title": "@QA_automation_Mobile", "Sort": 1, "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} response_data = self.AnnouncementManagement.addAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_13(self): """ 公告管理-新增橫向手機板公告 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "3", "Title": "@QA_automation_horizontalMobile", "Sort": 1, "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} response_data = self.AnnouncementManagement.addAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_14(self): """ 公告管理-取得電腦版公告詳細資料 狀態""" getId = self.getId(1) data = {"Id": getId} response_data = self.AnnouncementManagement.getAnnouncementDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_15(self): """ 公告管理-取得直向手機板公告詳細資料 狀態""" getId = self.getId(2) data = {"Id": getId} response_data = self.AnnouncementManagement.getAnnouncementDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_16(self): """ 公告管理-取得橫向手機板公告詳細資料 狀態""" getId = self.getId(3) data = {"Id": getId} response_data = self.AnnouncementManagement.getAnnouncementDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_17(self): """ 公告管理-修改電腦版公告 狀態""" getId = self.getId(1) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "1", "Title": "@QA_automation_Portal_Modify", "Sort": 1, "IsEnable": 'false', "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} response_data = self.AnnouncementManagement.modifyAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_18(self): """ 公告管理-修改手機版公告 狀態""" getId = self.getId(2) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "2", "Title": "@QA_automation_Mobile_Modify", "Sort": 1, "IsEnable": 'false', "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} response_data = self.AnnouncementManagement.modifyAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_19(self): """ 公告管理-修改橫向手機板公告 狀態""" getId = self.getId(3) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "3", "Title": "@QA_automation_horizontalMobile_Modify", "Sort": 1, "IsEnable": 'false', "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} response_data = self.AnnouncementManagement.modifyAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_20(self): """ 公告管理-修改電腦版啟用開關 狀態""" getId = self.getId(1) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "1", "IsEnable": 'true'} response_data = self.AnnouncementManagement.modifyAnnouncementEnable(data) status_code = response_data[0] data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "1", "IsEnable": 'false'} self.AnnouncementManagement.modifyAnnouncementEnable(data) self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_21(self): """ 公告管理-修改手機版啟用開關 狀態""" getId = self.getId(2) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "2", "IsEnable": 'true'} response_data = self.AnnouncementManagement.modifyAnnouncementEnable(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_22(self): """ 公告管理-修改橫向手機版啟用開關 狀態""" getId = self.getId(3) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "3", "IsEnable": 'true'} response_data = self.AnnouncementManagement.modifyAnnouncementEnable(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_23(self): """ 公告管理-移動公告一輪(Portal->Mobile->horizontal Mobile->Portal) 狀態""" getId = self.getId(1) data = {"WebsiteId": self.getWebsiteId(), "MoveIds": [getId], "FromDevice": "1", "ToDevice": 2} response_data = self.AnnouncementManagement.moveAnnouncementToDevice(data) status_code1 = response_data[0] data = {"WebsiteId": self.getWebsiteId(), "MoveIds": [getId], "FromDevice": "2", "ToDevice": 3} response_data = self.AnnouncementManagement.moveAnnouncementToDevice(data) status_code2 = response_data[0] data = {"WebsiteId": self.getWebsiteId(), "MoveIds": [getId], "FromDevice": "3", "ToDevice": 1} response_data = self.AnnouncementManagement.moveAnnouncementToDevice(data) status_code3 = response_data[0] self.assertEqual(bool(status_code1 == status_code2 == status_code3), True) def test_AnnouncementManagement_relatedApi_status_24(self): """ 公告管理-電腦版移動公告至其他站台 狀態""" getId = self.getId(1) data = {"FromWebsiteId": self.getWebsiteId(), "MoveIds": [getId], "Device": "1", "ToWebsiteId": self.getOtherWebsiteId()} response_data = self.AnnouncementManagement.moveAnnouncementToWebsite(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) data = {"WebsiteId": self.getWebsiteId(), "Device": "1", "Title": "@QA_automation_Portal", "Sort": 1, "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} self.AnnouncementManagement.addAnnouncement(data) def test_AnnouncementManagement_relatedApi_status_25(self): """ 公告管理-手機版移動公告至其他站台 狀態""" getId = self.getId(2) data = {"FromWebsiteId": self.getWebsiteId(), "MoveIds": [getId], "Device": "2", "ToWebsiteId": self.getOtherWebsiteId()} response_data = self.AnnouncementManagement.moveAnnouncementToWebsite(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) data = {"WebsiteId": self.getWebsiteId(), "Device": "2", "Title": "@QA_automation_Mobile", "Sort": 1, "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} self.AnnouncementManagement.addAnnouncement(data) def test_AnnouncementManagement_relatedApi_status_26(self): """ 公告管理-橫向手機版移動公告至其他站台 狀態""" getId = self.getId(3) data = {"FromWebsiteId": self.getWebsiteId(), "MoveIds": [getId], "Device": "3", "ToWebsiteId": self.getOtherWebsiteId()} response_data = self.AnnouncementManagement.moveAnnouncementToWebsite(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_27(self): """ 公告管理-電腦版複製公告到手機板 狀態""" getId = self.getId(1) data = {"WebsiteId": self.getWebsiteId(), "CopyIds": [getId], "FromDevice": "1", "ToDevice": 2} response_data = self.AnnouncementManagement.copyAnnouncementToDevice(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) getId = self.getId(2) data = {"WebsiteId": self.getWebsiteId(), "Device": "2", "DeleteIds": [getId]} self.AnnouncementManagement.deleteAnnouncement(data) def test_AnnouncementManagement_relatedApi_status_28(self): """ 公告管理-電腦版複製公告到橫向手機板 狀態""" getId = self.getId(1) data = {"WebsiteId": self.getWebsiteId(), "CopyIds": [getId], "FromDevice": "1", "ToDevice": 3} response_data = self.AnnouncementManagement.copyAnnouncementToDevice(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) getId = self.getId(3) data = {"WebsiteId": self.getWebsiteId(), "Device": "3", "DeleteIds": [getId]} self.AnnouncementManagement.deleteAnnouncement(data) def test_AnnouncementManagement_relatedApi_status_29(self): """ 公告管理-電腦版改順序 狀態""" getId = self.getId(1) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "1", "Sort": 2} response_data = self.AnnouncementManagement.modifyAnnouncementSort(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_30(self): """ 公告管理- 手機版改順序 狀態""" getId = self.getId(2) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "2", "Sort": 2} response_data = self.AnnouncementManagement.modifyAnnouncementSort(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_31(self): """ 公告管理-橫向手機版改順序 狀態""" getId = self.getId(3) data = {"Id": getId, "WebsiteId": self.getWebsiteId(), "Device": "3", "Sort": 2} response_data = self.AnnouncementManagement.modifyAnnouncementSort(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_32(self): """ 公告管理-刪除電腦版公告 狀態""" getId = self.getId(1) data = {"WebsiteId": self.getWebsiteId(), "Device": "1", "DeleteIds": [getId]} response_data = self.AnnouncementManagement.deleteAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_33(self): """ 公告管理-刪除手機版公告 狀態""" getId = self.getId(2) data = {"WebsiteId": self.getWebsiteId(), "Device": "2", "DeleteIds": [getId]} response_data = self.AnnouncementManagement.deleteAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_34(self): """ 公告管理-刪除橫向手機版公告 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "3", "Title": "@QA_automation_horizontalMobile", "Sort": 1, "Content": "<p>" "<img alt=\"\" src=\"https://www.itsfun.com.tw/cacheimg/84/ce/e2cecd886623d17eae7558a688ae.jpg\" />" "</p>\n", "ForGuest": 'true', "ForMember": 'true'} self.AnnouncementManagement.addAnnouncement(data) getId = self.getId(3) data = {"WebsiteId": self.getWebsiteId(), "Device": "3", "DeleteIds": [getId]} response_data = self.AnnouncementManagement.deleteAnnouncement(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_35(self): """ 公告管理-預覽公告 狀態""" data = {"WebsiteId": self.getWebsiteId(), "PreviewMode": 1} response_data = self.AnnouncementManagement.getAnnouncementPreviewList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_36(self): """ 公告管理-取得電腦版跑馬燈內容 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "1"} response_data = self.AnnouncementManagement.getMarqueeContent(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_37(self): """ 公告管理-取得手機版跑馬燈內容 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "2"} response_data = self.AnnouncementManagement.getMarqueeContent(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_38(self): """ 公告管理-取得橫向手機版跑馬燈內容 狀態""" data = {"WebsiteId": self.getWebsiteId(), "Device": "3"} response_data = self.AnnouncementManagement.getMarqueeContent(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_39(self): """ 公告管理-更新電腦版跑馬燈內容 狀態""" data = self.updateMarqueeContent(1) response_data = self.AnnouncementManagement.updateMarqueeContent(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_40(self): """ 公告管理-更新手機版跑馬燈內容 狀態""" data = self.updateMarqueeContent(2) response_data = self.AnnouncementManagement.updateMarqueeContent(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_41(self): """ 公告管理-更新橫向手機版跑馬燈內容 狀態""" data = self.updateMarqueeContent(3) response_data = self.AnnouncementManagement.updateMarqueeContent(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_AnnouncementManagement_relatedApi_status_42(self): """ 公告管理-更新公告設定 狀態""" WebsiteId = self.getWebsiteId() data = {"WebsiteId": WebsiteId, "Device": "1", "UpdateAnnouncementSettingList": [ {"SettingType": 1, "PopupWhenChangedEnable": 'true', "PopupFrequencyEnable": 'true', "PopupHeader": "公告", "PopupWhenRefreshPage": 'true', "NeedSynchronize": 'true'}, {"SettingType": 2, "PopupWhenChangedEnable": 'true', "PopupFrequencyEnable": 'true', "PopupHeader": 'null', "PopupWhenRefreshPage": 'true', "NeedSynchronize": 'true'}]} response_data = self.AnnouncementManagement.updateAnnouncementSetting(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class SiteParameterBaseTest(unittest.TestCase): """ 聯絡資訊 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.siteParameter = PortalManagement.SiteParameter(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_ModifyRegisterCopywriting_relatedApi_status_01(self): """ 聯絡資訊 - 取得聯絡資訊 狀態""" data = {"WebsiteId": self.getWebsiteId()} response_data = self.siteParameter.GetSiteParameter(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_ModifyRegisterCopywriting_relatedApi_status_02(self): """ 聯絡資訊 - 更新聯絡資訊 狀態""" data = { "WebsiteId": self.getWebsiteId(), "Parameters": [{ "Key": "Live800Link", "Value": "http://tw.yahoo.com", "Memo": "在线客服123" }, { "Key": "Live800LinkReview", "Value": "https://www.mobile01.com/", "Memo": "12test" }, { "Key": "Live800LinkComputer", "Value": "http://www.fnjtd.com/", "Memo": "" }, { "Key": "TEL", "Value": "123456", "Memo": "客服专线75435435" }, { "Key": "QQ", "Value": "40037457", "Memo": "QQ號碼http://wpa.qq.com/msgrd?v=3&uin=40037457&site=qq&menu=yes" }, { "Key": "Email", "Value": "http://www.google.com.tw", "Memo": "客服Email" }, { "Key": "Skype", "Value": "", "Memo": "Skype" }, { "Key": "OfficialEmail", "Value": "", "Memo": "" }, { "Key": "ComplaintsEmail", "Value": "", "Memo": "" }, { "Key": "ComplaintsTEL", "Value": "", "Memo": "" }, { "Key": "ComplaintsQQ", "Value": "9876543210", "Memo": "test" }, { "Key": "HttpWeibo", "Value": "", "Memo": "" }, { "Key": "HttpWhatsapp", "Value": "", "Memo": "" }, { "Key": "AgentQQ", "Value": "https://www.yahoo.com.tw", "Memo": "" }, { "Key": "PartnerQQ", "Value": "333", "Memo": "" }, { "Key": "Live800LinkAgent", "Value": "", "Memo": "" }, { "Key": "AgentLogin", "Value": "", "Memo": "" }, { "Key": "AgentEmail", "Value": "555", "Memo": "" }, { "Key": "AgentWechat", "Value": "", "Memo": "" }, { "Key": "AgentSkype", "Value": "", "Memo": "" }, { "Key": "Dialog", "Value": "https://cdn2.igsttech.com/Web.Portal/CJ001-01.Portal/Upload/Dialog/25.png", "Memo": "" }, { "Key": "DialogFooter", "Value": "<center>測試</center>", "Memo": "" }, { "Key": "DialogPage", "Value": "/test", "Memo": "/" }, { "Key": "DialogTitle", "Value": "<center>最新公告</center>", "Memo": "" }, { "Key": "HttpInformation", "Value": "20190515", "Memo": "" }, { "Key": "HttpMobileDeposit", "Value": "http://www.yahoo.com", "Memo": "線上存款" }, { "Key": "HttpMobilePromotion", "Value": "/HorizontalMobile/Promotion", "Memo": "" }, { "Key": "HttpVIP", "Value": "http://www.google.com.tw", "Memo": "VIP金管家 -- K版" }, { "Key": "HttpLive", "Value": "http://www.yahoo.com", "Memo": "真人金庫 -- K版" }, { "Key": "MobileDomain", "Value": "123456", "Memo": "" }, { "Key": "TestKey", "Value": "TestKey", "Memo": "145" }, { "Key": "HttpMobile2Deposit", "Value": "http://tw.yahoo.com", "Memo": "123" }, { "Key": "Skpye", "Value": "[email protected]", "Memo": "94 使該ㄆ" }, { "Key": "新的 KEY-1", "Value": "9999", "Memo": "" }] } response_data = self.siteParameter.UpdateSiteParameter(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
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 MobileMenuManagementBaseTest(unittest.TestCase): """ 選單管理 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.siteParameter = PortalManagement.MobileMenu(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() # 登出 def tearDown(self): self.user.logout() # 取站台ID 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_BeforeLoggingIn_relatedApi_status_01(self): """ 選單管理 - 取得選單管理登入前 狀態""" data = {"WebsiteId": self.getWebsiteId(), "device": "2"} response_data = self.siteParameter.GetList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BeforeLogin_relatedApi_status_02(self): """ 選單管理 - 取得選單管理登入前_詳細 狀態 """ data = {"device": "2"} response_data = self.siteParameter.GetDefaultList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BeforeLoggingIn_Horizontal_relatedApi_status_03(self): """ 選單管理 - 取得選單管理登入前_橫向 狀態""" data = {"WebsiteId": self.getWebsiteId(), "device": "3"} response_data = self.siteParameter.GetList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_BeforeLogin_relatedApi_Horizontal_status_04(self): """ 選單管理 - 取得選單管理登入前_橫向詳細 狀態 """ data = {"device": "3"} response_data = self.siteParameter.GetDefaultList(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_CopyMenu_relatedApi_status_05(self): """ 選單管理 - 複制功能_直向到橫向 狀態""" data = { "FromWebSiteId": self.getWebsiteId(), "CopyWebSiteIds": [], "FromDevice": 2, "ToDevice": 3 } response_data = self.siteParameter.CopyMenu(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_CopyMenu_relatedApi_status_06(self): """ 選單管理 - 複制功能_橫向到直向 狀態""" data = { "FromWebSiteId": self.getWebsiteId(), "CopyWebSiteIds": [], "FromDevice": 3, "ToDevice": 2 } response_data = self.siteParameter.CopyMenu(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class PromotionManagementBaseTest(unittest.TestCase): """ 優惠管理 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.siteParameter = PortalManagement.PromotionManage(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() # 登出 def tearDown(self): self.user.logout() # 取站台ID 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 # 取大分類sort + 1 def getSort(self, data): response_data = self.siteParameter.GetPromotions(data) item = len(response_data[1]['Categories']) + 1 return item # 取大分類id def getSortId(self, data): PromotionsID = [] response_data = self.siteParameter.GetPromotions(data) for i in range(len(response_data[1]['Categories'])): PromotionsID = response_data[1]['Categories'][i]['Id'] return PromotionsID # 取子分類ID def getSubcategoriesID(self, data): PromotionsID = [] response_data = self.siteParameter.GetPromotions(data) for i in range(len(response_data[1]['Categories'])): PromotionsID = response_data[1]['Categories'][i]['Id'] return PromotionsID # 取子子分類ID def getPromotionsID(self, data): PromotionsID = [] PID = [] response_data = self.siteParameter.GetPromotions(data) for i in range(len(response_data[1]['Categories'])): PromotionsID = response_data[1]['Categories'][i]['Promotions'] for x in PromotionsID: PID = PromotionsID[0]['Id'] return PID def test_PromotionManagement_relatedApi_status_01(self): """ 優惠管理 - 取得優惠管理目前列表 狀態""" data = {"id": self.getWebsiteId()} response_data = self.siteParameter.GetPromotions(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_Promotion_Add_Category_relatedApi_status_02(self): """ 優惠管理 - 新增大分類功能""" ID = self.getWebsiteId() sort_item = self.getSort(ID) data = { "Id": ID, "Categories": [{ "Name": "QA大分類之一", "Sort": sort_item, "Promotions": [] }] } response_data = self.siteParameter.Submit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_Promotion_Add_Subcategories_relatedApi_status_03(self): """ 優惠管理 - 新增大分類中的子分類功能""" ID = self.getWebsiteId() SortId = self.getSortId(ID) data = { "Id": ID, "Categories": [{ "Id": SortId, "Promotions": [{ "Name": "測試子分類一", "Sort": 1, "IsEnabled": "true", "IsWeb": "true", "IsMobile": "true", "IsHorizontal": "true", "DetailType": 1, "Detail": "<p>測試一號</p>\n" }] }] } response_data = self.siteParameter.Submit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_Promotion_Edit_Subcategories_relatedApi_status_04(self): """ 優惠管理 - 修改大分類中的子子分類功能 - 不啟用""" ID = self.getWebsiteId() SortId = self.getSortId(ID) PId = self.getPromotionsID(ID) data = { "Id": ID, "Categories": [{ "Id": SortId, "Promotions": [{ "Id": PId, "IsEnabled": "false" }] }] } response_data = self.siteParameter.Submit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_Promotion_Del_Subcategories_relatedApi_status_05(self): """ 優惠管理 - 移除大分類中的子子分類功能""" ID = self.getWebsiteId() PId = self.getPromotionsID(ID) data = {"Id": ID, "Categories": [], "RemovePromotions": [PId]} response_data = self.siteParameter.Submit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_Promotions_Del_relatedApi_status_06(self): """ 優惠管理 - 移除大分類功能""" ID = self.getWebsiteId() SortId = self.getSortId(ID) data = {"Id": ID, "Categories": [], "RemoveCategories": [SortId]} response_data = self.siteParameter.Submit(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)
class DiscountBaseTest(unittest.TestCase): """ 返水计算 - 相關 API 調用狀態""" def setUp(self): self.config = systemSetting() # 系統參數 self.__http = HttpRequest() self.user = User(self.__http) self.discount = account_management.Discount(self.__http) self.PortalManagement = PortalManagement(self.__http) self.user.login() def tearDown(self): self.user.logout() # 取站台ID 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 getTempId(self): data = { "dateBegin": str(yesterday()), "dateEnd": str(yesterday()), "take": 500, "skip": 0 } response_data = self.discount.calculate(data) return response_data[1]['TempId'] def getHistoryID(self): data = {"take": 100, "skip": 0} response_data = self.discount.loadHistory(data) for i in range(len(response_data[1])): Id = response_data[1][i]['Id'] Name = response_data[1][i]['Name'] return Id, Name def test_discount_relatedApi_status_01(self): """驗證 返水计算 - 取得頁面""" response_data = self.discount.index({}) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_02(self): """驗證 返水计算 - 載入歷史資料""" data = {"take": 100, "skip": 0} response_data = self.discount.loadHistory(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_03(self): """驗證 返水計算 - 清除Temp 狀態""" data = {} response_data = self.discount.ClearTemp(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_04(self): """驗證 - 返水計算 - 計算 狀態""" data = { "dateBegin": str(yesterday()), "dateEnd": str(yesterday()), "take": 500, "skip": 0 } response_data = self.discount.calculate(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_05(self): """驗證 - 返水計算 - 匯出計算明細 狀態""" ID = self.getTempId() data = {"id": ID} response_data = self.discount.exportTemp(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_06(self): """驗證 - 返水計算 - 取得記錄 狀態""" # data = {"id": ID['Id']} data = {"id": self.getHistoryID()[0]} response_data = self.discount.getRecord(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_07(self): """驗證 - 返水計算 - 取得詳細記錄 狀態""" data = {"id": self.getHistoryID()[0], "connectionId": self.user.info()} response_data = self.discount.getRecordDetail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_08(self): """驗證 - 返水計算 - 取得記錄樣版 狀態""" data = {} response_data = self.discount.detail(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_09(self): """返水计算-取得返水發放已沖銷資訊""" data = {"id": self.getHistoryID()[0]} response_data = self.discount.getRevokedRecordSummary(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_10(self): """驗證 - 返水計算 - 取得返水發放沖銷詳細記錄 狀態""" data = {"id": self.getHistoryID()[0], "connectionId": self.user.info()} response_data = self.discount.getRevokedRecordData(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_11(self): """驗證 - 返水計算 - 匯出(發送明細) 狀態""" data = {"id": self.getHistoryID()[0], "connectionId": self.user.info()} response_data = self.discount.export(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code) def test_discount_relatedApi_status_12(self): """驗證 - 返水計算 - 返水發送明細 修改名稱 """ data = { "id": self.getHistoryID()[0], "name": self.getHistoryID()[1] + "1" } response_data = self.discount.updateDiscountRecordName(data) status_code = response_data[0] self.assertEqual(status_code, common_config.Status_Code)