def setUp(self) -> None:
     self.lo = LoggIn()
     driver = BaseDriver.getdriver()
     self.c = Commonlib(driver)
     self.c.solv_log_waring()
     self.pbb = PersonsBankBusiness(driver)
     self.lgin = LoginBussiness(driver)
 def __init__(self, driver):
     # self.basedriver = BaseDriver()
     # driver = self.basedriver.getdriver()
     self.lo = LoggIn()
     self.common = Commonlib(driver)
     self.loginbusi = LoadVideoBussiness(driver)
     self.upldhandle = UpLoadVideoHandle(driver)
 def setUp(self) -> None:
     self.dr = BaseDriver().getdriver()
     self.common = Commonlib(self.dr)
     self.lo = LoggIn()
     self.lo.logg_out("------------->打开浏览器运行--%s--这个类" % LoginTest)
     self.common.solv_log_waring()
     self.businesslogin = LoginBussiness(self.dr)
class PersonsBank(unittest.TestCase):
	"""登录系统切换到人物库"""

	def setUp(self) -> None:
		self.lo = LoggIn()
		driver = BaseDriver().getdriver()
		self.c = Commonlib(driver)
		self.c.solv_log_waring()
		self.pbb = PersonsBankBusiness(driver)
		self.lob = LoginBussiness(driver)

	def tearDown(self) -> None:
		pass

	@parameterized.expand(bulid_data)
	def test_person_colum(self,username,pwd,expect,is_sucess):
		try:
			if is_sucess:
				text_list = []
				self.lob.logoin(username,pwd)
				self.pbb.person_index()
				famous_text = self.pbb.pbh.get_famouspersion_text()
				text_list.append(famous_text)
				unknow_text = self.pbb.pbh.get_unknownpersion_text()
				text_list.append(unknow_text)
				print("生成列表为---->%s"%text_list)
				self.assertEqual(text_list,expect)
				return text_list
		except Exception as e:
			self.lo.logg_out(e)
			self.c.get_screen_shot("test_person_colum")
class LoadVideoBussiness:
    """创建视频上传的登录业务"""
    def __init__(self, driver):
        self.common = Commonlib(driver)
        self.loginhandle = LoadVideoHandle(driver)

    def loadvideologin(self, username, pwd):
        """登录上传视频业务的代码"""
        self.common.open_browser("http://10.168.103.151/admin/#/")
        self.loginhandle.input_username(username)
        self.loginhandle.input_pwd(pwd)
        self.loginhandle.click_btn()
        t.sleep(3)
class SearchFamousPersonsInfo(unittest.TestCase):
    """名人详细信息"""
    def setUp(self) -> None:
        self.lo = LoggIn()
        driver = BaseDriver.getdriver()
        self.c = Commonlib(driver)
        self.c.solv_log_waring()
        self.pbb = PersonsBankBusiness(driver)
        self.lgin = LoginBussiness(driver)

    def tearDown(self) -> None:
        pass

    @parameterized.expand(bulid_data)
    def test_get_famousperson_info(self, username, pwd, value, is_sucess):
        """拿到著名人物的信息"""
        try:
            self.lgin.logoin(username, pwd)
            self.pbb.search_name_person(value)
            if is_sucess:
                search_list = []
                search_name = self.pbb.pbh.get_famoussion_name_text()
                search_list.append(search_name)
                search_china_name = self.pbb.pbh.get_china_name_text()
                search_list.append(search_china_name)
                search_foreign_name = self.pbb.pbh.get_forgin_name_text()
                search_list.append(search_foreign_name)
                search_gender = self.pbb.pbh.get_famous_gender_text()
                search_list.append(search_gender)
                search_nation = self.pbb.pbh.get_famous_nation_text()
                search_list.append(search_nation)
                search_party = self.pbb.pbh.get_famous_party_text()
                search_list.append(search_party)
                search_university = self.pbb.pbh.get_university_name_text()
                search_list.append(search_university)
                search_homeaddr = self.pbb.pbh.get_homeaddres_text()
                search_list.append(search_homeaddr)
                search_persion = self.pbb.pbh.get_position_text()
                search_list.append(search_persion)

                # self.assertEqual(expect,search_list)
                print("输入搜索值为---->%s,搜索到结果为%s" % (value, search_list))
            else:
                error_info = self.pbb.pbh.get_send_errorkeywords_text()
                print("输入搜索值---->%s后搜索到结果为--->%s" % (value, error_info))

        except Exception as e:
            self.lo.logg_out(e)
            self.c.get_screen_shot("test_get_famousperson_info")
