当前位置: 首页>>代码示例>>Python>>正文


Python TestResult.add方法代码示例

本文整理汇总了Python中test_helper.TestResult.add方法的典型用法代码示例。如果您正苦于以下问题:Python TestResult.add方法的具体用法?Python TestResult.add怎么用?Python TestResult.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test_helper.TestResult的用法示例。


在下文中一共展示了TestResult.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def run_test(self, cases=None):
		result = TestResult()
		cryptos = ["none", "xor", "des", "3des", "cast128", "xtea", "blowfish", "twofish", "rc2", "aes", "aes256", "aes192", "aes128", "serpent", "gost", "3way"]
		for c in cryptos:
			run_l = None
			run_this = False
			if cases:
				tmp_l = None
				for case in cases:
					if '-' in case:
						(run_c, tmp_l) = case.split('-', 2)
					else:
						run_c = case
					if c == run_c:
						run_l = int(tmp_l) if tmp_l else None
						run_this = True
				if not run_this:
					result.add_message(True, 'Ignoring: %s-*'%c)
					continue
			for l in [128, 512, 1024, 4096]:
				if not run_l or run_l == l:
					result.add(self.test_one_crypto(c, l))
				else:
					result.add_message(True, 'Ignoring: %s-%s'%(c, l))
			#result.add(self.test_one_crypto(c))
		
		return result
开发者ID:0000-bigtree,项目名称:nscp,代码行数:29,代码来源:test_nsca.py

示例2: run_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def run_test(self):
		result = TestResult()
		result.add(self.do_one_test(ssl=True))
		result.add(self.do_one_test(ssl=False))
		result.add(self.do_one_test(ssl=True, length=4096))
		result.add(self.do_one_test(ssl=True, length=65536))
		result.add(self.do_one_test(ssl=True, length=1048576))
		return result
开发者ID:Fox-Alpha,项目名称:nscp,代码行数:10,代码来源:test_nrpe.py

示例3: run_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def run_test(self):
		result = TestResult()
		cryptos = ["none", "xor", "des", "3des", "cast128", "xtea", "blowfish", "twofish", "rc2", "aes", "aes256", "aes192", "aes128", "serpent", "gost", "3way"]
		for c in cryptos:
			for l in [128, 512, 1024, 4096]:
				result.add(self.test_one_crypto(c, l))
			#result.add(self.test_one_crypto(c))
		
		return result
开发者ID:jkells,项目名称:nscp,代码行数:11,代码来源:test_nsca.py

示例4: do_one_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
    def do_one_test(self, ssl=True, length=1024):
        conf = self.conf
        conf.set_int("/settings/NRPE/test_nrpe_server", "payload length", length)
        conf.set_bool("/settings/NRPE/test_nrpe_server", "use ssl", ssl)
        conf.set_bool("/settings/NRPE/test_nrpe_server", "allow arguments", True)
        # TODO: conf.set_string('/settings/NRPE/test_nrpe_server', 'certificate', ssl)
        self.core.reload("test_nrpe_server")

        conf.set_string("/settings/NRPE/test_nrpe_client/targets/default", "address", "nrpe://127.0.0.1:35666")
        conf.set_bool("/settings/NRPE/test_nrpe_client/targets/default", "use ssl", not ssl)
        conf.set_int("/settings/NRPE/test_nrpe_client/targets/default", "payload length", length * 3)

        conf.set_string("/settings/NRPE/test_nrpe_client/targets/invalid", "address", "nrpe://127.0.0.1:25666")
        conf.set_bool("/settings/NRPE/test_nrpe_client/targets/invalid", "use ssl", not ssl)
        conf.set_int("/settings/NRPE/test_nrpe_client/targets/invalid", "payload length", length * 2)

        conf.set_string("/settings/NRPE/test_nrpe_client/targets/valid", "address", "nrpe://127.0.0.1:15666")
        conf.set_bool("/settings/NRPE/test_nrpe_client/targets/valid", "use ssl", ssl)
        conf.set_int("/settings/NRPE/test_nrpe_client/targets/valid", "payload length", length)
        self.core.reload("test_nrpe_client")

        result = TestResult("ssl=%s, length=%s" % (ssl, length))
        result.add_message(isOpen("127.0.0.1", 15666), "Checking that port is open (server is up)")
        result.add(self.test_one(ssl, length, state=status.UNKNOWN, tag="unknown"))
        result.add(self.test_one(ssl, length, state=status.OK, tag="ok"))
        result.add(self.test_one(ssl, length, state=status.WARNING, tag="warn"))
        result.add(self.test_one(ssl, length, state=status.CRITICAL, tag="crit"))
        return result
