fix(lint): resolve ruff errors in tests and run_tests.py
- Fix import sorting (I001) - Remove unused imports and variables (F401, F841) - Add noqa for test code (S106 hardcoded passwords, S314 XML parsing) - Auto-format with ruff format
This commit is contained in:
@@ -3,17 +3,15 @@
|
||||
from io import BytesIO
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.test import TestCase, tag
|
||||
|
||||
from faker import Faker
|
||||
from openpyxl import Workbook
|
||||
|
||||
from apps.parsers.clients.base import BaseHTTPClient, HTTPClientError
|
||||
from apps.parsers.clients.minpromtorg.industrial import IndustrialProductionClient
|
||||
from apps.parsers.clients.minpromtorg.manufactures import ManufacturesClient
|
||||
from apps.parsers.clients.minpromtorg.schemas import IndustrialCertificate, Manufacturer
|
||||
from apps.parsers.clients.proverki import ProverkiClient
|
||||
from apps.parsers.clients.proverki.schemas import Inspection
|
||||
from django.test import TestCase, tag
|
||||
from faker import Faker
|
||||
from openpyxl import Workbook
|
||||
|
||||
fake = Faker("ru_RU")
|
||||
|
||||
@@ -159,7 +157,10 @@ class IndustrialProductionClientTest(TestCase):
|
||||
{
|
||||
"name": "Заключения о подтверждении производства промышленной продукции на территории Российской Федерации",
|
||||
"files": [
|
||||
{"name": "data_resolutions_20240101.xlsx", "url": "/files/test.xlsx"},
|
||||
{
|
||||
"name": "data_resolutions_20240101.xlsx",
|
||||
"url": "/files/test.xlsx",
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
@@ -193,9 +194,18 @@ class IndustrialProductionClientTest(TestCase):
|
||||
{
|
||||
"name": "Заключения о подтверждении производства промышленной продукции на территории Российской Федерации",
|
||||
"files": [
|
||||
{"name": "data_resolutions_20240101.xlsx", "url": "/files/old.xlsx"},
|
||||
{"name": "data_resolutions_20240315.xlsx", "url": "/files/new.xlsx"},
|
||||
{"name": "data_resolutions_20240201.xlsx", "url": "/files/mid.xlsx"},
|
||||
{
|
||||
"name": "data_resolutions_20240101.xlsx",
|
||||
"url": "/files/old.xlsx",
|
||||
},
|
||||
{
|
||||
"name": "data_resolutions_20240315.xlsx",
|
||||
"url": "/files/new.xlsx",
|
||||
},
|
||||
{
|
||||
"name": "data_resolutions_20240201.xlsx",
|
||||
"url": "/files/mid.xlsx",
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
@@ -539,7 +549,7 @@ class ProverkiClientTest(TestCase):
|
||||
|
||||
client = ProverkiClient()
|
||||
xml_str = '<inspection inn="1234567890" registration_number="TEST123" organisation_name="Test Co"/>'
|
||||
element = ET.fromstring(xml_str)
|
||||
element = ET.fromstring(xml_str) # noqa: S314
|
||||
|
||||
result = client._parse_xml_record(element)
|
||||
|
||||
@@ -553,7 +563,7 @@ class ProverkiClientTest(TestCase):
|
||||
|
||||
client = ProverkiClient()
|
||||
xml_str = "<empty_record></empty_record>"
|
||||
element = ET.fromstring(xml_str)
|
||||
element = ET.fromstring(xml_str) # noqa: S314
|
||||
|
||||
result = client._parse_xml_record(element)
|
||||
|
||||
@@ -569,9 +579,7 @@ class ProverkiClientTest(TestCase):
|
||||
<registration_number>TEST001</registration_number>
|
||||
<organisation_name>Компания</organisation_name>
|
||||
</inspection>
|
||||
</inspections>""".encode(
|
||||
"windows-1251"
|
||||
)
|
||||
</inspections>""".encode("windows-1251")
|
||||
|
||||
inspections = client._parse_xml_content(xml_content, None)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user