class SearchPeople(unittest.TestCase):
    """人物库搜索人物"""
    def setUp(self) -> None:
        self.c = Commonlib()
        self.url = 'http://10.168.103.151/video_analysis/dim_people/pageQuery'
        # self.data = {'name': '张三'}

    @parameterized.expand([
        ({
            'name': '普京'
        }, '弗拉基米尔·弗拉基米罗维奇·普京', True),
        ({
            'name': '张三'
        }, [], False),
        ({
            'name': '··'
        }, [], False),
    ])
    def test_search_people(self, key_word, expect, is_sucess):
        res = requests.post(url=self.url,
                            data=key_word,
                            cookies=self.c.get_cookie())
        res_json = res.json()
        if is_sucess:
            persion_name = res_json['result'][0]['name_cn']  #弗拉基米尔·弗拉基米罗维奇·普京
            self.assertEqual(persion_name, expect)
            print('搜索到关键人物---->', persion_name)
            print('期望人物为---->', expect)
        else:
            error_result = res_json['result']
            print("输入框为空值时搜索到结果为--->", error_result)
            print('输入框为空值时期望值为--->', expect)
            self.assertEqual(error_result, expect)
class YinShiPinBusiness:
    """音视频业务分类"""
    def __init__(self, driver):
        self.lo = LoggIn()
        self.c = Commonlib(driver)
        self.login = LoginBussiness(driver)
        self.yinsp = YinshiPinHandle(driver)

    def yin_shipin_index(self, username, pwd):
        # titlelist = []
        self.lo.logg_out("登录音视频前台")
        self.login.logoin(username, pwd)
        self.c.wait_time(3)

        self.lo.logg_out("打开音视频栏目")
        self.yinsp.click_yinship()
        self.c.wait_time(2)
Exemple #9
0
class LoadVideoLogin(unittest.TestCase):
    """登录上传视频的正反例"""
    def setUp(self):
        self.dr = BaseDriver().getdriver()
        self.c = Commonlib(self.dr)
        self.b = LoadVideoBussiness(self.dr)

    def tearDown(self):
        self.c.wait_time(2)
        self.c.quit_broswer()

    @parameterized.expand(bulid_data)
    def test_load_video_login(self, username, pwd, expect, is_sucess):
        """登录成功拿到页面文字' 视频管理',登录失败停留在登录页面拿到文字‘声像情报分析系统’"""
        try:
            LoggIn.logg_out("准备登录上传视频登录页面")
            self.b.loadvideologin(username, pwd)
            if is_sucess:
                textsucess = self.b.loginhandle.log_sucess_text()
                print("登录成功后断言为------>%s" % textsucess)
                return textsucess
                #断言,"视频管理"
                self.assertEqual(textsucess, expect)
            else:
                # textfail = self.busi_loadvd_login.loginhandle.login_fail_text()
                textfail = self.b.loginhandle.login_fail_text()
                print("登录失败后停留在登录页面断言为---->%s" % textfail)
                self.assertEqual(textfail, expect)
                return textfail
                #断言  “声像情报分析系统”
        except Exception as e:
            self.c.get_screen_shot("test_load_video_login")
            print(e)
Exemple #10
0
class SerachKeywords(unittest.TestCase):
	def setUp(self) -> None:
		self.c = Commonlib()

	def tearDown(self) -> None:
		pass

	#输入关键词搜到结果
	# @parameterized.expand(bulid_data)
	def search_video(self):
		if True:
			video_list = self.c.get_info_forvideo({'search_keywords': '《直播港澳台》他是法国总统马克龙身后的中国通 曾拿书给习近平签名'})
			print(video_list)  #----   ['《直播港澳台》他是法国总统马克龙身后的中国通 曾拿书给习近平签名', '外交']
			return video_list
