Lines Matching refs:self

26     def setUp(self):  argument
28 self.res_single_no_error = cmd_result.CmdResult('stdout', '', 0)
30 self.res_multiple_no_error = cmd_result.CmdResult('stdout1', '', 0)
31 self.res_multiple_no_error.AddResult('stdout2', '', 0)
33 self.res_multiple_one_error = cmd_result.CmdResult('stdout1', '', 0)
34 self.res_multiple_one_error.AddResult('stdout2', 'stderr2', 1)
36 self.res_multiple_one_stderr_only = cmd_result.CmdResult('stdout1', '', 0)
37 self.res_multiple_one_stderr_only.AddResult('stdout2', 'stderr2', 0)
39 self.res_multiple_with_cmd_and_exception = cmd_result.CmdResult(
41 self.res_multiple_with_cmd_and_exception.AddResult(
44 def tearDown(self): argument
47 def test_single_result_data(self): argument
49 self.assertEqual(self.res_single_no_error.stdout, 'stdout')
50 self.assertEqual(self.res_single_no_error.stderr, '')
51 self.assertEqual(self.res_single_no_error.returncode, 0)
52 self.assertEqual(self.res_single_no_error.stdouts[-1], 'stdout')
53 self.assertEqual(self.res_single_no_error.stderrs[-1], '')
54 self.assertEqual(self.res_single_no_error.returncodes[-1], 0)
56 def test_multiple_result_data(self): argument
58 self.assertEqual(self.res_multiple_no_error.stdout, 'stdout2')
59 self.assertEqual(self.res_multiple_no_error.stderr, '')
60 self.assertEqual(self.res_multiple_no_error.returncode, 0)
61 self.assertEqual(self.res_multiple_no_error.stdouts, ['stdout1', 'stdout2'])
62 self.assertEqual(self.res_multiple_no_error.stderrs, ['', ''])
63 self.assertEqual(self.res_multiple_no_error.returncodes, [0, 0])
65 def test_legacy_single_result_dictionary_support_no_error(self): argument
67 self.assertEqual(self.res_single_no_error[cmd_utils.STDOUT][0], 'stdout')
68 self.assertFalse(self.res_single_no_error[cmd_utils.STDERR][0])
69 self.assertFalse(any(self.res_single_no_error[cmd_utils.STDERR]))
70 self.assertFalse(self.res_single_no_error[cmd_utils.EXIT_CODE][0])
71 self.assertFalse(any(self.res_single_no_error[cmd_utils.EXIT_CODE]))
73 def test_legacy_single_result_dictionary_support_no_error_wrong_key(self): argument
76 self.res_single_no_error["wrong key"]
82 self.assertFalse(True, "wrong key should raise KeyError exception")
84 def test_legacy_multiple_result_dictionary_support_no_error(self): argument
86 self.assertEqual(self.res_multiple_no_error[cmd_utils.STDOUT][0], 'stdout1')
87 self.assertEqual(self.res_multiple_no_error[cmd_utils.STDOUT][1], 'stdout2')
88 self.assertFalse(any(self.res_multiple_no_error[cmd_utils.STDERR]))
89 self.assertFalse(any(self.res_multiple_no_error[cmd_utils.EXIT_CODE]))
91 def test_legacy_multiple_result_dictionary_support_one_error(self): argument
93 self.assertTrue(any(self.res_multiple_one_error[cmd_utils.STDERR]))
94 self.assertTrue(any(self.res_multiple_one_error[cmd_utils.EXIT_CODE]))
96 def test_legacy_multiple_result_dictionary_support_one_stderr_only(self): argument
98 self.assertTrue(any(self.res_multiple_one_stderr_only[cmd_utils.STDERR]))
99 self.assertFalse(any(self.res_multiple_one_stderr_only[cmd_utils.EXIT_CODE]))
101 def test_multiple_result_with_cmd_and_exception(self): argument
103 self.assertEqual(self.res_multiple_with_cmd_and_exception.cmd, 'cmd2')
104 self.assertEqual(self.res_multiple_with_cmd_and_exception.cmds, ['cmd1', 'cmd2'])
105 self.assertEqual(self.res_multiple_with_cmd_and_exception.exception, 'TCP connection lost')
106 self.assertEqual(self.res_multiple_with_cmd_and_exception.exceptions,