Esempio n. 1
0
 def create(self, request):
     form = RecoverPasswordForm(request.data)
     if form.is_valid():
         form.save(request)
         return Response(status=status.HTTP_204_NO_CONTENT)
     else:
         return Response(form.errors, status=status.HTTP_400_BAD_REQUEST)
Esempio n. 2
0
def test_recover_password_form_with_invalid_email():
    from shuup.core.utils.forms import RecoverPasswordForm

    form = RecoverPasswordForm({
        "username": "******",
        "email": "invalid_email"
    })

    assert (len(form.errors) == 1) and form.errors["email"]
Esempio n. 3
0
def test_recover_password_form_with_invalid_email():
    if "shuup.front.apps.auth" not in settings.INSTALLED_APPS:
        pytest.skip("Need shuup.front.apps.auth in INSTALLED_APPS")

    from shuup.core.utils.forms import RecoverPasswordForm

    form = RecoverPasswordForm({
        "username": "******",
        "email": "invalid_email"
    })

    assert (len(form.errors) == 1) and form.errors["email"]