mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Simplify find users by email view - valdiation already done by form
This commit is contained in:
@@ -14,16 +14,13 @@ from app.utils import user_is_platform_admin
|
||||
def find_users_by_email():
|
||||
form = SearchUsersByEmailForm()
|
||||
users_found = None
|
||||
status = 200
|
||||
if form.validate_on_submit():
|
||||
users_found = user_api_client.find_users_by_full_or_partial_email(form.search.data)['data']
|
||||
elif request.method == 'POST':
|
||||
status = 400
|
||||
return render_template(
|
||||
'views/find-users/find-users-by-email.html',
|
||||
form=form,
|
||||
users_found=users_found
|
||||
), status
|
||||
)
|
||||
|
||||
|
||||
@main.route("/users/<user_id>", methods=['GET'])
|
||||
|
||||
@@ -82,7 +82,7 @@ def test_find_users_by_email_validates_against_empty_search_submission(
|
||||
mocker
|
||||
):
|
||||
client_request.login(platform_admin_user)
|
||||
document = client_request.post('main.find_users_by_email', _data={"search": ""}, _expected_status=400)
|
||||
document = client_request.post('main.find_users_by_email', _data={"search": ""}, _expected_status=200)
|
||||
|
||||
expected_message = "You need to enter full or partial email address to search by."
|
||||
assert document.find('span', {'class': 'error-message'}).text.strip() == expected_message
|
||||
|
||||
Reference in New Issue
Block a user