Diff comments:

> diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
> index fc6b9d4..f8d416c 100644
> --- a/tests/unittests/test_util.py
> +++ b/tests/unittests/test_util.py
> @@ -604,11 +604,70 @@ class TestSubp(helpers.TestCase):
>                           util.target_path("/target/", "///my/path/"))
>  
>  
> +<<<<<<< tests/unittests/test_util.py

Probably need to do a rebase/conflict fix.

>  class TestEncode(helpers.TestCase):
>      """Test the encoding functions"""
>      def test_decode_binary_plain_text_with_hex(self):
>          blob = 'BOOTABLE_FLAG=\x80init=/bin/systemd'
>          text = util.decode_binary(blob)
>          self.assertEqual(text, blob)
> +=======
> +class TestProcessExecutionError(helpers.TestCase):
> +
> +    template = ('{description}\n'
> +                'Command: {cmd}\n'
> +                'Exit code: {exit_code}\n'
> +                'Reason: {reason}\n'
> +                'Stdout: {stdout}\n'
> +                'Stderr: {stderr}')
> +    empty_attr = '-'
> +    empty_description = 'Unexpected error while running command.'
> +
> +    def test_pexec_error_type(self):
> +        self.assertIsInstance(util.ProcessExecutionError(), IOError)
> +
> +    def test_pexec_error_empty_msgs(self):
> +        error = util.ProcessExecutionError()
> +        self.assertTrue(all(attr == self.empty_attr for attr in
> +                            (error.stderr, error.stdout, error.reason)))
> +        self.assertEqual(error.description, self.empty_description)
> +        self.assertEqual(error.message, self.template.format(
> +            description=self.empty_description, exit_code=self.empty_attr,
> +            reason=self.empty_attr, stdout=self.empty_attr,
> +            stderr=self.empty_attr, cmd=self.empty_attr))
> +
> +    def test_pexec_error_single_line_msgs(self):
> +        stdout_msg = 'out out'
> +        stderr_msg = 'error error'
> +        cmd = 'test command'
> +        exit_code = 3
> +        error = util.ProcessExecutionError(
> +            stdout=stdout_msg, stderr=stderr_msg, exit_code=3, cmd=cmd)
> +        self.assertEqual(error.message, self.template.format(
> +            description=self.empty_description, stdout=stdout_msg,
> +            stderr=stderr_msg, exit_code=str(exit_code),
> +            reason=self.empty_attr, cmd=cmd))
> +
> +    def test_pexec_error_multi_line_msgs(self):
> +        stdout_msg = 'multi\nline\noutput message'
> +        stderr_msg = 'multi\nline\nerror message\n\n\n'
> +        error = util.ProcessExecutionError(
> +            stdout=stdout_msg, stderr=stderr_msg)
> +        self.assertEqual(
> +            error.message,
> +            '\n'.join((
> +                '{description}',
> +                'Command: {empty_attr}',
> +                'Exit code: {empty_attr}',
> +                'Reason: {empty_attr}',
> +                'Stdout: multi',
> +                '        line',
> +                '        output message',
> +                'Stderr: multi',
> +                '        line',
> +                '        error message',
> +            )).format(description=self.empty_description,
> +                      empty_attr=self.empty_attr))
> +>>>>>>> tests/unittests/test_util.py
>  
>  # vi: ts=4 expandtab


-- 
https://code.launchpad.net/~wesley-wiedenmeier/cloud-init/+git/cloud-init/+merge/306731
Your team cloud init development team is requested to review the proposed merge 
of ~wesley-wiedenmeier/cloud-init:error-output into cloud-init:master.

_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to