diff --git a/archive_api/serializers.py b/archive_api/serializers.py index 38f3e1de..b9820ebb 100644 --- a/archive_api/serializers.py +++ b/archive_api/serializers.py @@ -148,7 +148,7 @@ def validate(self, data): # Make sure description has at least 100 words if 'description' in data.keys() and data['description'] and len(data['description'].split()) < 100: - errors["description"] = "Description must be at least 100 words." + errors["description"] = f"Description must be at least 100 words. Current count is {len(data['description'].split())}." # Validate the selected plots if 'plots' in data.keys(): diff --git a/archive_api/tests/test_api.py b/archive_api/tests/test_api.py index 46b151f0..ddfb6b8c 100644 --- a/archive_api/tests/test_api.py +++ b/archive_api/tests/test_api.py @@ -330,7 +330,7 @@ def test_user_workflow(self): value = json.loads(response.content.decode('utf-8')) self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code) self.assertEqual( - {'description': ['Description must be at least 100 words.'], + {'description': ['Description must be at least 100 words. Current count is 37.'], 'missingRequiredFields': ['archive', 'authors', 'funding_organizations', 'originating_institution', 'qaqc_method_description']}, value) @@ -387,7 +387,7 @@ def test_admin_approve_workflow(self): response = self.client.get("/api/v1/datasets/1/submit/") # In draft mode, owned by auser value = json.loads(response.content.decode('utf-8')) self.assertEqual( - {'description': ['Description must be at least 100 words.'], + {'description': ['Description must be at least 100 words. Current count is 37.'], 'missingRequiredFields': ['archive', 'authors', 'funding_organizations', 'originating_institution', 'qaqc_method_description']}, value)