Skip to content

Commit bfb054d

Browse files
author
Gabriele Barcella
committed
test: added unit tests
1 parent c632a34 commit bfb054d

16 files changed

Lines changed: 420 additions & 647 deletions

fattureincloud_python_sdk/models/get_price_list_items_response.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from typing import Optional, Set
2424
from typing_extensions import Self
2525

26+
from fattureincloud_python_sdk.models.price_list_item import PriceListItem
27+
2628

2729
class GetPriceListItemsResponse(BaseModel):
2830
"""

test/test_entity_client_pre_create_info.py

Lines changed: 58 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@
1313
""" # noqa: E501
1414

1515

16+
import json
1617
import unittest
1718

1819
from fattureincloud_python_sdk.models.entity_client_pre_create_info import (
1920
EntityClientPreCreateInfo,
2021
)
22+
from fattureincloud_python_sdk.models.payment_account import PaymentAccount
23+
from fattureincloud_python_sdk.models.payment_account_type import PaymentAccountType
24+
from fattureincloud_python_sdk.models.payment_method import PaymentMethod
25+
from fattureincloud_python_sdk.models.payment_method_type import PaymentMethodType
26+
from fattureincloud_python_sdk.models.price_list import PriceList
27+
from fattureincloud_python_sdk.models.vat_type import VatType
28+
from functions import json_serial
2129

2230

2331
class TestEntityClientPreCreateInfo(unittest.TestCase):
@@ -29,87 +37,58 @@ def setUp(self):
2937
def tearDown(self):
3038
pass
3139

32-
def make_instance(self, include_optional) -> EntityClientPreCreateInfo:
33-
"""Test EntityClientPreCreateInfo
34-
include_optional is a boolean, when False only required
35-
params are included, when True both required and
36-
optional params are included"""
37-
# uncomment below to create an instance of `EntityClientPreCreateInfo`
38-
"""
39-
model = EntityClientPreCreateInfo()
40-
if include_optional:
41-
return EntityClientPreCreateInfo(
42-
countries_list = [
43-
''
44-
],
45-
payment_methods_list = [
46-
fattureincloud_python_sdk.models.payment_method.PaymentMethod(
47-
id = 56,
48-
name = '',
49-
type = 'standard',
50-
is_default = True,
51-
default_payment_account = fattureincloud_python_sdk.models.payment_account.PaymentAccount(
52-
id = 56,
53-
name = 'Conto Banca Intesa',
54-
iban = '',
55-
sia = '',
56-
cuc = '',
57-
virtual = True, ),
58-
details = [
59-
fattureincloud_python_sdk.models.payment_method_details.PaymentMethodDetails(
60-
title = '',
61-
description = '', )
62-
],
63-
bank_iban = '',
64-
bank_name = '',
65-
bank_beneficiary = '',
66-
ei_payment_method = '', )
67-
],
68-
payment_accounts_list = [
69-
fattureincloud_python_sdk.models.payment_account.PaymentAccount(
70-
id = 56,
71-
name = 'Conto Banca Intesa',
72-
type = 'standard',
73-
iban = '',
74-
sia = '',
75-
cuc = '',
76-
virtual = True, )
77-
],
78-
vat_types_list = [
79-
fattureincloud_python_sdk.models.vat_type.VatType(
80-
id = 56,
81-
value = 22,
82-
description = 'Non imponibile art. 123',
83-
notes = 'IVA non imponibile ai sensi dell'articolo 123, comma 2',
84-
e_invoice = True,
85-
ei_type = '2',
86-
ei_description = '',
87-
editable = True,
88-
is_disabled = True,
89-
default = True, )
90-
],
91-
price_lists = [
92-
fattureincloud_python_sdk.models.price_list.PriceList(
93-
id = '',
94-
name = '123',
95-
prices_type = 'net',
96-
is_default = True,
97-
valid_from = '',
98-
valid_to = '',
99-
type = 'sell', )
100-
],
101-
limit = 1.337,
102-
usage = 1.337
103-
)
104-
else:
105-
return EntityClientPreCreateInfo(
106-
)
107-
"""
108-
10940
def testEntityClientPreCreateInfo(self):
11041
"""Test EntityClientPreCreateInfo"""
111-
# inst_req_only = self.make_instance(include_optional=False)
112-
# inst_req_and_optional = self.make_instance(include_optional=True)
42+
model = EntityClientPreCreateInfo(
43+
countries_list= [
44+
'Italy'
45+
],
46+
payment_methods_list= [
47+
PaymentMethod(
48+
id=1,
49+
name="name_example",
50+
type=PaymentMethodType("standard"),
51+
is_default=False,
52+
)
53+
],
54+
payment_accounts_list= [
55+
PaymentAccount(
56+
id=1,
57+
name="Conto Banca Intesa",
58+
type=PaymentAccountType("standard"),
59+
iban="iban_example",
60+
sia="sia_example",
61+
cuc="cuc_example",
62+
virtual=True,
63+
)
64+
],
65+
vat_types_list= [
66+
VatType(
67+
id=1,
68+
value=22.0,
69+
description="Non imponibile art. 123",
70+
notes="IVA non imponibile ai sensi dell articolo 123, comma 2",
71+
e_invoice=True,
72+
ei_type="2",
73+
ei_description="ei_description_example",
74+
is_disabled=True,
75+
)
76+
],
77+
price_lists= [
78+
PriceList(
79+
id="12345",
80+
name="Listino 1",
81+
prices_type="net",
82+
is_default=True,
83+
valid_from="2021-01-01",
84+
valid_to="2021-12-31",
85+
type="sell",
86+
)
87+
],
88+
)
89+
expected_json = '{"countries_list": ["Italy"], "payment_methods_list": [{"id": 1, "name": "name_example", "type": "standard", "is_default": false}], "payment_accounts_list": [{"id": 1, "name": "Conto Banca Intesa", "type": "standard", "iban": "iban_example", "sia": "sia_example", "cuc": "cuc_example", "virtual": true}], "vat_types_list": [{"id": 1, "value": 22.0, "description": "Non imponibile art. 123", "notes": "IVA non imponibile ai sensi dell articolo 123, comma 2", "e_invoice": true, "ei_type": "2", "ei_description": "ei_description_example", "is_disabled": true}], "price_lists": [{"id": "12345", "name": "Listino 1", "prices_type": "net", "is_default": true, "valid_from": "2021-01-01", "valid_to": "2021-12-31", "type": "sell"}]}'
90+
actual_json = json.dumps(model.to_dict(), default=json_serial)
91+
assert actual_json == expected_json
11392

