Ejemplo n.º 1
0
def test_get_user_currencies():
    UsersDAL.make_operation_with_currency(1, 1, OperationType.BUY,
                                          Decimal('1'), datetime.now())
    currencies: List[UserCurrencyFields] = UsersDAL.get_user_currencies(1)
    assert len(currencies) == 1
    assert currencies[0].amount == Decimal('1')
Ejemplo n.º 2
0
def test_get_user_currencies_with_invalid_user_id():
    with pytest.raises(UsersDALException):
        UsersDAL.get_user_currencies(228)
Ejemplo n.º 3
0
 def get(self, user_id: str) -> Any:
     try:
         user_id_int = validate_path_parameter(user_id)
         return UsersDAL.get_user_currencies(user_id_int)
     except (UsersDALException, ValidationException) as e:
         return marshal({'message': e}, error_fields), HTTPStatus.BAD_REQUEST