import unittest from src.models.company_model import company_model from src.settings.settings_manager import settings_manager from src.models.measurement_unit_model import measurement_unit_model from src.models.nomenclature_group_model import nomenclature_group_model from src.models.nomenclature_model import nomenclature_model from src.models.warehouse_model import warehouse_model from src.models.abstract_reference import abstract_reference from src.errors.argument_exception import argument_exception from os import path class test_models(unittest.TestCase): def test_company(self): # Подготовка setman = settings_manager() setman.open(path.dirname(__file__) + "/../config/settings.json") sts = setman.settings # Действие company = company_model("Test company", sts) # Проверка assert isinstance(company, company_model) assert company.tax_id == sts.tax_id assert company.bank_id == sts.bank_id assert company.bank_account_id == sts.bank_account_id assert company.property_type == sts.property_type def test_measurement_unit(self): # Подготовка g = measurement_unit_model("Граммы") kg = measurement_unit_model("Килограммы", 1000, g) # Действие # Проверка assert isinstance(g, measurement_unit_model) assert isinstance(kg, measurement_unit_model) assert g.to_base_unit(1) == 1 assert kg.to_base_unit(1) == 1000 def test_nomenclature(self): # Подготовка munit = measurement_unit_model("Test munit") fn = "abc" nom = nomenclature_model("Test nomenclature", fn, munit, nomenclature_group_model("Test ng")) # Действие # Проверка assert isinstance(nom, nomenclature_model) assert nom.full_name == fn def test_warehouse(self): pass def test_nomenclature_group(self): pass def test_base_name_validation(self): # Подготовка fn = "abc" some = abstract_reference(fn) fn *= 2 # Действие some.name = fn # Проверка assert some.name == fn