Exemplo n.º 1
0
 def get(self, currency_id: str) -> Any:
     request.get_json()
     try:
         currency_id_in_int: int = validate_path_parameter(currency_id)
         return (
             marshal(
                 CurrenciesDAL.get_currency_by_id(currency_id_in_int),
                 currency_output_fields,
             ),
             HTTPStatus.OK,
         )
     except (ValidationException, CurrenciesDALException) as e:
         return marshal({'message': e},
                        error_fields), HTTPStatus.BAD_REQUEST
Exemplo n.º 2
0
def test_get_currency_with_invalid_id():
    with pytest.raises(CurrenciesDALException):
        CurrenciesDAL.get_currency_by_id(2)
Exemplo n.º 3
0
def test_get_currency_by_id():
    res = CurrenciesDAL.get_currency_by_id(1)
    assert res.id == 1