Ejemplo n.º 1
0
    def test_param_p(self):
        core._create_result('echo 1', 'p')

        self.assertEqual(len(self.stdout_mock.lines), 1)
        self.assertEqual(self.stdout_mock.lines[0], '1')

        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 2
0
    def test_param_p(self):
        core._create_result('echo 1', 'p')

        self.assertEqual(len(self.stdout_mock.lines), 1)
        self.assertEqual(self.stdout_mock.lines[0], '1')

        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 3
0
    def test_param_e(self):
        with self.assertRaises(core.NonZeroReturnCodeError) as cm:
            core._create_result('cat non_existent_file', 'e')

        result = cm.exception.result

        self.assertEqual(len(self.stdout_mock.lines), 0)

        self.assertGreater(len(self.stderr_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), len(result.stderr_lines))
Ejemplo n.º 4
0
    def test_param_e(self):
        with self.assertRaises(core.NonZeroReturnCodeError) as cm:
            core._create_result('cat non_existent_file', 'e')

        result = cm.exception.result

        self.assertEqual(len(self.stdout_mock.lines), 0)

        self.assertGreater(len(self.stderr_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), len(result.stderr_lines))
Ejemplo n.º 5
0
    def test_simple_echo_failure(self):
        with self.assertRaises(core.NonZeroReturnCodeError) as cm:
            core._create_result('cat non_existent_file', '')

        result = cm.exception.result

        self.assertNotEqual(result.returncode, 0)

        self.assertEqual(result.stdout, '')
        self.assertEqual(len(result.stdout_lines), 0)

        self.assertGreater(len(result.stderr), 0)
        self.assertGreater(len(result.stderr_lines), 0)

        self.assertEqual(len(self.stdout_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 6
0
    def test_param_e(self):
        result = core._create_result('cat non_existent_file', 'e')

        self.assertEqual(len(self.stdout_mock.lines), 0)

        self.assertGreater(len(self.stderr_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), len(result.stderr_lines))
Ejemplo n.º 7
0
    def test_simple_echo_failure(self):
        with self.assertRaises(core.NonZeroReturnCodeError) as cm:
            core._create_result('cat non_existent_file', '')

        result = cm.exception.result

        self.assertNotEqual(result.returncode, 0)

        self.assertEqual(result.stdout, '')
        self.assertEqual(len(result.stdout_lines), 0)

        self.assertGreater(len(result.stderr), 0)
        self.assertGreater(len(result.stderr_lines), 0)

        self.assertEqual(len(self.stdout_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 8
0
    def test_param_e(self):
        result = core._create_result('cat non_existent_file', 'e')

        self.assertEqual(len(self.stdout_mock.lines), 0)

        self.assertGreater(len(self.stderr_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), len(result.stderr_lines))
Ejemplo n.º 9
0
    def test_simple_echo_failure(self):
        result = core._create_result('cat non_existent_file', '')
        self.assertNotEqual(result.returncode, 0)

        self.assertEqual(result.stdout, '')
        self.assertEqual(len(result.stdout_lines), 0)

        self.assertGreater(len(result.stderr), 0)
        self.assertGreater(len(result.stderr_lines), 0)

        self.assertEqual(len(self.stdout_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 10
0
    def test_simple_echo_failure(self):
        result = core._create_result('cat non_existent_file', '')
        self.assertNotEqual(result.returncode, 0)

        self.assertEqual(result.stdout, '')
        self.assertEqual(len(result.stdout_lines), 0)

        self.assertGreater(len(result.stderr), 0)
        self.assertGreater(len(result.stderr_lines), 0)

        self.assertEqual(len(self.stdout_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 11
0
    def test_simple_echo_success(self):
        result = core._create_result('echo 1', '')
        self.assertEqual(result.returncode, 0)

        self.assertEqual(result.stdout, '1')
        self.assertEqual(len(result.stdout_lines), 1)
        self.assertEqual(result.stdout_lines[0], '1')

        self.assertEqual(result.stderr, '')
        self.assertEqual(len(result.stderr_lines), 0)

        self.assertEqual(len(self.stdout_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 12
0
    def test_simple_echo_success(self):
        result = core._create_result('echo 1', '')
        self.assertEqual(result.returncode, 0)

        self.assertEqual(result.stdout, '1')
        self.assertEqual(len(result.stdout_lines), 1)
        self.assertEqual(result.stdout_lines[0], '1')

        self.assertEqual(result.stderr, '')
        self.assertEqual(len(result.stderr_lines), 0)

        self.assertEqual(len(self.stdout_mock.lines), 0)
        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 13
0
    def test_param_p_no_stdout(self):
        core._create_result('cat non_existent_file', 'p')

        self.assertEqual(len(self.stdout_mock.lines), 0)
Ejemplo n.º 14
0
    def test_param_e_no_stderr(self):
        core._create_result('echo 1', 'e')

        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 15
0
    def test_param_p_no_stdout(self):
        with self.assertRaises(core.NonZeroReturnCodeError):
            core._create_result('cat non_existent_file', 'p')

        self.assertEqual(len(self.stdout_mock.lines), 0)
Ejemplo n.º 16
0
    def test_param_p_no_stdout(self):
        core._create_result('cat non_existent_file', 'p')

        self.assertEqual(len(self.stdout_mock.lines), 0)
Ejemplo n.º 17
0
    def test_param_e_no_stderr(self):
        core._create_result('echo 1', 'e')

        self.assertEqual(len(self.stderr_mock.lines), 0)
Ejemplo n.º 18
0
    def test_param_p_no_stdout(self):
        with self.assertRaises(core.NonZeroReturnCodeError):
            core._create_result('cat non_existent_file', 'p')

        self.assertEqual(len(self.stdout_mock.lines), 0)