def __init__(self, driver):
     self.driver = driver
     self.log = log()
     self.cmf = commonFun(driver)
     self.frameElem = frameElement(driver)
     self.linux = LinuxResource(driver)
     self.account = Accountmgr(driver)
     self.data = dataFileName()
Esempio n. 2
0
 def __init__(self, driver):
     self.driver = driver
     self.log = log()
     self.cmf = commonFun(driver)
     self.frameElem = frameElement(driver)
     self.testrole = testRole(driver)
     self.resource = Resource(driver)
     self.linux = LinuxResource(driver)
     self.role = Role(driver)
     self.data = dataFileName()
Esempio n. 3
0
	def __init__(self, driver):
		self.driver = driver
		self.log = log()
		self.cmf = commonFun(driver)
		self.frameElem = frameElement(driver)
		self.testrole = testRole(driver)
		self.resource = Resource(driver)
		self.linux = LinuxResource(driver)
		self.role = Role(driver)
		self.data = dataFileName()
class testResourceAccount(object):
    def __init__(self, driver):
        self.driver = driver
        self.log = log()
        self.cmf = commonFun(driver)
        self.frameElem = frameElement(driver)
        self.testrole = testRole(driver)
        self.linux = LinuxResource(driver)
        self.account = Accountmgr(driver)
        self.role = Role(driver)
        self.data = dataFileName()

    u'''添加和编辑资源账号'''

    def add_edit_resource_account_001(self, dataPath, sheetName):

        #日志开始记录
        self.log.log_start("add_edit_resource_account")
        #获取添加资源账号测试数据
        accountData = self.data.get_data(dataPath, sheetName)
        #保存成功的弹出框
        accountMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(accountData)):
            data = accountData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    #点击账号管理
                    if dataRow == 1:
                        self.account.click_account_manage_button(data[2])
                    self.linux.add_edit_resource_account(
                        data[3], data[4], data[5], data[6], data[7])
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", accountMsg, data,
                                                  flag)
                    self.cmf.back()
            except Exception as e:
                print("add_edit_resource_account fail:" + str(e))
        self.cmf.back()

        self.log.log_end("add_edit_resource_account")

    u'''查询资源账号'''

    def query_resource_account_002(self, dataPath, sheetName):

        #日志开始记录
        self.log.log_start("query_resource_account")
        #获取查询资源账号测试数据
        accountData = self.data.get_data(dataPath, sheetName)

        for dataRow in range(len(accountData)):
            data = accountData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    if dataRow == 1:
                        self.account.click_account_manage_button(data[1])
                        self.account.query_name(data[2])
                    if dataRow == 2 or dataRow == 3:
                        self.account.is_authorize(data[3])
                    if dataRow == 4:
                        self.account.query_name(data[2])
                        self.account.is_authorize(data[3])
                    self.account.click_account_query()
                    self.role.click_reset()
                    self.log.log_detail(data[0], True)
            except Exception as e:
                print("query_resource_account fail:" + str(e))
        self.cmf.back()

        self.log.log_end("query_resource_account")

    u'''检验资源账号'''

    def check_resource_account_003(self, dataPath, sheetName):

        #日志开始记录
        self.log.log_start("check_resource_account")
        #获取检验资源测试数据
        resourceData = self.data.get_data(dataPath, sheetName)
        #保存成功的弹出框
        resourceMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(resourceData)):
            data = resourceData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    if dataRow == 1:
                        self.account.click_account_manage_button(data[2])
                        self.account.click_account_add_edit_button()
                    self.linux.check_resource_account(data[3], data[4],
                                                      data[5], data[6])
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", resourceMsg, data,
                                                  flag)
            except Exception as e:
                print("check_resource_account fail:" + str(e))

        self.cmf.back()

        self.cmf.back()

        self.log.log_end("check_resource_account")

    u'''删除资源账号'''

    def del_resource_account_004(self, dataPath, sheetName):

        #日志开始记录
        self.log.log_start("del_resource_account")
        #获取删除资源账号测试数据
        accountData = self.data.get_data(dataPath, sheetName)
        #保存成功的弹出框
        accountMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(accountData)):
            data = accountData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    self.account.click_account_manage_button(data[2])
                    self.account.click_account_del(data[3])
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", accountMsg, data,
                                                  flag)
                    self.cmf.click_msg_button(1)
            except Exception as e:
                print("del_resource_account fail:" + str(e))
        self.cmf.back()
        self.log.log_end("del_resource_account")

    u'''全选删除资源账号'''

    def bulkdel_resource_account_005(self, dataPath, sheetName):

        #日志开始记录
        self.log.log_start("bulkdel_resource_account")
        #获取全选删除资源账号测试数据
        accountData = self.data.get_data(dataPath, sheetName)
        #保存成功的弹出框
        accountMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(accountData)):
            data = accountData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    self.account.click_account_manage_button(data[2])
                    self.cmf.check_all()
                    self.cmf.bulkdel("delete_account")
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", accountMsg, data,
                                                  flag)
                    self.cmf.click_msg_button(1)
            except Exception as e:
                print("bulkdel_resource_account failure:" + str(e))
        self.cmf.back()

        self.log.log_end("bulkdel_resource_account")
