ass form errors in message
This commit is contained in:
parent
322b340607
commit
7fe33f3a42
|
@ -354,6 +354,9 @@ class NewAllocateView(NewActionView, DeviceListMix):
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
||||||
messages.error('Action {} error!'.format(self.form.type.data))
|
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()
|
next_url = self.get_next_url()
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
||||||
|
|
|
@ -668,6 +668,7 @@ def test_action_allocate_error_required(user3: UserClientFlask):
|
||||||
body, status = user3.post(uri, data=data)
|
body, status = user3.post(uri, data=data)
|
||||||
assert status == '200 OK'
|
assert status == '200 OK'
|
||||||
assert 'Action Allocate error' in body
|
assert 'Action Allocate error' in body
|
||||||
|
assert 'You need to specify a number of users!' in body
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.mvp
|
@pytest.mark.mvp
|
||||||
|
@ -692,6 +693,7 @@ def test_action_allocate_error_dates(user3: UserClientFlask):
|
||||||
body, status = user3.post(uri, data=data)
|
body, status = user3.post(uri, data=data)
|
||||||
assert status == '200 OK'
|
assert status == '200 OK'
|
||||||
assert 'Action Allocate error' in body
|
assert 'Action Allocate error' in body
|
||||||
|
assert 'The action cannot finish before it starts.' in body
|
||||||
assert dev.actions[-1].type != 'Allocate'
|
assert dev.actions[-1].type != 'Allocate'
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue