def register():
    """Servicio de registro: permite a los usuarios darse de alta en el sistema."""
    if not request.is_json:
        abort(400)
    data = request.get_json()
    uid = UserService.register(data)
    return jsonify(result='success', uid=uid), 200
Exemple #2
0
def test_register_if_wrong_schema_raises_validation_error(user_data):
    with pytest.raises(ValidationError):
        UserService.register(user_data.invalid_user)
Exemple #3
0
def test_register_if_user_exists_raises_user_exists_error(
        user_exists_mock, user_data):
    user_exists_mock.return_value = True
    with pytest.raises(DataExistsError):
        UserService.register(user_data.valid_user)