Esempio n. 5
0
class testLinuxResource(object):
    def __init__(self, driver):
        self.driver = driver
        self.log = log()
        self.cmf = commonFun(driver)
        self.frameElem = frameElement(driver)
        self.testrole = testRole(driver)
        self.resource = Resource(driver)
        self.linux = LinuxResource(driver)
        self.role = Role(driver)
        self.data = dataFileName()

    u'''获取测试数据
	   Parameters:
	      - sheetname:sheet名称
	   return:表格数据
	'''

    def get_resource_table_data(self, sheetname):
        dataFile = dataFileName()
        resourcePath = dataFile.get_linux_resource_test_data_url()
        resourceData = dataFile.get_data(resourcePath, sheetname)
        return resourceData

    u'''添加linux资源'''

    def add_linux_resource_001(self):

        #日志开始记录
        self.log.log_start("add_resource")
        #获取添加资源测试数据
        resourceData = self.get_resource_table_data("add_linux_resource")
        #保存成功的弹出框
        resourceMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(resourceData)):
            data = resourceData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    self.resource.click_add_edit_button()
                    self.resource.select_resource_type(data[2])
                    self.linux.add_edit_linux_resource(data)
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", resourceMsg, data,
                                                  flag)
                    self.cmf.back()
            except Exception as e:
                print("add_resource fail:" + str(e))

        self.log.log_end("add_resource")

    u'''编辑linux资源'''

    def edit_linux_resource_002(self):

        #日志开始记录
        self.log.log_start("edit_resource")
        #获取添加资源测试数据
        resourceData = self.get_resource_table_data("edit_linux_resource")
        #保存成功的弹出框
        resourceMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(resourceData)):
            data = resourceData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    self.resource.click_add_edit_button(data[2])
                    self.linux.add_edit_linux_resource(data)
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", resourceMsg, data,
                                                  flag)
                    self.cmf.back()
            except Exception as e:
                print("edit_resource fail:" + str(e))

        self.log.log_end("edit_resource")

    u'''检验linux资源'''

    def check_linux_resource_003(self):

        #日志开始记录
        self.log.log_start("check_linux_resource")
        #获取检验资源测试数据
        resourceData = self.get_resource_table_data("check_linux_resource")
        #保存成功的弹出框
        resourceMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        #点击添加按钮
        self.resource.click_add_edit_button()
        #选择debian类型
        self.resource.select_resource_type("Debian")

        for dataRow in range(len(resourceData)):
            data = resourceData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    self.linux.check_linux_resource(dataRow, data)
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", resourceMsg, data,
                                                  flag)
            except Exception as e:
                print("check_linux_resource fail:" + str(e))

        self.cmf.back()

        self.log.log_end("check_linux_resource")

    u'''查询资源'''

    def query_resource_004(self, dataPath, sheetName):

        #日志开始记录
        self.log.log_start("query_resource")
        #获取添加资源测试数据
        resourceData = self.data.get_data(dataPath, sheetName)

        for dataRow in range(len(resourceData)):
            data = resourceData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    if dataRow == 1:
                        self.resource.query_depart(data[1])
                    if dataRow == 2:
                        self.resource.click_child_node()
                        self.resource.query_depart(data[1])
                    if dataRow == 3:
                        self.resource.query_type(data[2], data[3], data[4])
                    if dataRow >= 4 and dataRow <= 7:
                        self.resource.query_ip_rename(data[5])
                    if dataRow == 8:
                        self.resource.query_type(data[2], data[3], data[4])
                        self.resource.query_ip_rename(data[5])
                    self.resource.click_resource_query()
                    self.role.click_reset()
                    self.log.log_detail(data[0], True)
            except Exception as e:
                print("query_resource fail:" + str(e))
        self.resource.click_resource_query()
        self.log.log_end("query_resource")

    u'''删除资源'''

    def del_resource_005(self, dataPath, sheetName):

        #日志开始记录
        self.log.log_start("del_resource")
        #获取添加资源测试数据
        resourceData = self.data.get_data(dataPath, sheetName)
        #保存成功的弹出框
        resourceMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(resourceData)):
            data = resourceData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    self.resource.click_del_button(data[2])
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", resourceMsg, data,
                                                  flag)
                    self.cmf.click_msg_button(1)
            except Exception as e:
                print("del_resource fail:" + str(e))

        self.log.log_end("del_resource")

    u'''全选删除资源'''

    def bulkdel_resource_006(self):

        #日志开始记录
        self.log.log_start("bulkdel_resource")
        #获取添加资源测试数据
        resourceData = self.get_resource_table_data("bulkdel_resource")
        #保存成功的弹出框
        resourceMsg = self.testrole.popup()

        #无检查点的测试项标识,如果为True说明通过
        flag = False

        for dataRow in range(len(resourceData)):
            data = resourceData[dataRow]
            try:
                #如果不是第一行标题,则读取数据
                if dataRow != 0:
                    self.cmf.check_all()
                    self.cmf.bulkdel("delete_resource")
                    self.frameElem.switch_to_content()
                    self.cmf.test_win_check_point("xpath", resourceMsg, data,
                                                  flag)
                    self.cmf.click_msg_button(1)
            except Exception as e:
                print("bulkdel_resource failure:" + str(e))

        self.log.log_end("bulkdel_resource")
