{"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 0x78a297e81590>\ncreate_fmcg_sku_by_batch = LKBatchDTO(headers={'Authorization': 'Bearer 7f4a1d4c-d3a8-432f-bb03-71739caa4d73'}, batch_data=[{'barcode': '48925288..._type': 'Тест-пакет', 'has_expiration_date': 'true', 'currency': 'USD', 'category': 'столетие', 'brand': '082673   '}])\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:1464: 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:1531: 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 0x78a2963e9350>\nresource_path = '/api/v1/invoice/send', method = 'POST', path_params = {}\nquery_params = [('invoiceNumber', 410002061)]\nheader_params = {'Accept': 'application/json', 'Authorization': 'Bearer 7f4a1d4c-d3a8-432f-bb03-71739caa4d73', 'Content-Type': 'application/json', 'User-Agent': 'Swagger-Codegen/1.0.63+develop/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": "d4814fdc-aa1f-4ebf-bf39-35473f682211-attachment.txt", "type": "text/plain"}, {"name": "params", "source": "8e6fb839-e8cd-4357-81d6-ad92a4ba3875-attachment.json", "type": "application/json"}], "start": 1775502115573, "stop": 1775502115573}, {"name": "SQLAlchemy query UNDEFINED ", "status": "passed", "attachments": [{"name": "query", "source": "0fbc7197-c509-462f-bdad-6c66376936c9-attachment.txt", "type": "text/plain"}, {"name": "params", "source": "abc2e5cd-9cea-4db8-93f0-f7e786c55bce-attachment.json", "type": "application/json"}], "start": 1775502115574, "stop": 1775502115574}, {"name": "SQLAlchemy query UNDEFINED ", "status": "passed", "attachments": [{"name": "query", "source": "e9b80e50-f61c-4ec8-bc77-dc572b49f8ae-attachment.txt", "type": "text/plain"}, {"name": "params", "source": "1f739a54-94c1-4a99-b439-f97c747a30fc-attachment.json", "type": "application/json"}], "start": 1775502115575, "stop": 1775502115575}, {"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": "b5ead446-545b-46fb-a971-1d9121c0bc60-attachment.json", "type": "application/json"}], "start": 1775502116064, "stop": 1775502116064}, {"name": "Response → 200, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "2b0204c1-b810-4b09-adf7-1f2bf799e8f3-attachment.json", "type": "application/json"}], "start": 1775502116064, "stop": 1775502116065}], "attachments": [{"name": "cURL", "source": "f7b1d452-2d2d-4450-b7b7-6db517a0e803-attachment.txt", "type": "text/plain"}], "start": 1775502116064, "stop": 1775502116065}, {"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": "999e7163-4182-4f6f-804a-4f94897b826e-attachment.json", "type": "application/json"}, {"name": "request.params", "source": "64ea1b37-06cc-4764-be8c-9c1244cb6df4-attachment.json", "type": "application/json"}], "start": 1775502116367, "stop": 1775502116367}, {"name": "Response → 200, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "e612c27d-7a65-44d4-b81a-eefedf577b24-attachment.json", "type": "application/json"}, {"name": "response.body", "source": "0341c214-7965-4457-96e6-47a2db6ebdd6-attachment.json", "type": "application/json"}], "start": 1775502116367, "stop": 1775502116367}], "attachments": [{"name": "cURL", "source": "cd18c6a2-cf8e-457b-ab10-cc50a7848d25-attachment.txt", "type": "text/plain"}], "start": 1775502116367, "stop": 1775502116367}, {"name": "PUT → https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice?invoiceNumber=410002061", "status": "passed", "steps": [{"name": "Request", "status": "passed", "attachments": [{"name": "request.headers", "source": "68ce4f9c-9abe-4c5e-9d2c-17bc1d8bfee8-attachment.json", "type": "application/json"}, {"name": "request.body", "source": "6bbb4c4b-f144-4575-a5ce-b0601239b48d-attachment.json", "type": "application/json"}, {"name": "request.params", "source": "c308ffea-aa63-449f-af8c-877a55f20aa7-attachment.json", "type": "application/json"}], "start": 1775502116660, "stop": 1775502116661}, {"name": "Response → 200, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "368e2aa1-5867-44de-9341-44dd3c6ef4aa-attachment.json", "type": "application/json"}, {"name": "response.body", "source": "5a812006-8069-4dbc-9ffe-6593bd88bb69-attachment.json", "type": "application/json"}], "start": 1775502116661, "stop": 1775502116940}], "attachments": [{"name": "cURL", "source": "5832e536-dacb-47a1-9ace-e6f224e9540f-attachment.txt", "type": "text/plain"}], "start": 1775502116660, "stop": 1775502116941}, {"name": "POST → https://dm-fmcg-be-service-lk.k8s-review.dailymail-tech.uz/api/v1/invoice/send?invoiceNumber=410002061", "status": "passed", "steps": [{"name": "Request", "status": "passed", "attachments": [{"name": "request.headers", "source": "2a52a25c-1164-4457-ae8e-6057d0ac4bb3-attachment.json", "type": "application/json"}, {"name": "request.params", "source": "b7b2aa7c-1573-4819-b073-2f6a69edc7ac-attachment.json", "type": "application/json"}], "start": 1775502117266, "stop": 1775502117266}, {"name": "Response → 400, trace_id: None", "status": "passed", "attachments": [{"name": "response.headers", "source": "ee99a698-30f7-40e3-9785-520b66548a03-attachment.json", "type": "application/json"}, {"name": "response.body", "source": "94a6ba2b-86f3-4d11-84ec-4b6032706a79-attachment.json", "type": "application/json"}], "start": 1775502117266, "stop": 1775502117266}], "attachments": [{"name": "cURL", "source": "98cd7520-a6b5-48ec-8ce1-0619d63f73a1-attachment.txt", "type": "text/plain"}], "start": 1775502117266, "stop": 1775502117266}], "attachments": [{"name": "log", "source": "15b572d6-3eeb-4666-8d9f-bff8b0927456-attachment.txt", "type": "text/plain"}], "start": 1775502115562, "stop": 1775502117267, "uuid": "1a444274-0e53-4c0d-b5ef-d7fafa751195", "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-0-pibpolkm"}, {"name": "thread", "value": "36-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"]}