class test_sikai(unittest.TestCase): def setUp(self): self.config = ReadConfig() self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.logger = self.log.get_logger() self.case_name = str('第三方斯凯图书渠道接口') def tearDown(self): self.log.logger.info(self.case_name + " - Code:" + str(self.result['code'])) def test_001_01(self): res = self.resultmethod.get('url_007_01') self.result = res.json() self.assertEqual(self.result['code'], 200) self.case_name = str('第三方斯凯图书渠道接口') def test_001_02(self): res = self.resultmethod.get('url_007_02') self.result = res.json() self.assertEqual(self.result['code'], 200) self.case_name = str('斯凯图书渠道_获取图书信息') def test_001_03(self): res = self.resultmethod.get('url_007_03') self.result = res.json() self.assertEqual(self.result['code'], 200) self.case_name = str('斯凯图书渠道_获取图书章节列表') def test_001_04(self): res = self.resultmethod.get('url_007_04') self.result = res.json() self.assertEqual(self.result['code'], 200) self.case_name = str('斯凯图书渠道_获取图书内容')
def setUp(self): self.identity = "migu" self.config = ReadConfig() self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.logger = self.log.get_logger() self.case_name = str('第三方爱奇艺图书渠道接口')
class test_shuxiang(unittest.TestCase): def setUp(self): self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.case_name = str('第三方百度阅读图书渠道接口') def tearDown(self): pass def test_011_01(self): res = self.resultmethod.get("url_009_01") result = res.text.find('id') self.assertEqual(result, 3) self.case_name = str("第三方百度阅读图书渠道接口") self.log.logger.info(self.case_name + " - Code:第一个'id'-的索引是--" + str(result) + '--------成功') def test_011_02(self): res = self.resultmethod.get("url_009_02") result = res.text.find('bookstatus') self.assertEqual(result, 2) self.case_name = str("百度阅读图书渠道接口_获取书籍属性列表") self.log.logger.info(self.case_name + " - Code:bookstatus -的索引是--" + str(result) + '--------成功') def test_011_03(self): res = self.resultmethod.get("url_009_03") result = res.text.find('第一章') self.assertEqual(result, 17) self.case_name = str("百度阅读图书渠道接口_获取书籍章节列表") self.log.logger.info(self.case_name + " - Code:第一章 -的索引是--" + str(result) + '--------成功') def test_011_04(self): res = self.resultmethod.get("url_009_04") result = res.text.find('volumeid') self.assertEqual(result, 20) self.case_name = str("百度阅读图书渠道接口_获取章节内容") self.log.logger.info(self.case_name + " - Code:volumeid-的索引是--" + str(result) + '--------成功')
class test_zhulang(unittest.TestCase): def setUp(self): self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.case_name = str('第三方逐浪图书渠道接口') def tearDown(self): pass def test_013_01(self): res = self.resultmethod.get("url_013_01") result = res.text.find('bookid') self.assertEqual(result, 3) self.case_name = str("第三方逐浪图书渠道接口") self.log.logger.info(self.case_name + " - Code:第一个'bookid'-的索引是--" + str(result) + '--------成功') def test_013_02(self): res = self.resultmethod.get("url_013_02") result = res.text.find('一代仙帝') self.assertEqual(result, 118) self.case_name = str("逐浪图书渠道_作品信息") self.log.logger.info(self.case_name + " - Code:一代仙帝 -的索引是--" + str(result) + '--------成功') def test_013_03(self): res = self.resultmethod.get("url_013_03") result = res.text.find('chaptersList') self.assertEqual(result, 3) self.case_name = str("逐浪图书渠道_章节列表") self.log.logger.info(self.case_name + " - Code:chaptersList-的索引是--" + str(result) + '--------成功') def test_013_04(self): res = self.resultmethod.get("url_013_04") result = res.text.find('第一章 ') self.assertEqual(result, 37) self.case_name = str("逐浪图书渠道_正文接口") self.log.logger.info(self.case_name + " - Code:第一章-的索引是--" + str(result) + '--------成功')
class test_shuchong(unittest.TestCase): def setUp(self): self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.case_name = str('第三方书丛图书渠道接口') def tearDown(self): pass def test_012_01(self): res = self.resultmethod.get("url_012_01") result = res.text.find('url') self.assertEqual(result, 484) self.case_name = str("第三方书丛图书渠道接口") self.log.logger.info(self.case_name + " - Code:第一个url-的索引是--" + str(result) + '--------成功') def test_012_02(self): res = self.resultmethod.get("url_012_02") result = res.text.find('title') self.assertEqual(result, 56) self.case_name = str("书丛图书渠道_获取图书信息") self.log.logger.info(self.case_name + " - Code:第一个title-的索引是--" + str(result) + '--------成功') def test_012_03(self): res = self.resultmethod.get("url_012_03") result = res.text.find('chaptername') self.assertEqual(result, 167) self.case_name = str("书丛图书渠道_获取图书章节列表") self.log.logger.info(self.case_name + " - Code:第一个chaptername-索引是--" + str(result) + '--------成功') def test_012_04(self): res = self.resultmethod.get("url_012_04") result = res.text.find('第2章') self.assertEqual(result, 74) self.case_name = str("书丛图书渠道_获取图书章节列表") self.log.logger.info(self.case_name + " - Code:第2章-的索引是--" + str(result) + '--------成功')
class test_kaiyue(unittest.TestCase): def setUp(self): self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.case_name = str('第三方开阅图书渠道接口') def tearDown(self): pass def test_005_01(self): res = self.resultmethod.get("url_005_01") result = res.text.find('bookid') self.assertEqual(result, 59) self.case_name = str("第三方开阅图书渠道接口") self.log.logger.info(self.case_name + " - Code:第一个'bookid'-的索引是--" + str(result) + '--------成功') def test_005_02(self): res = self.resultmethod.get("url_005_02") result = res.text.find('现言') self.assertEqual(result, 110) self.case_name = str("开阅图书渠道_作品信息") self.log.logger.info(self.case_name + " - Code:现言 -的索引是--" + str(result) + '--------成功') def test_005_03(self): res = self.resultmethod.get("url_005_03") result = res.text.find('默认卷') self.assertEqual(result, 71) self.case_name = str("开阅图书渠道_章节列表") self.log.logger.info(self.case_name + " - Code:默认卷-的索引是--" + str(result) + '--------成功') def test_005_04(self): res = self.resultmethod.get("url_005_04") result = res.text.find('极不舒服') self.assertEqual(result, 60) self.case_name = str("开阅图书渠道_正文接口") self.log.logger.info(self.case_name + " - Code:极不舒服-的索引是--" + str(result) + '--------成功')
class test_shuqi(unittest.TestCase): def setUp(self): self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.case_name = str('第三方书旗图书渠道接口') def tearDown(self): pass def test_012_01(self): res = self.resultmethod.get("url_006_01") result = res.text.find('bookid') self.assertEqual(result, 51) self.case_name = str("第三方书旗图书渠道接口") self.log.logger.info(self.case_name + " - Code:第一个'bookid'-的索引是--" + str(result) + '--------成功') def test_012_02(self): res = self.resultmethod.get("url_006_02") result = res.text.find('现言') self.assertEqual(result, 66) self.case_name = str("书旗图书渠道_作品信息") self.log.logger.info(self.case_name + " - Code:现言 -的索引是--" + str(result) + '--------成功') def test_012_03(self): res = self.resultmethod.get("url_006_03") result = res.text.find('第1章') self.assertEqual(result, 291) self.case_name = str("书旗图书渠道_章节列表") self.log.logger.info(self.case_name + " - Code:第1章-的索引是--" + str(result) + '--------成功') def test_012_04(self): res = self.resultmethod.get("url_006_04") result = res.text.find('十三年前') self.assertEqual(result, 77) self.case_name = str("书旗图书渠道_正文接口") self.log.logger.info(self.case_name + " - Code:十三年前-的索引是--" + str(result) + '--------成功')
class test_shuxiang(unittest.TestCase): def setUp(self): self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.case_name =str('第三方书香图书渠道接口') def tearDown(self): pass def test_011_01(self): res = self.resultmethod.get("url_011_01") result = res.text.find('booktitle') self.assertEqual(result, 148) self.case_name = str("第三方书香图书渠道接口") self.log.logger.info(self.case_name + " - Code:第一个'booktitle'-的索引是--" + str(result)+'--------成功') def test_011_02(self): res = self.resultmethod.get("url_011_02") result = res.text.find('闪婚独宠') self.assertEqual(result,390) self.case_name = str("书香图书渠道_获取图书信息") self.log.logger.info(self.case_name + " - Code:闪婚独宠 -的索引是--" + str(result)+'--------成功') def test_011_03(self): res = self.resultmethod.get("url_011_03") result = res.text.find('第1章') self.assertEqual(result, 115) self.case_name = str("书香丛图书渠道_获取图书章节列表") self.log.logger.info(self.case_name + " - Code:第1章-的索引是--" + str(result)+'--------成功') def test_011_04(self): res = self.resultmethod.get("url_011_04") result = res.text.find('莫晚晚') self.assertEqual(result, 131) self.case_name = str("书香图书渠道_获取图书章节内容") self.log.logger.info(self.case_name + " - Code:莫晚晚-的索引是--" + str(result) + '--------成功')
def setUp(self): warnings.simplefilter("ignore", ResourceWarning) self.config = ReadConfig() self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.logger = self.log.get_logger() self.case_name =str('第三方网易云分销图书渠道接口') self.s = requests.session() data = { "username": "******", "password": "******", "token": "G6gIVRMah9nWwiJQq5AsFZEcP4kvSUmejN" } self.session = self.s.post('http://www.cmread.com/adminwx/user/login/check', data=data) print(self.session.text)
class test_aiqiyi(unittest.TestCase): def setUp(self): self.identity = "migu" self.config = ReadConfig() self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.logger = self.log.get_logger() self.case_name = str('第三方爱奇艺图书渠道接口') def tearDown(self): self.log.build_case_line(self.case_name, self.result['code'], self.result['msg']) def test_001_01(self): res = self.resultmethod.get('url_001_01') self.result = res.json() self.assertEqual(self.result['msg'], 'Success') self.case_name = str('第三方爱奇艺图书渠道接口') def test_001_02(self): res = self.resultmethod.get('url_001_02') self.result = res.json() self.assertEqual(self.result['msg'], 'Success') self.case_name = str('爱奇艺获取图书信息接口') def test_001_03(self): res = self.resultmethod.get('url_001_03') self.result = res.json() self.assertEqual(self.result['msg'], 'Success') self.case_name = str('爱奇艺获取图书结构接口') def test_001_04(self): res = self.resultmethod.get('url_001_04') self.result = res.json() self.assertEqual(self.result['msg'], 'Success') self.case_name = str('获取指定书籍ID的章节详情(包含内容)')
def setUp(self): self.resultmethod = RequestMethod() self.log = MyLog.get_log() self.case_name = str('第三方百度阅读图书渠道接口')