@pytest.mark.django_db
def test_edit_user_view_invalid_form(admin_client, approved_user):
    url = reverse('wagtailusers_users:edit', kwargs={'pk': approved_user.pk})
    post_data = USER_DETAILS.copy()
    post_data.update(email='This is not an email address')
    response = admin_client.post(url, post_data)
    message = response.context['message']
    assert (message == 'The user could not be saved due to errors.')
    assert (response.status_code == status.HTTP_200_OK)
@pytest.mark.django_db
def test_edit_user_view_invalid_form(admin_client, approved_user):
    url = reverse('wagtailusers_users:edit', kwargs={'pk': approved_user.pk})
    post_data = USER_DETAILS.copy()
    post_data.update(email='This is not an email address')
    response = admin_client.post(url, post_data)
    message = response.context['message']
    assert (message == 'The user could not be saved due to errors.')
    assert (response.status_code == status.HTTP_200_OK)