class LoginBussiness:
	"""登录的业务层"""

	def __init__(self, driver):
		# self.basedriver = BaseDriver()
		# driver = self.basedriver.getdriver()
		self.common = Commonlib(driver)
		self.loghandle = LoginHandle(driver)

	def logoin(self, username, pwd):
		self.common.open_browser("http://10.168.103.151/web/#/login")
		self.common.wait_time(1)
		self.loghandle.input_username(username)
		self.common.wait_time(1)
		self.loghandle.input_pwd(pwd)
		self.common.wait_time(1)
		self.loghandle.click_btn()
		t.sleep(5)
Exemple #12
0
 def setUpClass(cls) -> None:
     cls.c = Commonlib()
     cls.load_video_fun = LoadVideo()
     cls.db_cli = MysqlClinet()
     cls.c.solv_log_waring()
     cls.host = "http://10.168.103.151"
     cls.base_url = "/video_analysis/login"
     cls.url = cls.host + cls.base_url
     cls.data = {
         "code":
         "admin",
         "pwd":
         "418FE8C4A00CB0CFA1909D659CB7A406D03EA0AC9DA98CDA0F9C57A157083765291ED5275B742A48D4DA123AB9CE3C9A6D53627830DBB7EE5F1750A497BACE99"
     }
     r = requests.post(url=cls.url, data=cls.data)
     cls.cookie = r.cookies.get_dict()
     print("---------------登录系统成功,准备随机上传视频---------------")
class YinShiPinTest(unittest.TestCase):
    """点击音视频栏目,拿到下面子栏目的title"""
    def setUp(self) -> None:
        self.lo = LoggIn()
        driver = BaseDriver().getdriver()
        self.c = Commonlib(driver)
        self.c.solv_log_waring()
        self.b = YinShiPinBusiness(driver)

    def tearDown(self) -> None:
        self.c.wait_time(2)
        self.c.quit_broswer()

    @parameterized.expand(bulid_data)
    def test_yinshi_colum(self, username, pwd, expect, is_sucess):
        """拿到音视频下的子栏目的三个值"""
        try:
            if is_sucess:
                titlelist = []
                self.b.yin_shipin_index(username, pwd)

                text_shishiredian = self.b.yinsp.text_shisrd_title()
                titlelist.append(text_shishiredian)

                text_neiwangzibian = self.b.yinsp.text_neiwzb_title()
                titlelist.append(text_neiwangzibian)

                text_waiwangziyuan = self.b.yinsp.text_waiwang_title()
                titlelist.append(text_waiwangziyuan)

                text_guanzhu = self.b.yinsp.text_wodeguanzhu_title()
                titlelist.append(text_guanzhu)

                self.assertEqual(titlelist, expect)
                print("点击音视频库后下子栏目为---->%s" % titlelist)
                return titlelist

        except Exception as e:
            self.lo.logg_out(e)
            self.c.get_screen_shot("test_yinshi_colum")
class LoginTest(unittest.TestCase):
    """登录测试案例正例反例"""
    def setUp(self) -> None:
        self.dr = BaseDriver().getdriver()
        self.common = Commonlib(self.dr)
        self.lo = LoggIn()
        self.lo.logg_out("------------->打开浏览器运行--%s--这个类" % LoginTest)
        self.common.solv_log_waring()
        self.businesslogin = LoginBussiness(self.dr)

    def tearDown(self) -> None:
        self.common.wait_time(5)
        self.common.quit_broswer()
        self.lo.logg_out(">-----------关闭浏览器")

    @parameterized.expand(bulid_data)
    def test_login(self, username, pwd, expect, is_sucess):
        """登录"知音晓视"正例和反例  登录成功,拿到"声像情报融合分析平台",不成功则停留在主页 '声像情报分析系统'"""
        try:
            self.businesslogin.logoin(username, pwd)
            if is_sucess:
                """登录成功就返回主页信息"""
                text = self.businesslogin.loghandle.login_sucess_text()
                self.lo.logg_out("登录成功后进入主页面,主页面标题为---->%s" % text)
                print("登录成功后进入主页面,主页面标题为---->%s" % text)
                self.assertEqual(text, expect)
                return text
                #断言  "声像情报融合分析平台"
            else:
                # """登录失败,就停在登录主页"""
                texttwo = self.businesslogin.loghandle.login_fail_text()
                self.lo.logg_out("密码错误登录失败停留在登录页面文字为--->%s" % texttwo)
                print("密码错误登录失败停留在登录页面文字为--->%s" % texttwo)
                self.assertEqual(texttwo, expect)
                return texttwo
                #断言    "声像情报分析系统"
        except Exception as e:
            self.common.get_screen_shot("test_login")
