class TestgetPicDetailForMiFunc(unittest.TestCase): """Test getPicDetailForMi.py""" def setUp(self): self.base = baseUtils() self.projectPath = self.base.getProjectPath( ) + os.sep + "config" + os.sep + "config.ini" self.testData = self.base.getProjectPath( ) + os.sep + "config" + os.sep + "AnjouTestCase.xls" self.config = FileParser(self.projectPath) self.AC = Authentication() self.ex = excelUtil() self.Recommendations = getPicList4HotMi() self.Detail = getPicDetailForMi() def test_getPicDetailForMi_tutu_Android_001(self): '''美甲涂涂移动Android端_取单张图片详情_系统图库_手机号密码登录_001''' # 登录 TestData = self.ex.getDict(2, 9, 7, self.testData) currentPage = TestData["currentPage"] pageSize = TestData["pageSize"] allNailSuitFlag = TestData["allNailSuitFlag"] phone = TestData["phone"] password = TestData["password"] data = self.AC.get_Android_CN_logged_in(phone, password) pad_login_url_ch = self.AC.get_AuthenticationURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_login_url", "login_url"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android")) access_token = self.AC.get_Access_token(pad_login_url_ch, data) self.assertIsNotNone(access_token) #热门推荐 RecommendationsURL = self.Recommendations.get_getPicList4HotMiURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_cms_url", "getPicList4HotMiURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_Recommendations = self.Recommendations.send_request_getPicList4HotMi( RecommendationsURL, currentPage, pageSize, allNailSuitFlag) self.assertEqual(result_Recommendations["stateCode"], 200) self.assertEqual(result_Recommendations["stateMsg"], "OK") #随机取热门推荐返回的一张图片的ID ID = random.choice(result_Recommendations["data"])["id"] #图片详情接口 collectionType = TestData["collectionType"] DetailURL = self.Detail.get_getPicDetailForMiURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_cms_url", "getPicDetailForMiURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_Detail = self.Detail.send_request_getPicDetailForMi( DetailURL, ID, collectionType) self.assertEqual(result_Detail["stateCode"], 200) self.assertEqual(result_Detail["stateMsg"], "OK") self.assertEqual(result_Detail["data"]["id"], ID) def test_getPicDetailForMi_tutu_Android_002(self): '''美甲涂涂移动Android端_取单张图片详情_系统图库_鉴权登录_002''' # 鉴权登录 TestData = self.ex.getDict(2, 10, 7, self.testData) currentPage = TestData["currentPage"] pageSize = TestData["pageSize"] allNailSuitFlag = TestData["allNailSuitFlag"] data = self.AC.get_Android_CN_Not_logged_in() pad_login_url_ch = self.AC.get_AuthenticationURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_login_url", "login_url"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android")) access_token = self.AC.get_Access_token(pad_login_url_ch, data) self.assertIsNotNone(access_token) #热门推荐 RecommendationsURL = self.Recommendations.get_getPicList4HotMiURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_cms_url", "getPicList4HotMiURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_Recommendations = self.Recommendations.send_request_getPicList4HotMi( RecommendationsURL, currentPage, pageSize, allNailSuitFlag) self.assertEqual(result_Recommendations["stateCode"], 200) self.assertEqual(result_Recommendations["stateMsg"], "OK") #随机取热门推荐返回的一张图片的ID ID = random.choice(result_Recommendations["data"])["id"] #取单张图片详情 collectionType = TestData["collectionType"] DetailURL = self.Detail.get_getPicDetailForMiURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_cms_url", "getPicDetailForMiURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_Detail = self.Detail.send_request_getPicDetailForMi( DetailURL, ID, collectionType) self.assertEqual(result_Detail["stateCode"], 200) self.assertEqual(result_Detail["stateMsg"], "OK") self.assertEqual(result_Detail["data"]["id"], ID) def tearDown(self): pass
class TestgetAlbumsList4FrontFunc(unittest.TestCase): """Test getAlbumsList4Front.py""" def setUp(self): self.base = baseUtils() self.projectPath = self.base.getProjectPath( ) + os.sep + "config" + os.sep + "config.ini" self.testData = self.base.getProjectPath( ) + os.sep + "config" + os.sep + "AnjouTestCase.xls" self.config = FileParser(self.projectPath) self.AC = Authentication() self.ex = excelUtil() self.ListQuery = getAlbumsList4Front() self.queryTag4 = queryTag4Front() def test_getAlbumsList4Front_tutu_Android_001(self): '''美甲涂涂移动Android端_特辑列表查询_正常查询_手机号密码登录_001''' # 登录 TestData = self.ex.getDict(2, 25, 7, self.testData) currentPage = TestData["currentPage"] pageSize = TestData["pageSize"] phone = TestData["phone"] password = TestData["password"] data = self.AC.get_Android_CN_logged_in(phone, password) pad_login_url_ch = self.AC.get_AuthenticationURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_login_url", "login_url"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android")) access_token = self.AC.get_Access_token(pad_login_url_ch, data) self.assertIsNotNone(access_token) #特辑列表 ListQueryURL = self.ListQuery.get_getAlbumsList4FrontURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_cms_url", "getAlbumsList4FrontURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_ListQuery = self.ListQuery.send_request_getAlbumsList4Front( ListQueryURL, currentPage, pageSize) self.assertEqual(result_ListQuery["stateCode"], 200) self.assertEqual(result_ListQuery["stateMsg"], "OK") self.assertIsNotNone(result_ListQuery["data"]) def test_getAlbumsList4Front_tutu_Android_002(self): '''美甲涂涂移动Android端_特辑列表查询_正常查询_鉴权登录_002''' # 登录 TestData = self.ex.getDict(2, 26, 7, self.testData) currentPage = TestData["currentPage"] pageSize = TestData["pageSize"] data = self.AC.get_Android_CN_Not_logged_in() pad_login_url_ch = self.AC.get_AuthenticationURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_login_url", "login_url"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android")) access_token = self.AC.get_Access_token_not_login( pad_login_url_ch, data) self.assertIsNotNone(access_token) #特辑列表 ListQueryURL = self.ListQuery.get_getAlbumsList4FrontURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_cms_url", "getAlbumsList4FrontURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_ListQuery = self.ListQuery.send_request_getAlbumsList4Front( ListQueryURL, currentPage, pageSize) self.assertEqual(result_ListQuery["stateCode"], 200) self.assertEqual(result_ListQuery["stateMsg"], "OK") self.assertIsNotNone(result_ListQuery["data"]) def test_getAlbumsList4Front_tutu_Android_003(self): '''美甲涂涂移动Android端_特辑列表查询_根据标签ID查询_手机号密码登录_003''' # 登录 TestData = self.ex.getDict(2, 25, 7, self.testData) currentPage = TestData["currentPage"] pageSize = TestData["pageSize"] phone = TestData["phone"] password = TestData["password"] data = self.AC.get_Android_CN_logged_in(phone, password) pad_login_url_ch = self.AC.get_AuthenticationURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_login_url", "login_url"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android")) access_token = self.AC.get_Access_token(pad_login_url_ch, data) self.assertIsNotNone(access_token) #标签列表 queryTag4URL = self.queryTag4.get_queryTag4FrontURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("homePage", "queryTag4FrontURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_queryTag4 = self.queryTag4.send_request_queryTag4Front( queryTag4URL) self.assertEqual(result_queryTag4["stateCode"], 200) self.assertEqual(result_queryTag4["stateMsg"], "OK") albumsTagId = random.choice(result_queryTag4["data"])["id"] #特辑列表 ListQueryURL = self.ListQuery.get_getAlbumsList4FrontURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_cms_url", "getAlbumsList4FrontURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_ListQuery = self.ListQuery.send_request_getAlbumsList4Front( ListQueryURL, currentPage, pageSize, albumsTagId) self.assertEqual(result_ListQuery["stateCode"], 200) self.assertEqual(result_ListQuery["stateMsg"], "OK") self.assertIsNotNone(result_ListQuery["data"]) def tearDown(self): pass
class TestqueryNailSuit4FrontFunc(unittest.TestCase): """Test queryNailSuit4Front.py""" def setUp(self): self.base = baseUtils() self.projectPath = self.base.getProjectPath( ) + os.sep + "config" + os.sep + "config.ini" self.testData = self.base.getProjectPath( ) + os.sep + "config" + os.sep + "AnjouTestCase.xls" self.config = FileParser(self.projectPath) self.AC = Authentication() self.ex = excelUtil() self.queryNailSuit = queryNailSuit4Front() def test_queryNailSuit4Front_tutu_Android_001(self): '''美甲涂涂移动Android端_v1_AI试甲-查发布的普通套图列表_正常查询_手机号密码登录_001''' # 登录 # TestData = self.ex.getDict(2, 25, 7, self.testData) currentPage = "1" pageSize = "15" phone = "13417335080" password = "******" data = self.AC.get_Android_CN_logged_in(phone, password) test = self.config.get('imi_base_url_ch', 'base_url_dev_k8s') print(test) app_login_url_ch = self.AC.get_AuthenticationURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_login_url", "login_url"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android")) access_token = self.AC.get_Access_token(app_login_url_ch, data) self.assertIsNotNone(access_token) #AI试甲-查发布的普通套图列表 queryNailSuitURL = self.queryNailSuit.get_queryNailSuit4FrontURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("AI", "queryNailSuit4FrontURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_queryNailSuit = self.queryNailSuit.send_request_queryNailSuit4Front( queryNailSuitURL, currentPage, pageSize) self.assertEqual(result_queryNailSuit["stateCode"], 200) self.assertEqual(result_queryNailSuit["stateMsg"], "OK") def test_queryNailSuit4Front_tutu_Android_002(self): '''美甲涂涂移动Android端_v1_AI试甲-查发布的普通套图列表_正常查询_鉴权登录_002''' # 登录 # TestData = self.ex.getDict(2, 25, 7, self.testData) currentPage = "1" pageSize = "15" phone = "13417335080" password = "******" data = self.AC.get_Android_CN_Not_logged_in() app_login_url_ch = self.AC.get_AuthenticationURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("imi_login_url", "login_url"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android")) access_token = self.AC.get_Access_token(app_login_url_ch, data) self.assertIsNotNone(access_token) #AI试甲-查发布的普通套图列表 queryNailSuitURL = self.queryNailSuit.get_queryNailSuit4FrontURL( self.config.get('imi_base_url_ch', 'base_url_dev_k8s'), self.config.get("AI", "queryNailSuit4FrontURL"), self.config.get("lang", "zh"), self.base.getTimeStamp(), self.config.get("clientVersionInfo", "clientVersionInfo_ch_Android"), access_token) result_queryNailSuit = self.queryNailSuit.send_request_queryNailSuit4Front( queryNailSuitURL, currentPage, pageSize) self.assertEqual(result_queryNailSuit["stateCode"], 200) self.assertEqual(result_queryNailSuit["stateMsg"], "OK") def tearDown(self): pass