Re: [PATCH 6/6] parsemail tests: add test for mail with utf-8

2016-09-25 Thread Daniel Axtens
> I think this can be squashed into the previous patch, but otherwise:
>
> Reviewed-by: Stephen Finucane 

Fair point. Will squash it for v2.

Regards,
Daniel
>
>>  patchwork/tests/test_management.py | 29 +
>>  1 file changed, 29 insertions(+)
>> 
>> diff --git a/patchwork/tests/test_management.py 
>> b/patchwork/tests/test_management.py
>> index 5f97aa76866f..4b49131a72c2 100644
>> --- a/patchwork/tests/test_management.py
>> +++ b/patchwork/tests/test_management.py
>> @@ -81,3 +81,32 @@ class ParsemailTest(TestCase):
>>  
>>  count = models.Patch.objects.filter(project=project.id).count()
>>  self.assertEqual(count, 1)
>> +
>> +def test_utf8_path(self):
>> +project = utils.create_project()
>> +utils.create_state()
>> +
>> +path = os.path.join(TEST_MAIL_DIR, '0013-with-utf8-body.mbox')
>> +with self.assertRaises(SystemExit) as exc:
>> +call_command('parsemail', infile=path, list_id=project.listid)
>> +
>> +self.assertEqual(exc.exception.code, 0)
>> +
>> +count = models.Patch.objects.filter(project=project.id).count()
>> +self.assertEqual(count, 1)
>> +
>> +def test_utf8_stdin(self):
>> +project = utils.create_project()
>> +utils.create_state()
>> +
>> +path = os.path.join(TEST_MAIL_DIR, '0013-with-utf8-body.mbox')
>> +sys.stdin.close()
>> +sys.stdin = open(path)
>
> Yeah, this makes more sense.
>
>> +with self.assertRaises(SystemExit) as exc:
>> +call_command('parsemail', infile=None,
>> + list_id=project.listid)
>> +
>> +self.assertEqual(exc.exception.code, 0)
>> +
>> +count = models.Patch.objects.filter(project=project.id).count()
>> +self.assertEqual(count, 1)
>> -- 
>> 2.7.4
>> 
___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork


Re: [PATCH 6/6] parsemail tests: add test for mail with utf-8

2016-09-25 Thread Stephen Finucane
On 23 Sep 10:06, Daniel Axtens wrote:
> This is designed to ensure we don't have any more hiccups with
> decoding UTF-8 under arbitrary locales, which can occur under
> Python 3.
> 
> Signed-off-by: Daniel Axtens 

I think this can be squashed into the previous patch, but otherwise:

Reviewed-by: Stephen Finucane 

>  patchwork/tests/test_management.py | 29 +
>  1 file changed, 29 insertions(+)
> 
> diff --git a/patchwork/tests/test_management.py 
> b/patchwork/tests/test_management.py
> index 5f97aa76866f..4b49131a72c2 100644
> --- a/patchwork/tests/test_management.py
> +++ b/patchwork/tests/test_management.py
> @@ -81,3 +81,32 @@ class ParsemailTest(TestCase):
>  
>  count = models.Patch.objects.filter(project=project.id).count()
>  self.assertEqual(count, 1)
> +
> +def test_utf8_path(self):
> +project = utils.create_project()
> +utils.create_state()
> +
> +path = os.path.join(TEST_MAIL_DIR, '0013-with-utf8-body.mbox')
> +with self.assertRaises(SystemExit) as exc:
> +call_command('parsemail', infile=path, list_id=project.listid)
> +
> +self.assertEqual(exc.exception.code, 0)
> +
> +count = models.Patch.objects.filter(project=project.id).count()
> +self.assertEqual(count, 1)
> +
> +def test_utf8_stdin(self):
> +project = utils.create_project()
> +utils.create_state()
> +
> +path = os.path.join(TEST_MAIL_DIR, '0013-with-utf8-body.mbox')
> +sys.stdin.close()
> +sys.stdin = open(path)

Yeah, this makes more sense.

> +with self.assertRaises(SystemExit) as exc:
> +call_command('parsemail', infile=None,
> + list_id=project.listid)
> +
> +self.assertEqual(exc.exception.code, 0)
> +
> +count = models.Patch.objects.filter(project=project.id).count()
> +self.assertEqual(count, 1)
> -- 
> 2.7.4
> 
___
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork