Skip to content

Commit

Permalink
refs #257, Fix the exception raised when formidable not found
Browse files Browse the repository at this point in the history
  • Loading branch information
moumoutte committed Sep 7, 2017
1 parent 52be544 commit e4f92e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions demo/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion formidable/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e4f92e8

Please sign in to comment.