开发者ID:TaylorMonacelli,项目名称:nscp,代码行数:30,代码来源:test_nrpe.py

示例5: do_one_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def do_one_test(self, ssl=True, length=1024):
		conf = self.conf
		conf.set_int('/settings/NRPE/test_nrpe_server', 'payload length', length)
		conf.set_bool('/settings/NRPE/test_nrpe_server', 'use ssl', ssl)
		conf.set_bool('/settings/NRPE/test_nrpe_server', 'allow arguments', True)
		# TODO: conf.set_string('/settings/NRPE/test_nrpe_server', 'certificate', ssl)
		self.core.reload('test_nrpe_server')

		conf.set_string('/settings/NRPE/test_nrpe_client/targets/default', 'address', 'nrpe://127.0.0.1:35666')
		conf.set_bool('/settings/NRPE/test_nrpe_client/targets/default', 'use ssl', not ssl)
		conf.set_int('/settings/NRPE/test_nrpe_client/targets/default', 'payload length', length*3)

		conf.set_string('/settings/NRPE/test_nrpe_client/targets/invalid', 'address', 'nrpe://127.0.0.1:25666')
		conf.set_bool('/settings/NRPE/test_nrpe_client/targets/invalid', 'use ssl', not ssl)
		conf.set_int('/settings/NRPE/test_nrpe_client/targets/invalid', 'payload length', length*2)

		conf.set_string('/settings/NRPE/test_nrpe_client/targets/valid', 'address', 'nrpe://127.0.0.1:15666')
		conf.set_bool('/settings/NRPE/test_nrpe_client/targets/valid', 'use ssl', ssl)
		conf.set_int('/settings/NRPE/test_nrpe_client/targets/valid', 'payload length', length)
		self.core.reload('test_nrpe_client')
		
		result = TestResult('ssl=%s, length=%s'%(ssl, length))
		result.add_message(isOpen('127.0.0.1', 15666), 'Checking that port is open (server is up)')
		result.add(self.test_one(ssl, length, state = status.UNKNOWN, tag = 'unknown'))
		result.add(self.test_one(ssl, length, state = status.OK, tag = 'ok'))
		result.add(self.test_one(ssl, length, state = status.WARNING, tag = 'warn'))
		result.add(self.test_one(ssl, length, state = status.CRITICAL, tag = 'crit'))
		return result
开发者ID:Fox-Alpha,项目名称:nscp,代码行数:30,代码来源:test_nrpe.py

示例6: run_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def run_test(self):
		result = TestResult('Testing W32 file systems')
		result.add(self.check_cli_ns())
		result.add(self.check_cli_ls(None, 'Win32_Processor', 'LogFileEventConsumer'))
		result.add(self.check_cli_ls('root\subscription', 'LogFileEventConsumer', 'Win32_Processor'))
		result.add(self.check_cli_query('SELECT DeviceId, AddressWidth, Caption, Name FROM Win32_Processor', lambda x:x>1, lambda x:'CPU0' in x))
		return result
开发者ID:Vilse1202,项目名称:nscp,代码行数:9,代码来源:test_w32_wmi.py

示例7: test_one_crypto

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def test_one_crypto(self, crypto, length=512):
		log('Testing: %s %d'%(crypto, length))
		conf = self.conf
		conf.set_string('/settings/NSCA/test_nsca_server', 'encryption', '%s'%crypto)
		conf.set_string('/settings/NSCA/test_nsca_server', 'password', 'pwd-%s'%crypto)
		conf.set_int('/settings/NSCA/test_nsca_server', 'payload length', length)
		self.core.reload('test_nsca_server')
		
		conf.set_string('/settings/NSCA/test_nsca_client/targets/default', 'address', 'nsca://127.0.0.1:35667')
		conf.set_string('/settings/NSCA/test_nsca_client/targets/default', 'encryption', '%s'%crypto)
		conf.set_string('/settings/NSCA/test_nsca_client/targets/default', 'password', 'default-%s'%crypto)
		conf.set_int('/settings/NSCA/test_nsca_client/targets/default', 'payload length', length*3)

		conf.set_string('/settings/NSCA/test_nsca_client/targets/invalid', 'address', 'nsca://127.0.0.1:25667')
		conf.set_string('/settings/NSCA/test_nsca_client/targets/invalid', 'encryption', 'none')
		conf.set_string('/settings/NSCA/test_nsca_client/targets/invalid', 'password', 'invalid-%s'%crypto)
		conf.set_int('/settings/NSCA/test_nsca_client/targets/invalid', 'payload length', length*2)

		conf.set_string('/settings/NSCA/test_nsca_client/targets/valid', 'address', 'nsca://127.0.0.1:15667')
		conf.set_string('/settings/NSCA/test_nsca_client/targets/valid', 'encryption', '%s'%crypto)
		conf.set_string('/settings/NSCA/test_nsca_client/targets/valid', 'password', 'pwd-%s'%crypto)
		conf.set_int('/settings/NSCA/test_nsca_client/targets/valid', 'payload length', length)
		self.core.reload('test_nsca_client')

		
		
		result = TestResult('Testing: %s/%d'%(crypto, length))
		result.add_message(isOpen('localhost', 15667), 'Checking that port is open')
		for target in ['valid', 'test_rp', 'invalid']:
			result.add(self.test_one_crypto_full(crypto, status.UNKNOWN, 'unknown', target, length))
			result.add(self.test_one_crypto_full(crypto, status.OK, 'ok', target, length))
			result.add(self.test_one_crypto_full(crypto, status.WARNING, 'warn', target, length))
			result.add(self.test_one_crypto_full(crypto, status.CRITICAL, 'crit', target, length))
		return result
