def test_when_no_user_reveal_and_user_not_found_then_send_link_successful( settings_with_reset_password_verification, settings_with_reset_password_fail_when_user_not_found_disabled, api_view_provider, api_factory): request = api_factory.create_post_request({ 'login': '******', }) with capture_sent_emails() as sent_emails: response = api_view_provider.view_func(request) assert_response_is_ok(response) assert_no_email_sent(sent_emails)
def test_ok_when_deprecated_register_email_serializer(user, api_view_provider, api_factory): request = api_factory.create_post_request({ 'email': '*****@*****.**', }) force_authenticate(request, user=user) with capture_sent_emails() as sent_emails: response = api_view_provider.view_func(request) assert_response_is_ok(response) assert_no_email_sent(sent_emails) user.refresh_from_db() assert user.email == '*****@*****.**'
def test_register_email_fail_email_already_used( settings_with_simple_email_based_user, user, api_view_provider, api_factory): request = api_factory.create_post_request({ 'email': user.email, }) force_authenticate(request, user=user) with capture_sent_emails() as sent_emails: response = api_view_provider.view_func(request) assert_no_email_sent(sent_emails) assert_response_is_bad_request(response) assert "detail" in response.data