def test_it_is_invalid_with_no_user(self, pyramid_csrf_request, user_model): schema = ForgotPasswordSchema().bind(request=pyramid_csrf_request) user_model.get_by_email.return_value = None with pytest.raises(colander.Invalid) as exc: schema.deserialize({"email": "*****@*****.**"}) assert "email" in exc.value.asdict() assert exc.value.asdict()["email"] == "Unknown email address."
def test_it_is_invalid_with_no_user(self, pyramid_csrf_request, user_model): schema = ForgotPasswordSchema().bind(request=pyramid_csrf_request) user_model.get_by_email.return_value = None with pytest.raises(colander.Invalid) as exc: schema.deserialize({"email": "*****@*****.**"}) assert "email" in exc.value.asdict() assert exc.value.asdict()["email"] == "Unknown email address."
def test_it_returns_user_when_valid(self, pyramid_csrf_request, user_model): schema = ForgotPasswordSchema().bind(request=pyramid_csrf_request) user = user_model.get_by_email.return_value appstruct = schema.deserialize({"email": "*****@*****.**"}) assert appstruct["user"] == user
def test_it_returns_user_when_valid(self, pyramid_csrf_request, user_model): schema = ForgotPasswordSchema().bind(request=pyramid_csrf_request) user = user_model.get_by_email.return_value appstruct = schema.deserialize({"email": "*****@*****.**"}) assert appstruct["user"] == user