{"name": "test_invoice_batch_upload_set_invoice_status_acceptance_in_progress", "status": "failed", "statusDetails": {"message": "AssertionError: Handler: POST https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice/send; \n Expected status code: 200; \n Actual status code: 400; \n Response body: {\"message\":\"Failed to send invoice to ACCEPTANCE: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2\",\"localizedMessage\":\"Ошибка при отправке инвойса в ACCEPTANCE\"}; \n X-Aer-Trace-Id:", "trace": "self = <tests.fmcg.test_lk.test_integration.TestIntegrationWithAcceptanceService object at 0x7dd69bfc6bd0>\ncreate_fmcg_sku_by_batch = LKBatchDTO(headers={'Authorization': 'Bearer ba237cf7-e0f8-45c6-b0ef-78492fe1f11d', 'x-aer-mesh': 'dm-hub-service-pack...g_type': 'Тест-пакет', 'has_expiration_date': 'true', 'currency': 'USD', 'category': 'советовать', 'brand': '027413'}])\n\n    def test_invoice_batch_upload_set_invoice_status_acceptance_in_progress(self, create_fmcg_sku_by_batch):\n        \"\"\"\n        Создаем заявку загрузкой через файл. Перемещаем инвойс до статуса 'Получено складом' ('Acceptance in progress')\n        Ожидаемый результат: заявку в статусе 'Acceptance in progress' попала в сервис Acceptance\n        \"\"\"\n        barcodes = [sku.get(\"barcode\") for sku in create_fmcg_sku_by_batch.batch_data]\n        sku_ids_and_barcodes = FMCGLKSupplyQueries().get_sku_id_and_barcode_by_barcode(barcodes)\n        invoice_data = [\n            FMCGInvoiceBatch(sku_id=str(sku.get(\"sku_id\")), barcode=sku.get(\"barcode\")).model_dump()\n            for sku in sku_ids_and_barcodes\n        ]\n        assert FMCGInvoiceBuilder(headers=create_fmcg_sku_by_batch.headers).batch_upload(\n            invoice_data\n        ), \"Invoice batch upload failed\"\n        invoice_number = FMCGLKSupplyQueries().get_invoice_status_by_barcode(barcodes[0]).get(\"invoice_number\")\n        assert invoice_number is not None, \"Invoice number is None\"\n    \n        initial_builder = FMCGInvoiceBuilder(headers=create_fmcg_sku_by_batch.headers)\n    \n        assert (\n            initial_builder.get_invoice(invoice_number).current_status == FMCGLkInvoiceStatuses.CREATED\n        ), \"Invoice status isn't CREATED\"\n    \n        assert (\n            initial_builder.update_invoice(invoice_number=invoice_number).current_status == FMCGLkInvoiceStatuses.READY\n        )\n        assert (\n>           initial_builder.send_invoice(invoice_number=invoice_number).current_status\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n            == FMCGLkInvoiceStatuses.ACCEPTANCE_IN_PROGRESS\n        ), \"Invoice is not in the 'Acceptance in Progress' status\"\n\ntests/fmcg/test_lk/test_integration.py:81: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nsrc/framework/fmcg/builders/lk/invoice.py:68: in send_invoice\n    InvoiceApi(headers=self.headers).api_v1_invoice_send_post(invoice_number=invoice_number)\n/usr/local/lib/python3.11/site-packages/qacl_dm_fmcg_be_service_lk/api/invoice_api.py:1363: in api_v1_invoice_send_post\n    return self.api_v1_invoice_send_post_with_http_info(invoice_number, **kwargs)  # noqa: E501\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n/usr/local/lib/python3.11/site-packages/qacl_dm_fmcg_be_service_lk/api/invoice_api.py:1430: in api_v1_invoice_send_post_with_http_info\n    return self.api_client.call_api(\n/usr/local/lib/python3.11/site-packages/qacl_dm_fmcg_be_service_lk/api_client.py:339: in call_api\n    return self.__call_api(resource_path, method,\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <qacl_dm_fmcg_be_service_lk.api_client.ApiClient object at 0x7dd69a788e10>\nresource_path = '/api/v1/invoice/send', method = 'POST', path_params = {}\nquery_params = [('invoiceNumber', 410002053)]\nheader_params = {'Accept': 'application/json', 'Authorization': 'Bearer ba237cf7-e0f8-45c6-b0ef-78492fe1f11d', 'Content-Type': 'application/json', 'User-Agent': 'Swagger-Codegen/1.0.59+release120/python', ...}\nbody = None, post_params = [], files = {}, response_type = 'object'\nauth_settings = ['wms-authorization'], _return_http_data_only = False\ncollection_formats = {}, _preload_content = True, _request_timeout = None\nexpected_status_code = <HTTPStatus.OK: 200>\n\n    def __call_api(\n            self, resource_path, method, path_params=None,\n            query_params=None, header_params=None, body=None, post_params=None,\n            files=None, response_type=None, auth_settings=None,\n            _return_http_data_only=None, collection_formats=None,\n            _preload_content=True, _request_timeout=None,\n            expected_status_code=HTTPStatus.OK):\n    \n        config = self.configuration\n    \n        # header parameters\n        header_params = header_params or {}\n        header_params.update(self.default_headers)\n        if self.cookie:\n            header_params['Cookie'] = self.cookie\n        if header_params:\n            header_params = self.sanitize_for_serialization(header_params)\n            header_params = dict(self.parameters_to_tuples(header_params,\n                                                           collection_formats))\n    \n        # path parameters\n        if path_params:\n            path_params = self.sanitize_for_serialization(path_params)\n            path_params = self.parameters_to_tuples(path_params,\n                                                    collection_formats)\n            for k, v in path_params:\n                # specified safe chars, encode everything\n                resource_path = resource_path.replace(\n                    '{%s}' % k,\n                    quote(str(v), safe=config.safe_chars_for_path_param)\n                )\n    \n        # query parameters\n        if query_params:\n            query_params = self.sanitize_for_serialization(query_params)\n            query_params = self.parameters_to_tuples(query_params,\n                                                     collection_formats)\n    \n        # post parameters\n        if post_params or files:\n            post_params = self.prepare_post_parameters(post_params, files)\n            post_params = self.sanitize_for_serialization(post_params)\n            post_params = self.parameters_to_tuples(post_params,\n                                                    collection_formats)\n    \n        # auth setting\n        self.update_params_for_auth(header_params, query_params, auth_settings)\n    \n        # body\n        if body:\n            body = self.sanitize_for_serialization(body)\n    \n        # request url\n        url = self.configuration.host + resource_path\n    \n        # perform request and return response\n        response_data = self.request(\n            method, url, query_params=query_params, headers=header_params,\n            post_params=post_params, body=body,\n            _preload_content=_preload_content,\n            _request_timeout=_request_timeout)\n    \n        self.last_response = response_data\n    \n        return_data = response_data\n    \n        try:\n            response_data.data\n            trace_id = response_data.urllib3_response.headers.get('x-aer-trace-id', \"\")\n        except:\n            assert response_data.status == expected_status_code, \\\n                f'Handler: {method} {url}; \\n ' \\\n                f'Expected status code: {expected_status_code}; \\n ' \\\n                f'Actual status code: {response_data.status}'\n        else:\n>           assert response_data.status == expected_status_code, \\\n                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n                f'Handler: {method} {url}; \\n ' \\\n                f'Expected status code: {expected_status_code}; \\n ' \\\n                f'Actual status code: {response_data.status}; \\n ' \\\n                f'Response body: {response_data.data}; \\n ' \\\n                f'X-Aer-Trace-Id: {trace_id}'\nE           AssertionError: Handler: POST https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice/send; \nE            Expected status code: 200; \nE            Actual status code: 400; \nE            Response body: {\"message\":\"Failed to send invoice to ACCEPTANCE: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2\",\"localizedMessage\":\"Ошибка при отправке инвойса в ACCEPTANCE\"}; \nE            X-Aer-Trace-Id:\n\n/usr/local/lib/python3.11/site-packages/qacl_dm_fmcg_be_service_lk/api_client.py:172: AssertionError"}, "description": "\n        Создаем заявку загрузкой через файл. Перемещаем инвойс до статуса 'Получено складом' ('Acceptance in progress')\n        Ожидаемый результат: заявку в статусе 'Acceptance in progress' попала в сервис Acceptance\n        ", "steps": [{"name": "SQLAlchemy query UNDEFINED ", "status": "passed", "attachments": [{"name": "query", "source": "8c2ead04-e6f6-4958-b8fd-b21a3a808de4-attachment.txt", "type": "text/plain"}, {"name": "params", "source": "b72af2d3-8e02-49af-8665-bba7a132dce2-attachment.json", "type": "application/json"}], "start": 1775345988360, "stop": 1775345988360}, {"name": "SQLAlchemy query UNDEFINED ", "status": "passed", "attachments": [{"name": "query", "source": "8b53494d-4481-4736-8a68-b096df7430dc-attachment.txt", "type": "text/plain"}, {"name": "params", "source": "f89780cd-3fa4-4e58-b4ea-ce25577d3af8-attachment.json", "type": "application/json"}], "start": 1775345988361, "stop": 1775345988361}, {"name": "SQLAlchemy query UNDEFINED ", "status": "passed", "attachments": [{"name": "query", "source": "a51296a1-340c-4d52-a878-afaff9bdfe02-attachment.txt", "type": "text/plain"}, {"name": "params", "source": "a5019484-6c65-4fa6-8a1f-3b40dc3be3ee-attachment.json", "type": "application/json"}], "start": 1775345988362, "stop": 1775345988362}, {"name": "POST → https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice/batch", "status": "passed", "steps": [{"name": "Request", "status": "passed", "attachments": [{"name": "request.headers", "source": "61a2775b-22e6-46ec-abc0-c8ec374911ab-attachment.json", "type": "application/json"}], "start": 1775345988560, "stop": 1775345988560}, {"name": "Response → 200, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "82fdde5b-1a32-42be-a928-3eda6c0d22d2-attachment.json", "type": "application/json"}], "start": 1775345988560, "stop": 1775345988560}], "attachments": [{"name": "cURL", "source": "0f177c35-ab65-42f1-8416-f1f14fe35450-attachment.txt", "type": "text/plain"}], "start": 1775345988560, "stop": 1775345988560}, {"name": "GET → https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice", "status": "passed", "steps": [{"name": "Request", "status": "passed", "attachments": [{"name": "request.headers", "source": "bd7fe38f-7bbd-45ac-b4c1-6a040fce231b-attachment.json", "type": "application/json"}, {"name": "request.params", "source": "75e64d01-9f1d-45d2-869d-5bd25762beea-attachment.json", "type": "application/json"}], "start": 1775345988600, "stop": 1775345988601}, {"name": "Response → 200, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "8b67368b-d984-4679-a709-bee64d18560a-attachment.json", "type": "application/json"}, {"name": "response.body", "source": "5c43ba8f-1c51-4695-b8db-7ed207761202-attachment.json", "type": "application/json"}], "start": 1775345988601, "stop": 1775345988601}], "attachments": [{"name": "cURL", "source": "aba8109d-a190-4556-80bb-ba977908f808-attachment.txt", "type": "text/plain"}], "start": 1775345988600, "stop": 1775345988601}, {"name": "PUT → https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice?invoiceNumber=410002053", "status": "passed", "steps": [{"name": "Request", "status": "passed", "attachments": [{"name": "request.headers", "source": "2b6160dc-b21e-4a60-807d-611cd7a2013c-attachment.json", "type": "application/json"}, {"name": "request.body", "source": "a6261209-50c2-4e4f-aba2-87edd49fe071-attachment.json", "type": "application/json"}, {"name": "request.params", "source": "9e9b118c-b01a-408f-aaec-5cf2d5d63e86-attachment.json", "type": "application/json"}], "start": 1775345988671, "stop": 1775345988671}, {"name": "Response → 200, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "be355258-38e1-4571-ab8a-7c52f5d5a3c2-attachment.json", "type": "application/json"}, {"name": "response.body", "source": "e0123e1a-9e19-4320-92f8-2abfdf1d781e-attachment.json", "type": "application/json"}], "start": 1775345988671, "stop": 1775345988672}], "attachments": [{"name": "cURL", "source": "d248cc8b-7ce7-4277-9d83-49a83493ed1e-attachment.txt", "type": "text/plain"}], "start": 1775345988671, "stop": 1775345988672}, {"name": "POST → https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice/send?invoiceNumber=410002053", "status": "passed", "steps": [{"name": "Request", "status": "passed", "attachments": [{"name": "request.headers", "source": "dbb489c1-23b2-40d0-b9b5-96859a6d8e96-attachment.json", "type": "application/json"}, {"name": "request.params", "source": "b871048f-2416-4763-b5de-8849a07d8704-attachment.json", "type": "application/json"}], "start": 1775345988870, "stop": 1775345988870}, {"name": "Response → 400, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "8020b26f-baef-4581-b43e-04b1773ac254-attachment.json", "type": "application/json"}, {"name": "response.body", "source": "74a4ad77-caee-423a-9f66-37c29d5f09bf-attachment.json", "type": "application/json"}], "start": 1775345988870, "stop": 1775345988870}], "attachments": [{"name": "cURL", "source": "0435424b-afc9-48a2-8108-d0aab3381e45-attachment.txt", "type": "text/plain"}], "start": 1775345988870, "stop": 1775345988870}], "attachments": [{"name": "log", "source": "965ac140-66b6-46b9-bf80-3eb69f5fa1c9-attachment.txt", "type": "text/plain"}], "start": 1775345988348, "stop": 1775345989170, "uuid": "40c6a88a-fa49-446f-b0df-58fd1ec9c58b", "historyId": "302f792917bf91782f0daac535ab1337", "testCaseId": "302f792917bf91782f0daac535ab1337", "fullName": "tests.fmcg.test_lk.test_integration.TestIntegrationWithAcceptanceService#test_invoice_batch_upload_set_invoice_status_acceptance_in_progress", "labels": [{"name": "tag", "value": "dm-fmcg-be-service-lk"}, {"name": "parentSuite", "value": "tests.fmcg.test_lk"}, {"name": "suite", "value": "test_integration"}, {"name": "subSuite", "value": "TestIntegrationWithAcceptanceService"}, {"name": "host", "value": "runner-1rdl4o-mi-project-9-concurrent-3-pxnt4b3s"}, {"name": "thread", "value": "42-MainThread"}, {"name": "framework", "value": "pytest"}, {"name": "language", "value": "cpython3"}, {"name": "package", "value": "tests.fmcg.test_lk.test_integration"}], "titlePath": ["tests", "fmcg", "test_lk", "test_integration.py", "TestIntegrationWithAcceptanceService"]}