From 0a7bf699be8b367c8c896a8ea7c339b3e3995126 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 9 May 2024 15:14:26 +0200 Subject: [PATCH] connector_search_engine: store to_be_checked error Before this change the error was visible only in the job if not deleted. This we can provide more info to the end user w/o the need for a new field. This info will be wiped on the next successful compute. --- connector_search_engine/models/se_binding.py | 1 + connector_search_engine/tests/test_all.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/connector_search_engine/models/se_binding.py b/connector_search_engine/models/se_binding.py index 7d1cbd8f..c5027711 100644 --- a/connector_search_engine/models/se_binding.py +++ b/connector_search_engine/models/se_binding.py @@ -203,6 +203,7 @@ def _recompute_json(self, force_export=False): vals["date_modified"] = fields.Datetime.now() if error: vals["sync_state"] = "to_be_checked" + vals["data"]["__error__"] = error binding.write(vals) if validation_errors: result.append( diff --git a/connector_search_engine/tests/test_all.py b/connector_search_engine/tests/test_all.py index daf78755..e1f3f1d4 100644 --- a/connector_search_engine/tests/test_all.py +++ b/connector_search_engine/tests/test_all.py @@ -383,6 +383,9 @@ def test_recompute_json_to_be_checked(self): "Validation errors:\n\n " f"Something wrong with data - IDs: {self.partner_binding.id}", ) + self.assertEqual( + self.partner_binding.data["__error__"], "Something wrong with data" + ) def test_recompute_json_to_be_checked_rollback(self): # If something was to check but it's now good,