开发者ID:0000-bigtree,项目名称:nscp,代码行数:36,代码来源:test_nsca.py

示例8: test_one

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
 def test_one(self, ssl=True, length=1024, state=status.UNKNOWN, tag="TODO"):
     result = TestResult("Testing NRPE: %s/%s/%s with various targets" % (ssl, length, tag))
     for t in ["valid", "test_rp", "invalid"]:
         result.add(
             self.submit_payload(
                 "%s/%s/%s" % (ssl, length, tag),
                 ssl,
                 length,
                 "%ssrc%s" % (tag, tag),
                 state,
                 "%smsg%s" % (tag, tag),
                 "",
                 t,
             )
         )
     return result
开发者ID:TaylorMonacelli,项目名称:nscp,代码行数:18,代码来源:test_nrpe.py

示例9: test_simple

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def test_simple(self, command, code, message, perf, tag):
		result = TestResult()
		core = Core.get()
		self.reset_last()
		(ret, msg) = core.simple_submit(self.channel, '%s'%command, code, '%s'%message, '%s'%perf)
		result.add_message(ret, 'Testing channels: %s'%tag, msg)
		r1 = TestResult()
		r1.assert_equals(self.last_status, code, 'Return code')
		r1.assert_equals(self.last_message, message, 'Message')
		r1.assert_equals(self.last_perf, perf, 'Performance data')
		result.add(r1)
		
		self.set_last('', '', code, message, perf)
		(retcode, retmessage, retperf) = core.simple_query(self.channel, [])
		result.add_message(True, 'Testing queries: %s'%tag)
		r2 = TestResult()
		r2.assert_equals(self.last_status, code, 'Return code')
		r2.assert_equals(self.last_message, message, 'Message')
		r2.assert_equals(self.last_perf, perf, 'Performance data')
		result.add(r2)
		return result
开发者ID:0000-bigtree,项目名称:nscp,代码行数:23,代码来源:test_pb.py

示例10: run_test_counters

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def run_test_counters(self):
		result = TestResult('Checking CheckCounter')
		(result_code, result_message) = self.core.simple_exec('any', 'pdh', ['--list', '--all'])
		count = 0
		data = []
		for m in result_message:
			data = m.splitlines()
			count = len(data)
		result.add_message(count > 0, 'Managed to retrieve counters: %d'%count)
		if len(data) == 0:
			result.add_message(False, 'Failed to find counters: %s'%result_message)
		counters = []
		
		
		(subres, name1) = self.check_and_lookup_index(4)
		result.add(subres)
		(subres, name2) = self.check_and_lookup_index(26)
		result.add(subres)
		
		result.add(self.check_counter('\\4\\26', ['ShowAll', 'MaxWarn=10']))
		result.add(self.check_counter('\\4\\26', ['index', 'ShowAll', 'MaxWarn=10']))
		result.add(self.check_counter('\\%s\\%s'%(name1, name2), ['ShowAll', 'MaxWarn=10']))
		return result
开发者ID:0000-bigtree,项目名称:nscp,代码行数:25,代码来源:test_w32_system.py

示例11: run_test_proc

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def run_test_proc(self):
		master = TestResult('Checking check_process')
		
		result = TestResult('0 notepads running')
		for j in range(0,3):
			result.append(self.test_one_proc_int('notepad.exe', 0, j))
		master.add(result)
		
		pids = []
		for i in range(1,4):
			result = TestResult('%d notepads running'%i)
			log('Starting notepad...')
			handle = subprocess.Popen('notepad.exe', shell=False)
			sleep(500)
			pids.append(handle.pid)
			for j in range(0,3):
				result.append(self.test_one_proc_int('notepad.exe', i, j))
			master.add(result)

		for p in pids:
			subprocess.Popen("taskkill /F /T /PID %i"%p , shell=True)

		return master
开发者ID:0000-bigtree,项目名称:nscp,代码行数:25,代码来源:test_w32_system.py

示例12: do_one_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def do_one_test(self, ssl=True):
		conf = Settings.get()
		conf.set_bool('/settings/nscp/test_nscp_server', 'use ssl', ssl)
		conf.set_bool('/settings/nscp/test_nscp_server', 'allow arguments', True)
		# TODO: conf.set_string('/settings/nscp/test_nscp_server', 'certificate', ssl)
		core.reload('test_nscp_server')

		conf.set_string('/settings/nscp/test_nscp_client/targets/default', 'address', 'nscp://127.0.0.1:35668')
		conf.set_bool('/settings/nscp/test_nscp_client/targets/default', 'use ssl', not ssl)

		conf.set_string('/settings/nscp/test_nscp_client/targets/invalid', 'address', 'nscp://127.0.0.1:25668')
		conf.set_bool('/settings/nscp/test_nscp_client/targets/invalid', 'use ssl', not ssl)

		conf.set_string('/settings/nscp/test_nscp_client/targets/valid', 'address', 'nscp://127.0.0.1:15668')
		conf.set_bool('/settings/nscp/test_nscp_client/targets/valid', 'use ssl', ssl)
		core.reload('test_nscp_client')
		
		result = TestResult()
		#result.add_message(isOpen('127.0.0.1', 15668), 'Checking that port is open (server is up)')
		#result.add(self.test_one(ssl, length, state = status.UNKNOWN, tag = 'unknown'))
		result.add(self.test_one(ssl, state = status.OK, tag = 'ok'))
		#result.add(self.test_one(ssl, length, state = status.WARNING, tag = 'warn'))
		#result.add(self.test_one(ssl, length, state = status.CRITICAL, tag = 'crit'))
		return result
开发者ID:0000-bigtree,项目名称:nscp,代码行数:26,代码来源:test_nscp.py

示例13: run_boundry_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
    def run_boundry_test(self):
        result = TestResult("Boundry tests")
        result.add(self.check_bound("none", "count > 1", "none", status.WARNING))
        result.add(self.check_bound("none", "none", "count > 1", status.CRITICAL))
        result.add(self.check_bound("column1 > 5", "count > 2", "count > 5", status.OK))
        result.add(self.check_bound("column1 > 4", "count > 2", "count > 5", status.OK))
        result.add(self.check_bound("column1 > 3", "count > 2", "count > 5", status.WARNING))
        result.add(self.check_bound("column1 > 2", "count > 2", "count > 5", status.WARNING))
        result.add(self.check_bound("column1 > 1", "count > 2", "count > 5", status.WARNING))
        result.add(self.check_bound("column1 > 0", "count > 2", "count > 5", status.CRITICAL))

        result.add(self.check_bound("column1 > 5", "column1 = 3", "none", status.OK))
        result.add(self.check_bound("column1 > 0", "column1 = 3", "none", status.WARNING))

        return result
开发者ID:Fox-Alpha,项目名称:nscp,代码行数:17,代码来源:test_log_file.py

示例14: test_one

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
	def test_one(self, ssl=True, length=1024, state = status.UNKNOWN, tag = 'TODO'):
		result = TestResult('Testing NRPE: %s/%s/%s with various targets'%(ssl, length, tag))
		for t in ['valid', 'test_rp', 'invalid']:
			result.add(self.submit_payload('%s/%s/%s'%(ssl, length, tag), ssl, length, '%ssrc%s'%(tag, tag), state, '%smsg%s'%(tag, tag), '', t))
		return result
开发者ID:Fox-Alpha,项目名称:nscp,代码行数:7,代码来源:test_nrpe.py

示例15: run_test

# 需要导入模块: from test_helper import TestResult [as 别名]
# 或者: from test_helper.TestResult import add [as 别名]
 def run_test(self):
     result = TestResult('Testing W32 task scheduler')
     for (state, code) in [('OK', 0), ('WARN', 1), ('CRIT', 2), ('LONG', 0)]:
         result.add(self.check_ts_query(state, code))
     return result
开发者ID:mickem,项目名称:nscp,代码行数:7,代码来源:test_w32_schetask.py


注:本文中的test_helper.TestResult.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。