Commit 6b512d1e authored by Jérome Perrin's avatar Jérome Perrin

accounting_l10n_fr py3

parent 2ad64320
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
"""Test suite for erp5_accounting_l10n_fr """Test suite for erp5_accounting_l10n_fr
""" """
import unittest
import zipfile
import email import email
import io
import os.path import os.path
from six.moves import cStringIO as StringIO import unittest
import zipfile
from DateTime import DateTime from DateTime import DateTime
from lxml import etree from lxml import etree
...@@ -109,7 +109,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -109,7 +109,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
os.path.dirname(Products.ERP5.tests.__file__), os.path.dirname(Products.ERP5.tests.__file__),
'test_data', 'test_data',
noNamespaceSchemaLocation, noNamespaceSchemaLocation,
)) as f: ), 'rb') as f:
xmlschema_doc = etree.parse(f) xmlschema_doc = etree.parse(f)
xmlschema = etree.XMLSchema(xmlschema_doc) xmlschema = etree.XMLSchema(xmlschema_doc)
...@@ -121,14 +121,14 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -121,14 +121,14 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertNotEqual((), last_message) self.assertNotEqual((), last_message)
_, mto, message_text = last_message _, mto, message_text = last_message
self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0]) self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0])
mail_message = email.message_from_string(message_text) mail_message = email.message_from_string(message_text.decode())
for part in mail_message.walk(): for part in mail_message.walk():
content_type = part.get_content_type() content_type = part.get_content_type()
file_name = part.get_filename() file_name = part.get_filename()
if file_name == 'FEC-20141231.zip': if file_name == 'FEC-20141231.zip':
self.assertEqual('application/zip', content_type) self.assertEqual('application/zip', content_type)
data = part.get_payload(decode=True) data = part.get_payload(decode=True)
zf = zipfile.ZipFile(StringIO(data)) zf = zipfile.ZipFile(io.BytesIO(data))
self.assertIn("12345689FEC20141231.xml", zf.namelist()) self.assertIn("12345689FEC20141231.xml", zf.namelist())
return zf.open("12345689FEC20141231.xml").read() return zf.open("12345689FEC20141231.xml").read()
self.fail("Attachment not found") self.fail("Attachment not found")
...@@ -253,7 +253,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -253,7 +253,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture'], ecriture_list) self.assertEqual(['Premiere Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -269,7 +269,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -269,7 +269,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Seconde Ecriture'], ecriture_list) self.assertEqual(['Seconde Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -289,7 +289,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -289,7 +289,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture'], ecriture_list) self.assertEqual(['Premiere Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -305,7 +305,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -305,7 +305,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Seconde Ecriture', 'Troisieme Ecriture'], ecriture_list) self.assertEqual(['Seconde Ecriture', 'Troisieme Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -324,7 +324,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -324,7 +324,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture', 'Seconde Ecriture'], ecriture_list) self.assertEqual(['Premiere Ecriture', 'Seconde Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -340,7 +340,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -340,7 +340,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Troisieme Ecriture'], ecriture_list) self.assertEqual(['Troisieme Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -359,7 +359,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -359,7 +359,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Premiere Ecriture'], ecriture_list) self.assertEqual(['Premiere Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -375,7 +375,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -375,7 +375,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Seconde Ecriture'], ecriture_list) self.assertEqual(['Seconde Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
...@@ -391,7 +391,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -391,7 +391,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.assertEqual(1, len(journal_list)) self.assertEqual(1, len(journal_list))
journal = journal_list[0] journal = journal_list[0]
ecriture_list = sorted([x.text.encode('utf-8') for x in journal.xpath(".//EcritureLib")]) ecriture_list = sorted([x.text for x in journal.xpath(".//EcritureLib")])
self.assertEqual(['Troisieme Ecriture'], ecriture_list) self.assertEqual(['Troisieme Ecriture'], ecriture_list)
debit_list = journal.xpath(".//Debit") debit_list = journal.xpath(".//Debit")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment