diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index e6110f97..2f47ff92 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -354,6 +354,9 @@ class NewAllocateView(NewActionView, DeviceListMix): return flask.redirect(next_url) messages.error('Action {} error!'.format(self.form.type.data)) + for k, v in self.form.errors.items(): + value = ';'.join(v) + messages.error('Action Error {key}: {value}!'.format(key=k, value=value)) next_url = self.get_next_url() return flask.redirect(next_url) diff --git a/tests/test_render_2_0.py b/tests/test_render_2_0.py index 16c950bf..0df56652 100644 --- a/tests/test_render_2_0.py +++ b/tests/test_render_2_0.py @@ -668,6 +668,7 @@ def test_action_allocate_error_required(user3: UserClientFlask): body, status = user3.post(uri, data=data) assert status == '200 OK' assert 'Action Allocate error' in body + assert 'You need to specify a number of users!' in body @pytest.mark.mvp @@ -692,6 +693,7 @@ def test_action_allocate_error_dates(user3: UserClientFlask): body, status = user3.post(uri, data=data) assert status == '200 OK' assert 'Action Allocate error' in body + assert 'The action cannot finish before it starts.' in body assert dev.actions[-1].type != 'Allocate'