feat: обновления парсеров, тестов и миграций
Some checks failed
CI/CD Pipeline / Run Tests (push) Failing after 37s
CI/CD Pipeline / Code Quality Checks (push) Failing after 43s
CI/CD Pipeline / Build & Push Images (push) Has been skipped
CI/CD Pipeline / Deploy (dev) (push) Has been skipped
CI/CD Pipeline / Deploy (prod) (push) Has been skipped
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 0s
CI/CD Pipeline / Run Tests (pull_request) Failing after 0s
CI/CD Pipeline / Build & Push Images (pull_request) Has been skipped
CI/CD Pipeline / Deploy (dev) (pull_request) Has been skipped
CI/CD Pipeline / Deploy (prod) (pull_request) Has been skipped
Some checks failed
CI/CD Pipeline / Run Tests (push) Failing after 37s
CI/CD Pipeline / Code Quality Checks (push) Failing after 43s
CI/CD Pipeline / Build & Push Images (push) Has been skipped
CI/CD Pipeline / Deploy (dev) (push) Has been skipped
CI/CD Pipeline / Deploy (prod) (push) Has been skipped
CI/CD Pipeline / Code Quality Checks (pull_request) Failing after 0s
CI/CD Pipeline / Run Tests (pull_request) Failing after 0s
CI/CD Pipeline / Build & Push Images (pull_request) Has been skipped
CI/CD Pipeline / Deploy (dev) (pull_request) Has been skipped
CI/CD Pipeline / Deploy (prod) (pull_request) Has been skipped
- Обновлены клиенты парсеров (checko, fns, minpromtorg, proverki, zakupki) - Добавлены новые миграции для моделей - Расширено покрытие тестами - Обновлены конфигурации и настройки проекта - Добавлены утилиты для тестирования Co-Authored-By: Warp <agent@warp.dev>
This commit is contained in:
@@ -13,6 +13,11 @@ from .factories import (
|
||||
ManufacturerRecordFactory,
|
||||
ParserLoadLogFactory,
|
||||
ProxyFactory,
|
||||
fake,
|
||||
generate_certificate_number,
|
||||
generate_company_name,
|
||||
generate_inn_legal,
|
||||
generate_proxy_address,
|
||||
)
|
||||
|
||||
|
||||
@@ -30,11 +35,12 @@ class ProxyModelTest(TestCase):
|
||||
|
||||
def test_proxy_str(self):
|
||||
"""Test proxy string representation."""
|
||||
proxy = ProxyFactory(address="http://proxy:8080", is_active=True)
|
||||
self.assertEqual(str(proxy), "http://proxy:8080 (active)")
|
||||
address = generate_proxy_address()
|
||||
proxy = ProxyFactory(address=address, is_active=True)
|
||||
self.assertEqual(str(proxy), f"{address} (active)")
|
||||
|
||||
proxy.is_active = False
|
||||
self.assertEqual(str(proxy), "http://proxy:8080 (inactive)")
|
||||
self.assertEqual(str(proxy), f"{address} (inactive)")
|
||||
|
||||
def test_proxy_ordering(self):
|
||||
"""Test proxy ordering by fail_count."""
|
||||
@@ -49,12 +55,13 @@ class ProxyModelTest(TestCase):
|
||||
|
||||
def test_proxy_unique_address(self):
|
||||
"""Test proxy address uniqueness."""
|
||||
ProxyFactory(address="http://unique:8080")
|
||||
address = generate_proxy_address()
|
||||
ProxyFactory(address=address)
|
||||
|
||||
from django.db import IntegrityError
|
||||
|
||||
with self.assertRaises(IntegrityError):
|
||||
ProxyFactory(address="http://unique:8080")
|
||||
ProxyFactory(address=address)
|
||||
|
||||
|
||||
class ParserLoadLogModelTest(TestCase):
|
||||
@@ -70,11 +77,15 @@ class ParserLoadLogModelTest(TestCase):
|
||||
|
||||
def test_load_log_str(self):
|
||||
"""Test load log string representation."""
|
||||
batch_id = fake.random_int(min=1, max=999)
|
||||
records_count = fake.random_int(min=1, max=5000)
|
||||
log = ParserLoadLogFactory(
|
||||
batch_id=42, source=ParserLoadLog.Source.INDUSTRIAL, records_count=100
|
||||
batch_id=batch_id,
|
||||
source=ParserLoadLog.Source.INDUSTRIAL,
|
||||
records_count=records_count,
|
||||
)
|
||||
self.assertIn("42", str(log))
|
||||
self.assertIn("100", str(log))
|
||||
self.assertIn(str(batch_id), str(log))
|
||||
self.assertIn(str(records_count), str(log))
|
||||
|
||||
def test_load_log_timestamps(self):
|
||||
"""Test load log has timestamps from mixin."""
|
||||
@@ -98,11 +109,14 @@ class IndustrialCertificateRecordModelTest(TestCase):
|
||||
|
||||
def test_certificate_str(self):
|
||||
"""Test certificate string representation."""
|
||||
certificate_number = generate_certificate_number()
|
||||
organisation_name = generate_company_name()
|
||||
cert = IndustrialCertificateRecordFactory(
|
||||
certificate_number="CERT-123", organisation_name="Test Company LLC"
|
||||
certificate_number=certificate_number,
|
||||
organisation_name=organisation_name,
|
||||
)
|
||||
self.assertIn("CERT-123", str(cert))
|
||||
self.assertIn("Test Company", str(cert))
|
||||
self.assertIn(certificate_number, str(cert))
|
||||
self.assertIn(organisation_name[:50], str(cert))
|
||||
|
||||
def test_certificate_timestamps(self):
|
||||
"""Test certificate has timestamps from mixin."""
|
||||
@@ -126,11 +140,14 @@ class ManufacturerRecordModelTest(TestCase):
|
||||
|
||||
def test_manufacturer_str(self):
|
||||
"""Test manufacturer string representation."""
|
||||
inn = generate_inn_legal()
|
||||
company_name = generate_company_name()
|
||||
manufacturer = ManufacturerRecordFactory(
|
||||
inn="1234567890", full_legal_name="Test Manufacturing Company"
|
||||
inn=inn,
|
||||
full_legal_name=company_name,
|
||||
)
|
||||
self.assertIn("1234567890", str(manufacturer))
|
||||
self.assertIn("Test Manufacturing", str(manufacturer))
|
||||
self.assertIn(inn, str(manufacturer))
|
||||
self.assertIn(company_name[:50], str(manufacturer))
|
||||
|
||||
def test_manufacturer_timestamps(self):
|
||||
"""Test manufacturer has timestamps from mixin."""
|
||||
|
||||
Reference in New Issue
Block a user