Move export and upload actions to admin dashboard
Some checks failed
CI/CD Pipeline / Code Quality Checks (push) Failing after 2m8s
CI/CD Pipeline / Run Tests (push) Successful in 2m52s
CI/CD Pipeline / Run API Inventory E2E Tests (push) Successful in 44s
CI/CD Pipeline / Telegram Notify Success (push) Has been skipped

This commit is contained in:
2026-04-22 10:12:08 +02:00
parent 898e492538
commit 92d5ff4252
7 changed files with 155 additions and 37 deletions

View File

@@ -30,6 +30,7 @@ from django.contrib.admin.sites import AdminSite
from django.contrib.messages.storage.fallback import FallbackStorage
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import RequestFactory, TestCase, override_settings
from django.urls import reverse
from openpyxl import Workbook
from tests.apps.parsers.factories import (
@@ -100,6 +101,7 @@ class ParsersAdminTest(TestCase):
self.site = AdminSite()
self.factory = RequestFactory()
self.user = UserFactory.create_superuser()
self.client.force_login(self.user)
def _request(self, path="/"):
request = self.factory.get(path)
@@ -150,17 +152,17 @@ class ParsersAdminTest(TestCase):
self.assertIn("mx-object-tool-form", content)
def test_financial_report_changelist_renders_toolbar_buttons(self):
admin = FinancialReportAdmin(FinancialReport, self.site)
response = admin.changelist_view(
self._request("/admin/parsers/financialreport/")
)
response.render()
response = self.client.get(reverse("admin:index"))
content = response.content.decode("utf-8")
self.assertEqual(response.status_code, 200)
self.assertIn("Загрузить Excel бухгалтерской отчетности", content)
self.assertIn("Загрузить ZIP бухгалтерской отчетности", content)
self.assertIn("mx-admin-action-bar", content)
self.assertIn("ФНС Excel", content)
self.assertIn("ФНС ZIP", content)
self.assertIn(
reverse("admin:parsers_financialreport_upload_excel"),
content,
)
self.assertIn(reverse("admin:parsers_financialreport_upload_zip"), content)
@patch("apps.parsers.admin.ProxyToolsSyncService.sync_ru_proxies")
def test_proxy_admin_sync_view_calls_service(self, sync_mock):