Files
notifications-admin/tests/app/main/test_add_service_form.py

13 lines
502 B
Python
Raw Normal View History

from app.main.forms import AddServiceForm
from werkzeug.datastructures import MultiDict
def test_form_should_have_errors_when_duplicate_service_is_added(app_):
def _get_form_names():
return ['some.service', 'more.names']
2016-01-15 15:15:35 +00:00
with app_.test_request_context():
form = AddServiceForm(_get_form_names,
2016-01-18 17:35:28 +00:00
formdata=MultiDict([('name', 'some service')]))
form.validate()
assert {'name': ['This service name is already in use']} == form.errors