示例#1
0
 def test_operator_define_operator_error_2(self, mock_error):
     op = Operator()
     op.no_failed = 0
     op.define_operator(self.hostname, 12, 'mock_xpath', ['ele1'], 'mock_err', 'mock_info', 'mock command',
                        True, ['mock_id'], 'test_name')
     self.assertEqual(op.no_failed, 1)           #attribute error
     mock_error.assert_called()
示例#2
0
 def test_operator_define_operator_error_2(self, mock_error):
     op = Operator()
     op.no_failed = 0
     op.define_operator(self.hostname, 12, 'mock_xpath', ['ele1'], 'mock_err', 'mock_info', 'mock command',
                        True, ['mock_id'], 'test_name')
     self.assertEqual(op.no_failed, 1)           #attribute error
     mock_error.assert_called()
示例#3
0
 def test_operator_define_operator_error_3(self, mock_error, mock_all_same):
     mock_all_same.side_effect = etree.XPathEvalError('Xpath Mock Error')
     op = Operator()
     op.no_failed = 0
     op.define_operator(self.hostname, 'all-same', 'mock_xpath', ['ele1'], 'mock_err', 'mock_info', 'mock command',
                        True, ['mock_id'], 'test_name')
     self.assertEqual(op.no_failed, 1)       #xpathError
     mock_error.assert_called_with('\x1b[31mError in evaluating XPATH, \nComplete Message: Xpath Mock Error', extra='1.1.1.1')
示例#4
0
 def test_operator_define_operator_error_3(self, mock_error, mock_all_same):
     mock_all_same.side_effect = etree.XPathEvalError('Xpath Mock Error')
     op = Operator()
     op.no_failed = 0
     op.define_operator(self.hostname, 'all-same', 'mock_xpath', ['ele1'], 'mock_err', 'mock_info', 'mock command',
                        True, ['mock_id'], 'test_name')
     self.assertEqual(op.no_failed, 1)       #xpathError
     mock_error.assert_called_with('\x1b[31mError in evaluating XPATH, \nComplete Message: Xpath Mock Error', extra='1.1.1.1')
示例#5
0
 def test_operator_define_operator_error_1(self, mock_error):
     op = Operator()
     op.no_failed = 0
     op.define_operator(self.hostname, 'all-same', 'mock_xpath', ['ele1'],
                        'mock_err', 'mock_info', 'mock command', True,
                        ['mock_id'], 'test_name')
     self.assertEqual(op.no_failed, 1)
     mock_error.assert_called(
     )  #error called because the all_same requires 2 more args
示例#6
0
 def test_operator_define_operator_error_1(self,mock_error):
     op = Operator()
     op.no_failed = 0
     op.define_operator(self.hostname,'all-same','mock_xpath',['ele1'],'mock_err','mock_info','mock command',True,['mock_id'], 'test_name')
     self.assertEqual(op.no_failed,1)
     mock_error.assert_called()                  #error called because the all_same requires 2 more args