11493

11594
if __name__ == "__main__":

test/test_get_bin_issued_document_response.py

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
""" # noqa: E501
1414

1515

16+
import datetime
17+
import json
1618
import unittest
1719

1820
from fattureincloud_python_sdk.models.get_bin_issued_document_response import (
1921
GetBinIssuedDocumentResponse,
2022
)
23+
from fattureincloud_python_sdk.models.issued_document import IssuedDocument
24+
from fattureincloud_python_sdk.models.issued_document_type import IssuedDocumentType
25+
from functions import json_serial
2126

2227

2328
class TestGetBinIssuedDocumentResponse(unittest.TestCase):
@@ -29,27 +34,35 @@ def setUp(self):
2934
def tearDown(self):
3035
pass
3136

32-
def make_instance(self, include_optional) -> GetBinIssuedDocumentResponse:
33-
"""Test GetBinIssuedDocumentResponse
34-
include_optional is a boolean, when False only required
35-
params are included, when True both required and
36-
optional params are included"""
37-
# uncomment below to create an instance of `GetBinIssuedDocumentResponse`
38-
"""
39-
model = GetBinIssuedDocumentResponse()
40-
if include_optional:
41-
return GetBinIssuedDocumentResponse(
42-
data = ERROR_TO_EXAMPLE_VALUE
37+
def testGetBinIssuedDocumentResponse(self):
38+
"""Test GetBinIssuedDocumentResponse"""
39+
model = GetBinIssuedDocumentResponse(
40+
data = IssuedDocument(
41+
id=2,
42+
type=IssuedDocumentType("invoice"),
43+
number=2,
44+
numeration="/A",
45+
date=datetime.datetime.strptime("2022-01-02", "%Y-%m-%d").date(),
46+
year=1,
47+
subject="subject_example",
48+
visible_subject="visible_subject_example",
49+
rc_center="rc_center_example",
50+
notes="notes_example",
51+
rivalsa=0.0,
52+
cassa=0.0,
53+
cassa_taxable=0.0,
54+
amount_cassa_taxable=3.14,
55+
cassa2=0.0,
56+
cassa2_taxable=0.0,
57+
amount_cassa2_taxable=3.14,
58+
global_cassa_taxable=0.0,
59+
amount_global_cassa_taxable=3.14,
4360
)
44-
else:
45-
return GetBinIssuedDocumentResponse(
4661
)
47-
"""
62+
expected_json = '{"data": {"id": 2, "type": "invoice", "number": 2, "numeration": "/A", "date": "2022-01-02", "year": 1, "subject": "subject_example", "visible_subject": "visible_subject_example", "rc_center": "rc_center_example", "notes": "notes_example", "rivalsa": 0.0, "cassa": 0.0, "cassa_taxable": 0.0, "amount_cassa_taxable": 3.14, "cassa2": 0.0, "cassa2_taxable": 0.0, "amount_cassa2_taxable": 3.14, "global_cassa_taxable": 0.0, "amount_global_cassa_taxable": 3.14, "show_totals": "all"}}'
63+
actual_json = json.dumps(model.to_dict(), default=json_serial)
64+
assert actual_json == expected_json
4865

49-
def testGetBinIssuedDocumentResponse(self):
50-
"""Test GetBinIssuedDocumentResponse"""
51-
# inst_req_only = self.make_instance(include_optional=False)
52-
# inst_req_and_optional = self.make_instance(include_optional=True)
5366

5467

5568
if __name__ == "__main__":

0 commit comments

Comments
 (0)