Skip to content

Commit

Permalink
fix: added settings_api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Barcella committed Nov 18, 2024
1 parent e46890a commit 3454dc8
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions test/test_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from fattureincloud_python_sdk.models.payment_method_details import PaymentMethodDetails
from fattureincloud_python_sdk.models.payment_method_type import PaymentMethodType
from fattureincloud_python_sdk.models.vat_type import VatType
from fattureincloud_python_sdk.models.get_tax_profile_response import GetTaxProfileResponse
from fattureincloud_python_sdk.models.tax_profile import TaxProfile
from fattureincloud_python_sdk.models.create_payment_account_response import (
CreatePaymentAccountResponse,
)
Expand Down Expand Up @@ -406,6 +408,57 @@ def test_modify_vat_type(self):
actual = self.api.modify_vat_type(2, 12345)
actual.data.id = 2
assert actual == expected

def test_get_tax_profile(self):
resp = {
"status": 200,
"data": b'{"data": {"company_type": "individual","company_subtype": "artigiani","profession": "test","regime": "forfettario_5","rivalsa_name": "","default_rivalsa": 0,"cassa_name": "","default_cassa": 0,"default_cassa_taxable": 100,"cassa2_name": "","default_cassa2": 0,"default_cassa2_taxable": 0,"default_withholding_tax": 0,"default_withholding_tax_taxable": 100,"enasarco": false,"enasarco_type": "test","contributions_percentage": 0,"med": false,"default_vat": {"id": 66,"value": 0,"description": "Contribuenti forfettari","notes": "Operazione non soggetta a IVA ai sensi dell\'art. 1, commi 54-89, Legge n. 190\/2014 e succ. modifiche\/integrazioni","e_invoice": true,"ei_type": "2.2","ei_description": "Non soggetta art. 1\/54-89 L. 190\/2014 e succ. modifiche\/integrazioni","editable": false,"is_disabled": false,"default": true}}}',
"reason": "OK",
}

mock_resp = RESTResponse(functions.Dict2Class(resp))
mock_resp.getheader = unittest.mock.MagicMock(return_value=None)
mock_resp.getheaders = unittest.mock.MagicMock(return_value=None)

self.api.api_client.rest_client.request = unittest.mock.MagicMock(
return_value=mock_resp
)
expected = GetTaxProfileResponse(
data = TaxProfile(
company_type="individual",
company_subtype="artigiani",
profession="test",
regime="forfettario_5",
rivalsa_name="",
default_rivalsa=0,
cassa_name="",
default_cassa=0,
default_cassa_taxable=100,
cassa2_name="",
default_cassa2=0,
default_cassa2_taxable=0,
default_withholding_tax=0,
default_withholding_tax_taxable=100,
enasarco=False,
enasarco_type="test",
contributions_percentage=0,
med=False,
default_vat={
"id": 66,
"value": 0,
"description": "Contribuenti forfettari",
"notes": "Operazione non soggetta a IVA ai sensi dell'art. 1, commi 54-89, Legge n. 190/2014 e succ. modifiche/integrazioni",
"e_invoice": True,
"ei_type": "2.2",
"ei_description": "Non soggetta art. 1/54-89 L. 190/2014 e succ. modifiche/integrazioni",
"editable": False,
"is_disabled": False,
"default": True,
}
)
)
actual = self.api.get_tax_profile(2)
assert actual == expected


if __name__ == "__main__":
Expand Down

0 comments on commit 3454dc8

Please sign in to comment.