Exemple #15
0
class SearchKeyWords(unittest.TestCase):
	"""搜索框输入正确关键词,无效关键词,特殊符号"""
	def setUp(self) -> None:
		self.c = Commonlib()

	# @parameterized.expand(
	# 	[
	# 		( {'search_keywords': '《直播港澳台》他是法国总统马克龙身后的中国通 曾拿书给习近平签名'}, "['《直播港澳台》他是法国总统马克龙身后的中国通 曾拿书给习近平签名']",True),
	# 		({'search_keywords': '张三'}, "[]",False),
	# 		({'search_keywords': '···'}, "[]",False)
	# 	]
	# 					)
	@parameterized.expand(bulid_data)
	def test_get_video_name_sucess(self, type_content, expect, is_sucess):
		if is_sucess:
			name_list = self.c.get_info_forvideo(type_content)
			print('搜索到视频---->', name_list)
			self.assertEqual(name_list, ['《直播港澳台》他是法国总统马克龙身后的中国通 曾拿书给习近平签名'])
		else:
			print('this is expect----->', expect)
			self.assertEqual(expect, '[]')
Exemple #16
0
class UpLoadVideoTest(unittest.TestCase):
    """上传正常格式视频和非正常格式视频"""
    def setUp(self) -> None:
        self.lo = LoggIn()
        self.dr = BaseDriver().getdriver()
        self.c = Commonlib(self.dr)
        self.c.solv_log_waring()
        self.b = UpLoadVideoBusiness(self.dr)

    def tearDown(self) -> None:
        self.c.wait_time(20)
        self.c.quit_broswer()

    @parameterized.expand(bulid_data)
    def test_up_load_video_type(self, username, pwd, expect, is_sucess):
        try:
            self.b.up_load_video(username, pwd)
            if is_sucess:
                self.b.up_load_sucess_type_video()
                loadvideo_sucess_text = self.b.upldhandle.get_sucess_upload_video_text(
                )
                return loadvideo_sucess_text
                #断言为---->本地上传
                self.lo.logg_out("视频上传完毕,上传页面text为---->%s" %
                                 loadvideo_sucess_text)
                self.assertEqual(loadvideo_sucess_text, expect)
            else:
                self.b.up_load_erroe_type_video()
                loadvideo_fail_text = self.b.upldhandle.get_fiali_upload_video_text(
                )
                self.lo.logg_out("上传视频格式不正确,弹出弹框文字为--->%s" %
                                 loadvideo_fail_text)
                print("上传视频格式不正确,弹出弹框文字为--->%s" % loadvideo_fail_text)
                self.assertEqual(loadvideo_fail_text, expect)
                return loadvideo_fail_text

        except Exception as e:
            self.lo.logg_out(e)
            self.b.common.get_screen_shot("test_up_load_video_type")
Exemple #17
0
class PersonsBankBusiness:
    """人物库业务层"""
    def __init__(self, driver):
        # self.driver = driver
        self.lo = LoggIn()
        self.c = Commonlib(driver)
        self.login = LoginBussiness(driver)  #登录
        self.pbh = PersonsBankHandle(driver)

    def person_index(self):
        """切换到人物库"""
        # self.login.logoin("admin","111111")
        self.lo.logg_out("点击人物库,切换到人物库首页,")
        self.pbh.click_persion_bank()
        self.c.wait_time(2)

    def search_name_person(self, value):
        #输入名称,搜索知名人物
        # search_list = []
        self.person_index()
        self.pbh.input_person_name(value)
        self.c.wait_time(5)
        self.pbh.click_search_btn_ele()
        self.c.wait_time(5)
Exemple #18
0
 def __init__(self, driver):
     # self.driver = driver
     self.lo = LoggIn()
     self.c = Commonlib(driver)
     self.login = LoginBussiness(driver)  #登录
     self.pbh = PersonsBankHandle(driver)
 def setUp(self) -> None:
     self.c = Commonlib()
     self.url = 'http://10.168.103.151/video_analysis/dim_people/pageQuery'
 def __init__(self, driver):
     self.common = Commonlib(driver)
     self.loginhandle = LoadVideoHandle(driver)
Exemple #21
0
	def setUp(self) -> None:
		self.c = Commonlib()
Exemple #22
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Commonlib.commonlib import Commonlib
c = Commonlib()
import requests
import time

video_id_list = [
    4862, 4863, 4864, 4865, 4866, 4867, 5795, 5796, 5797, 5798, 5799, 5800,
    5801, 5802, 5803, 5804, 5805, 5806, 5807, 5808, 5809, 5810, 5811, 5812,
    5813, 5814, 5815, 5816, 5817, 5818, 5819, 5820, 5821, 5822, 5823, 5824,
    5825, 5826, 5827, 5828, 5829, 5830, 5831, 5832, 5833, 5834, 5835, 5836,
    5837, 5838, 5839, 5840, 5841, 5842, 5843, 5844, 5845, 5846, 5847, 5848,
    5849, 5850, 5851, 5852, 5853, 5854, 5855, 5856, 5857, 5858, 5859, 5860,
    6071, 6072, 6073, 6074, 6075, 6076, 6077, 6078, 6079, 6080, 6081, 6082,
    6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093, 6094,
    6095, 6096, 6097, 6098, 6099, 6100, 6101, 6102, 6103, 6104, 6105, 6106,
    6107, 6108, 6109, 6110, 6111, 6112, 6113, 6114, 6115, 6116, 6117, 6118,
    6119, 6120, 6121, 6122, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130,
    6131, 6430, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501,
    6502, 6503, 6504, 6505, 6506, 6507, 6508, 6509, 6510, 6511, 6512, 6513,
    6514, 6515, 6516, 6517, 6518, 6519, 6520, 6521, 6522, 6523, 6524, 6525,
    6526, 6527, 6528, 6529, 6530, 6531, 6532, 6533, 6534, 6535, 6536, 6537,
    6538, 6539, 6540, 6541, 6542, 6543, 6544, 6545, 6546, 6547, 6548, 6549,
    6550, 6551, 6552, 6553, 6554, 6555, 6556, 6557, 6558, 6559, 6560, 6561,
    6562, 6563, 6564, 6565, 6566, 6567, 6568, 6569, 6570, 6571, 6572, 6573,
    6574, 6575, 6576, 6577, 6578, 6579, 6580, 6581, 6582, 6583, 6584, 6585,
    6586, 6587, 6588, 6589, 6590, 6591, 6592, 6593, 6594, 6595, 6596, 6597,
    6598, 6599, 6600, 6601, 6602, 6603, 6605, 6606, 6607, 6608, 6609, 6610,
    6611, 6612, 6613, 6614, 6615, 6616, 6617, 6618, 6619, 6620, 6621, 6622,
    6623, 6624, 6625, 6626, 6627, 6628, 6629, 6630, 6631, 6632, 6633, 6635,
class UpLoadVideoBusiness:
    """上传视频业务层"""
    def __init__(self, driver):
        # self.basedriver = BaseDriver()
        # driver = self.basedriver.getdriver()
        self.lo = LoggIn()
        self.common = Commonlib(driver)
        self.loginbusi = LoadVideoBussiness(driver)
        self.upldhandle = UpLoadVideoHandle(driver)

    def up_load_video(self, username, pwd):
        """登录后台"""
        self.lo.logg_out("打开浏览器,登录后台上传视频")
        self.loginbusi.loadvideologin(username, pwd)
        self.common.wait_time(3)
        #点击导入视频按钮
        self.upldhandle.click_loadvideo_btn()
        self.lo.logg_out("点击上传视频")
        self.upldhandle.click_choice_video()
        self.common.wait_time(2)

    def up_load_erroe_type_video(self):
        # 上传不正确的视频格式,
        # 非input标签,第三方工具制作参数   +   上传文件的路径
        self.lo.logg_out("加载上传视频路径")
        os.system(r"C:\Users\Test\ruanjian\Autoitupload-filr\upload.exe %s" %
                  filepathone)
        self.common.wait_time(2)
        # loadvideo_fail_text = self.upldhandle.get_fiali_upload_video_text()
        # print(failtext)

    def up_load_sucess_type_video(self):
        """上传正确的视频格式"""
        videoname = random.choice(videolist)
        allpath = filepath + '\\' + videoname
        #第三方上传视频工具  + 正常视频上传路径
        os.system(r"C:\Users\Test\ruanjian\Autoitupload-filr\upload.exe  %s" %
                  allpath)
        self.common.wait_time(2)

        LoggIn.logg_out("选择外网资源")
        self.upldhandle.click_waiwang_btn()

        LoggIn.logg_out("选择频道分类")
        self.common.wait_time(2)
        self.upldhandle.click_pindao_btn()

        LoggIn.logg_out("随机选取一个栏目--人工智能、电子对抗、区块链")
        self.common.wait_time(3)
        self.upldhandle.click_fenlei_lanmu()

        LoggIn.logg_out("选择语言栏目")
        self.common.wait_time(2)
        self.upldhandle.click_langue_btn()

        LoggIn.logg_out("随机选择语言")
        self.common.wait_time(2)
        self.upldhandle.click_choice_langue_btn()

        LoggIn.logg_out("清除制作日期,重新输入当期日期")
        self.common.wait_time(2)
        self.upldhandle.clear_make_data_btn()
        self.common.wait_time(2)
        self.upldhandle.send_make_data_btn()
        self.common.wait_time(1)
        self.upldhandle.click_index()

        LoggIn.logg_out("清除上传日期,重新上传当天日期")
        self.common.wait_time(2)
        self.upldhandle.clear_upload_data()
        self.common.wait_time(2)
        self.upldhandle.send_upload_data_btn()
        self.upldhandle.click_index()

        LoggIn.logg_out("点击index首页切换,点击摘要输入框,输入内容摘要")
        self.common.wait_time(2)
        self.upldhandle.click_index()
        self.common.wait_time(2)
        self.upldhandle.click_index()
        self.upldhandle.input_content()

        LoggIn.logg_out("导入视频按钮")
        self.common.wait_time(2)
        self.upldhandle.import_video_btn()

        LoggIn.logg_out("关闭上传视频弹窗按钮")
        self.common.wait_time(2)
        self.upldhandle.click_alter_ele()

        #查看处理过程按钮
        self.common.wait_time(2)
        self.upldhandle.click_sucess_process()

        LoggIn.logg_out("视频上传完毕")
        self.common.wait_time(2)
Exemple #24
0
 def setUp(self):
     self.dr = BaseDriver().getdriver()
     self.c = Commonlib(self.dr)
     self.b = LoadVideoBussiness(self.dr)
	def __init__(self, driver):
		# self.basedriver = BaseDriver()
		# driver = self.basedriver.getdriver()
		self.common = Commonlib(driver)
		self.loghandle = LoginHandle(driver)
Exemple #26
0
 def setUp(self) -> None:
     self.lo = LoggIn()
     self.dr = BaseDriver().getdriver()
     self.c = Commonlib(self.dr)
     self.c.solv_log_waring()
     self.b = UpLoadVideoBusiness(self.dr)
 def __init__(self, driver):
     self.lo = LoggIn()
     self.c = Commonlib(driver)
     self.login = LoginBussiness(driver)
     self.yinsp = YinshiPinHandle(driver)
 def setUp(self) -> None:
     self.lo = LoggIn()
     driver = BaseDriver().getdriver()
     self.c = Commonlib(driver)
     self.c.solv_log_waring()
     self.b = YinShiPinBusiness(driver)