"""Tests currency logic tear.""" from unittest.mock import MagicMock from ows_accounting import response from ows_accounting.logic import currency from ows_accounting.models import currency as currency_model def test_get_currency_by_id(monkeypatch): """Test getting currency details.""" payload = { 'id': 1, 'code': 'USD', 'symbol': 'USD', 'name': 'Dollar' } monkeypatch.setattr( currency_model, 'get_currency_by_id', MagicMock( return_value=response.Response(payload))) result = currency.get_currency_by_id(1) currency_model.get_currency_by_id.assert_called_once() assert result assert result.message == payload