Esempio n. 6
0
class testLinuxResource(object):

	def __init__(self, driver):
		self.driver = driver
		self.log = log()
		self.cmf = commonFun(driver)
		self.frameElem = frameElement(driver)
		self.testrole = testRole(driver)
		self.resource = Resource(driver)
		self.linux = LinuxResource(driver)
		self.role = Role(driver)
		self.data = dataFileName()

	u'''获取测试数据
	   Parameters:
	      - sheetname:sheet名称
	   return:表格数据
	'''
	def get_resource_table_data(self, sheetname):
		dataFile = dataFileName()
		resourcePath = dataFile.get_linux_resource_test_data_url()
		resourceData = dataFile.get_data(resourcePath, sheetname)
		return resourceData

	u'''添加linux资源'''
	def add_linux_resource_001(self):

		#日志开始记录
		self.log.log_start("add_resource")
		#获取添加资源测试数据
		resourceData = self.get_resource_table_data("add_linux_resource")
		#保存成功的弹出框
		resourceMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(resourceData)):
			data = resourceData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					self.resource.click_add_edit_button()
					self.resource.select_resource_type(data[2])
					self.linux.add_edit_linux_resource(data)
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", resourceMsg, data, flag)
					self.cmf.back()
			except Exception as e:
				print ("add_resource fail:" + str(e))

		self.log.log_end("add_resource")

	u'''编辑linux资源'''
	def edit_linux_resource_002(self):

		#日志开始记录
		self.log.log_start("edit_resource")
		#获取添加资源测试数据
		resourceData = self.get_resource_table_data("edit_linux_resource")
		#保存成功的弹出框
		resourceMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(resourceData)):
			data = resourceData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					self.resource.click_add_edit_button(data[2])
					self.linux.add_edit_linux_resource(data)
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", resourceMsg, data, flag)
					self.cmf.back()
			except Exception as e:
				print ("edit_resource fail:" + str(e))

		self.log.log_end("edit_resource")

	u'''检验linux资源'''
	def check_linux_resource_003(self):

		#日志开始记录
		self.log.log_start("check_linux_resource")
		#获取检验资源测试数据
		resourceData = self.get_resource_table_data("check_linux_resource")
		#保存成功的弹出框
		resourceMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		#点击添加按钮
		self.resource.click_add_edit_button()
		#选择debian类型
		self.resource.select_resource_type("Debian")

		for dataRow in range(len(resourceData)):
			data = resourceData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					self.linux.check_linux_resource(dataRow, data)
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", resourceMsg, data, flag)
			except Exception as e:
				print ("check_linux_resource fail:" + str(e))

		self.cmf.back()

		self.log.log_end("check_linux_resource")

	u'''查询资源'''
	def query_resource_004(self, dataPath, sheetName):

		#日志开始记录
		self.log.log_start("query_resource")
		#获取添加资源测试数据
		resourceData = self.data.get_data(dataPath, sheetName)

		for dataRow in range(len(resourceData)):
			data = resourceData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					if dataRow == 1:
						self.resource.query_depart(data[1])
					if dataRow == 2:
						self.resource.click_child_node()
						self.resource.query_depart(data[1])
					if dataRow == 3:
						self.resource.query_type(data[2], data[3], data[4])
					if dataRow >= 4 and dataRow <= 7:
						self.resource.query_ip_rename(data[5])
					if dataRow == 8:
						self.resource.query_type(data[2], data[3], data[4])
						self.resource.query_ip_rename(data[5])
					self.resource.click_resource_query()
					self.role.click_reset()
					self.log.log_detail(data[0], True)
			except Exception as e:
				print ("query_resource fail:" + str(e))
		self.resource.click_resource_query()
		self.log.log_end("query_resource")

	u'''删除资源'''
	def del_resource_005(self, dataPath, sheetName):

		#日志开始记录
		self.log.log_start("del_resource")
		#获取添加资源测试数据
		resourceData = self.data.get_data(dataPath, sheetName)
		#保存成功的弹出框
		resourceMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(resourceData)):
			data = resourceData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					self.resource.click_del_button(data[2])
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", resourceMsg, data, flag)
					self.cmf.click_msg_button(1)
			except Exception as e:
				print ("del_resource fail:" + str(e))

		self.log.log_end("del_resource")

	u'''全选删除资源'''
	def bulkdel_resource_006(self):

		#日志开始记录
		self.log.log_start("bulkdel_resource")
		#获取添加资源测试数据
		resourceData = self.get_resource_table_data("bulkdel_resource")
		#保存成功的弹出框
		resourceMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(resourceData)):
			data = resourceData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					self.cmf.check_all()
					self.cmf.bulkdel("delete_resource")
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", resourceMsg, data, flag)
					self.cmf.click_msg_button(1)
			except Exception as e:
				print ("bulkdel_resource failure:" + str(e))

		self.log.log_end("bulkdel_resource")
