mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 00:33:58 -04:00
110067722: Add form validation for duplicate service name.
This commit is contained in:
@@ -26,3 +26,15 @@ def test_should_add_service_and_redirect_to_next_page(notifications_admin, notif
|
||||
assert response.location == 'http://localhost/dashboard'
|
||||
saved_service = services_dao.find_service_by_service_name('testing the post')
|
||||
assert saved_service is not None
|
||||
|
||||
|
||||
def test_should_return_form_errors_when_service_name_is_empty(notifications_admin, notifications_admin_db, notify_db_session):
|
||||
with notifications_admin.test_client() as client:
|
||||
with client.session_transaction() as session:
|
||||
user = create_test_user()
|
||||
session['user_id'] = user.id
|
||||
verify_codes_dao.add_code(user_id=user.id, code='12345', code_type='sms')
|
||||
client.post('/two-factor', data={'sms_code': '12345'})
|
||||
response = client.post('/add-service', data={})
|
||||
assert response.status_code == 400
|
||||
assert 'Please enter your service name' in response.get_data(as_text=True)
|
||||
|
||||
Reference in New Issue
Block a user