Exemplo n.º 1
0
    def test_invalid_with_inactive_user(self, pyramid_csrf_request,
                                        user_service):
        schema = LoginSchema().bind(request=pyramid_csrf_request)
        user_service.fetch_for_login.side_effect = UserNotActivated()

        with pytest.raises(colander.Invalid) as exc:
            schema.deserialize({"username": "******", "password": "******"})
        errors = exc.value.asdict()

        assert "username" in errors
        assert "activate your account" in errors["username"]
Exemplo n.º 2
0
    def test_invalid_with_inactive_user(self, pyramid_csrf_request,
                                        user_service):
        schema = schemas.LoginSchema().bind(request=pyramid_csrf_request)
        user_service.fetch_for_login.side_effect = UserNotActivated()

        with pytest.raises(colander.Invalid) as exc:
            schema.deserialize({
                'username': '******',
                'password': '******',
            })
        errors = exc.value.asdict()

        assert 'username' in errors
        assert 'activate your account' in errors['username']