class testResourceAccount(object):

	def __init__(self, driver):
		self.driver = driver
		self.log = log()
		self.cmf = commonFun(driver)
		self.frameElem = frameElement(driver)
		self.testrole = testRole(driver)
		self.linux = LinuxResource(driver)
		self.account = Accountmgr(driver)
		self.role = Role(driver)
		self.data = dataFileName()

	u'''添加和编辑资源账号'''
	def add_edit_resource_account_001(self, dataPath, sheetName):

		#日志开始记录
		self.log.log_start("add_edit_resource_account")
		#获取添加资源账号测试数据
		accountData = self.data.get_data(dataPath, sheetName)
		#保存成功的弹出框
		accountMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(accountData)):
			data = accountData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					#点击账号管理
					if dataRow == 1:
						self.account.click_account_manage_button(data[2])
					self.linux.add_edit_resource_account(data[3], data[4], data[5], data[6], data[7])
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", accountMsg, data, flag)
					self.cmf.back()
			except Exception as e:
				print ("add_edit_resource_account fail:" + str(e))
		self.cmf.back()

		self.log.log_end("add_edit_resource_account")

	u'''查询资源账号'''
	def query_resource_account_002(self, dataPath, sheetName):

		#日志开始记录
		self.log.log_start("query_resource_account")
		#获取查询资源账号测试数据
		accountData = self.data.get_data(dataPath, sheetName)

		for dataRow in range(len(accountData)):
			data = accountData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					if dataRow == 1:
						self.account.click_account_manage_button(data[1])
						self.account.query_name(data[2])
					if dataRow == 2 or dataRow == 3:
						self.account.is_authorize(data[3])
					if dataRow == 4:
						self.account.query_name(data[2])
						self.account.is_authorize(data[3])
					self.account.click_account_query()
					self.role.click_reset()
					self.log.log_detail(data[0], True)
			except Exception as e:
				print ("query_resource_account fail:" + str(e))
		self.cmf.back()

		self.log.log_end("query_resource_account")

	u'''检验资源账号'''
	def check_resource_account_003(self, dataPath, sheetName):

		#日志开始记录
		self.log.log_start("check_resource_account")
		#获取检验资源测试数据
		resourceData = self.data.get_data(dataPath, sheetName)
		#保存成功的弹出框
		resourceMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(resourceData)):
			data = resourceData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					if dataRow == 1:
						self.account.click_account_manage_button(data[2])
						self.account.click_account_add_edit_button()
					self.linux.check_resource_account(data[3], data[4], data[5], data[6])
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", resourceMsg, data, flag)
			except Exception as e:
				print ("check_resource_account fail:" + str(e))

		self.cmf.back()

		self.cmf.back()

		self.log.log_end("check_resource_account")

	u'''删除资源账号'''
	def del_resource_account_004(self, dataPath, sheetName):

		#日志开始记录
		self.log.log_start("del_resource_account")
		#获取删除资源账号测试数据
		accountData = self.data.get_data(dataPath, sheetName)
		#保存成功的弹出框
		accountMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(accountData)):
			data = accountData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					self.account.click_account_manage_button(data[2])
					self.account.click_account_del(data[3])
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", accountMsg, data, flag)
					self.cmf.click_msg_button(1)
			except Exception as e:
				print ("del_resource_account fail:" + str(e))
		self.cmf.back()
		self.log.log_end("del_resource_account")

	u'''全选删除资源账号'''
	def bulkdel_resource_account_005(self, dataPath, sheetName):

		#日志开始记录
		self.log.log_start("bulkdel_resource_account")
		#获取全选删除资源账号测试数据
		accountData = self.data.get_data(dataPath, sheetName)
		#保存成功的弹出框
		accountMsg = self.testrole.popup()

		#无检查点的测试项标识,如果为True说明通过
		flag = False

		for dataRow in range(len(accountData)):
			data = accountData[dataRow]
			try:
				#如果不是第一行标题,则读取数据
				if dataRow != 0:
					self.account.click_account_manage_button(data[2])
					self.cmf.check_all()
					self.cmf.bulkdel("delete_account")
					self.frameElem.switch_to_content()
					self.cmf.test_win_check_point("xpath", accountMsg, data, flag)
					self.cmf.click_msg_button(1)
			except Exception as e:
				print ("bulkdel_resource_account failure:" + str(e))
		self.cmf.back()

		self.log.log_end("bulkdel_resource_account")