Skip to content

Commit

Permalink
Le message pour les validateurs dans la demande de validation n'est p…
Browse files Browse the repository at this point in the history
…as obligatoire

Fix #6487
  • Loading branch information
philippemilink committed Apr 10, 2023
1 parent a1fccea commit c41de73
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
10 changes: 0 additions & 10 deletions zds/tutorialv2/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,18 +738,8 @@ def __init__(self, content, *args, **kwargs):
def clean(self):
cleaned_data = super().clean()

text = cleaned_data.get("text")

base_error_msg = "La validation n'a pas été demandée. "

if text is None or not text.strip():
error = [_(base_error_msg + "Vous devez fournir un commentaire aux validateurs.")]
self.add_error(field="text", error=error)

elif len(text) < 3:
error = _(base_error_msg + "Votre commentaire doit faire au moins 3 caractères.")
self.add_error(field="text", error=error)

if self.no_subcategories:
error = [_(base_error_msg + "Vous devez choisir au moins une catégorie pour votre publication.")]
self.add_error(field=None, error=error)
Expand Down
9 changes: 0 additions & 9 deletions zds/tutorialv2/tests/tests_views/tests_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,15 +1835,6 @@ def test_validation_workflow(self, validation_management):
# ask validation
self.assertEqual(Validation.objects.count(), 0)

result = self.client.post(
reverse("validation:ask", kwargs={"pk": tuto.pk, "slug": tuto.slug}),
{"text": "", "version": self.tuto_draft.current_version},
follow=False,
)
self.assertEqual(result.status_code, 302)
self.assertEqual(Validation.objects.count(), 0) # not working if you don't provide a text
self.assertEqual(validation_management.send.call_count, 0)

result = self.client.post(
reverse("validation:ask", kwargs={"pk": tuto.pk, "slug": tuto.slug}),
{"text": text_validation, "version": self.tuto_draft.current_version},
Expand Down

0 comments on commit c41de73

Please sign in to comment.