marton levente vor 3 Monaten
Ursprung
Commit
6f06468542
2 geänderte Dateien mit 11 neuen und 12 gelöschten Zeilen
  1. 10 11
      tests/test_anafoauth.py
  2. 1 1
      tests/test_anafspv.py

+ 10 - 11
tests/test_anafoauth.py

@@ -3,7 +3,6 @@
 import platform
 import unittest
 import os
-from typing import Union
 from datetime import datetime
 
 import ujson
@@ -156,7 +155,7 @@ class efactTest(unittest.TestCase):
         print(latest)
         # os.replace(latest, latest.replace('.xml'.lower(), '_booked.xml'))
 
-    def test_rename_all(self, dir_path, kind: Union[str, 'seller', 'buyer']):  # @UndefinedVariable
+    def test_rename_all(self, dir_path, kind: str):  # @UndefinedVariable
         if kind == 'seller':
             account = 'AccountingCustomerParty'
             # print(os.path.basename(dir_path))
@@ -175,25 +174,25 @@ class efactTest(unittest.TestCase):
                         tree = etree.parse(os.path.join(root_f, file))
                         root = tree.getroot()
                         inv_id = root.xpath('//cbc:ID', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
-                        inv_id = inv_id[0].text
+                        inv_id = inv_id[0].text # noqa
                         parties = root.xpath('//cbc:RegistrationName', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
-                        for partie in parties:
-                            parent_p_type = partie.getparent().getparent().getparent()
+                        for partie in parties: # noqa
+                            parent_p_type = partie.getparent().getparent().getparent() # noqa
                             if etree.QName(parent_p_type).localname == account:  # @UndefinedVariable
                                 # print(partie.text)
-                                file_partie = partie.text
+                                file_partie = partie.text # noqa
 
                         is_date = root.xpath('//cbc:IssueDate', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
-                        is_date = is_date[0].text
+                        is_date = is_date[0].text # noqa
 
                         partie_ids = root.xpath('//cbc:CompanyID', namespaces={'cbc': 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2'})
-                        for partie_id in partie_ids:
-                            parent_p_type = partie_id.getparent().getparent().getparent()
-                            parent_t_type = partie_id.getparent()
+                        for partie_id in partie_ids: # noqa
+                            parent_p_type = partie_id.getparent().getparent().getparent() # noqa
+                            parent_t_type = partie_id.getparent() # noqa
                             # print(parent_t_type)
                             if etree.QName(parent_t_type).localname == 'PartyTaxScheme' and etree.QName(parent_p_type).localname == account:  # @UndefinedVariable
                                 # print(partie_id.text)
-                                file_partn_id = partie_id.text
+                                file_partn_id = partie_id.text # noqa
                         new_name = '{}_{}_{}_{}.xml'.format(file.replace('.xml', ''), inv_id, file_partie, is_date)
                         current_path = os.path.join(root_f, file)
                         new_path = os.path.join(root_f, new_name)

+ 1 - 1
tests/test_anafspv.py

@@ -15,7 +15,7 @@ class spvTest(unittest.TestCase):
         messages = self.spv.get_messages(10)
         pprint.pprint(messages)
         for message in messages['mesaje']:  # -1:
-            date_ = date.today() - timedelta(days=5)
+            date_ = date.today() - timedelta(days=0)
             if message['created_date'] == date_.strftime('%d-%b-%Y'):  # '15-Jan-2023':
                 self.spv.download_message(message['cif'], id_=message['id'], details=message['detalii'])
         # self.spv.download_message('27100508', id_='556755658', details=message['tip'])