From 6a34c819c3c4582bcafc57ef730c9ccd556e2081 Mon Sep 17 00:00:00 2001
From: Manon Blanco <blanco@teklia.com>
Date: Wed, 3 Nov 2021 15:58:02 +0100
Subject: [PATCH] Update error message

---
 arkindex/dataimport/api.py                | 2 +-
 arkindex/dataimport/tests/test_workers.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arkindex/dataimport/api.py b/arkindex/dataimport/api.py
index 5b91c3cbdb..9701dabd02 100644
--- a/arkindex/dataimport/api.py
+++ b/arkindex/dataimport/api.py
@@ -1038,7 +1038,7 @@ class WorkerConfigurationList(WorkerACLMixin, ListCreateAPIView):
                 Q(configuration=configuration) | Q(name=name)
             )
         ).exists():
-            raise ValidationError({'worker': 'A worker configuration with this worker and this name or this configuration already exists'})
+            raise ValidationError({'__all__': 'A worker configuration with this name or this configuration already exists for this worker'})
 
         configuation = WorkerConfiguration.objects.create(
             worker=worker,
diff --git a/arkindex/dataimport/tests/test_workers.py b/arkindex/dataimport/tests/test_workers.py
index ffd6e19b94..b675feae81 100644
--- a/arkindex/dataimport/tests/test_workers.py
+++ b/arkindex/dataimport/tests/test_workers.py
@@ -1060,7 +1060,7 @@ class TestWorkersWorkerVersions(FixtureAPITestCase):
         self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
         self.assertDictEqual(
             response.json(),
-            {'worker': 'A worker configuration with this worker and this name or this configuration already exists'}
+            {'__all__': 'A worker configuration with this name or this configuration already exists for this worker'}
         )
 
     def test_configurations_create_configuration_already_exists(self):
@@ -1087,7 +1087,7 @@ class TestWorkersWorkerVersions(FixtureAPITestCase):
         self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
         self.assertDictEqual(
             response.json(),
-            {'worker': 'A worker configuration with this worker and this name or this configuration already exists'}
+            {'__all__': 'A worker configuration with this name or this configuration already exists for this worker'}
         )
 
     def test_configurations_create(self):
-- 
GitLab