Beispiel #1
0
 def post(self) -> Any:
     try:
         validated_json = validate_request_json(request.data, user_input_fields)
         return (
             marshal(UsersDAL.add_user(validated_json['login']), user_output_fields),
             HTTPStatus.CREATED,
         )
     except (ValidationException, UsersDALException) as e:
         return marshal({'message': e}, error_fields), HTTPStatus.BAD_REQUEST
Beispiel #2
0
def test_add_user_to_db_second_time(user_login):
    with pytest.raises(UsersDALException):
        UsersDAL.add_user(user_login)
Beispiel #3
0
def test_add_user_returns_valid(user_login):
    res = UsersDAL.add_user(user_login)
    assert res.money == Decimal(START_MONEY)
    assert res.login == user_login