diff --git a/demo/tests/test_integration.py b/demo/tests/test_integration.py index 5c9c23fa..25420de1 100644 --- a/demo/tests/test_integration.py +++ b/demo/tests/test_integration.py @@ -410,6 +410,20 @@ def test_validate_data_ok(self): ) self.assertEqual(res.status_code, 204) + def test_validate_does_not_exist(self): + parameters = { + 'first_name': 'Guillaume', + 'last_name': 'Gérard', + } + session = self.client.session + session['role'] = 'padawan' + session.save() + res = self.client.get( + reverse(self.url, args=[9999]), + parameters, format='json' + ) + self.assertEqual(res.status_code, 404) + def test_validate_data_ko(self): parameters = { 'last_name': 'Gérard', diff --git a/formidable/views.py b/formidable/views.py index f1e4836e..d5d752dc 100644 --- a/formidable/views.py +++ b/formidable/views.py @@ -242,7 +242,7 @@ def get(self, request, **kwargs): try: formidable = self.get_formidable_object(kwargs) except Formidable.DoesNotExist: - raise exceptions.Http404() + raise exceptions.NotFound() form_class = self.get_form_class(formidable) form = self.get_form(form_class)