"""Factories for testing models.""" from decimal import Decimal import factory from abacus_common_logic.test_utils.factories import BaseModelFactory from abacus_legacy_sync.constants import constants from abacus_legacy_sync.models.country import Country from abacus_legacy_sync.models.currencies import Currencies from abacus_legacy_sync.models.customer_master_master import CustomerMasterMaster from abacus_legacy_sync.models.distribution_type import DistributionType from abacus_legacy_sync.models.vendor_contract import VendorContract from abacus_legacy_sync.models.vendor_contract_distribution_type import ( VendorContractDistributionType, ) from abacus_legacy_sync.models.vendor_dms_master_restriction import ( VendorDmsMasterRestriction, ) class VendorContractFactory(BaseModelFactory): """Factory to create vendor contract models for testing.""" class Meta: """Meta definition for the factory.""" model = VendorContract vendor_id = 77 cont_start = '2022-01-01' cont_end = '2122-12-31' contract_type = constants.VENDOR_CONTRACT_CONTRACT_TYPES.VENDOR_TERM release_term = 0 opt_out = 'N' is_automatic_rollover = 'Y' payment_interval = constants.VENDOR_CONTRACT_PAYMENT_INTERVALS.MONTH pay_after = constants.VENDOR_CONTRACT_PAY_AFTER_INTERVALS.AFTER_30 digital_split = 0.75 currency_id = 1 territory_carve_out = '17,201,18,19,199' class CurrenciesFactory(BaseModelFactory): """Factory to create currencies models for testing.""" class Meta: """Meta definition for the factory.""" model = Currencies ISO_4217_code = 'USD' symbol_html_entity_code = '$' currency_name = 'United States Dollar' decimal_mark = '.' thousands_separator = ',' symbol_infront = 'Y' subunit_to_unit = 100 subunit_name = 'cent' supported_payout_currency = 'Y' class CountryFactory(BaseModelFactory): """Factory to create country models for testing.""" class Meta: """Meta definition for the factory.""" model = Country name = 'USA' country_code = 'US' abbrivation = 'US' continent = constants.COUNTRY_CONTINENTS.NORTH_AMERICA latitude = Decimal('37.090240') longitude = Decimal('-95.712891') iso3166a3 = 'USA' continent_id = 5 class DistributionTypeFactory(BaseModelFactory): """Factory to create DistributionType models for testing.""" class Meta: """Meta definition for the factory.""" model = DistributionType distribution_type_name = 'Full Track' class VendorContractDistributionTypeFactory(BaseModelFactory): """Factory to create VendorContractDistributionType models for testing.""" class Meta: """Meta definition for the factory.""" model = VendorContractDistributionType vendor_contract = factory.SubFactory(VendorContractFactory) distribution_type = factory.SubFactory(DistributionTypeFactory) new_store_default = 'N' class CustomerMasterMasterFactory(BaseModelFactory): """Factory to create CustomerMasterMaster models for testing.""" class Meta: """Meta definition for the factory.""" model = CustomerMasterMaster customer_name = 'iTunes/Apple' class VendorDmsMasterRestrictionFactory(BaseModelFactory): """Factory to create VendorDmsMasterRestriction models for testing.""" class Meta: """Meta definition for the factory.""" model = VendorDmsMasterRestriction customer_master_master = factory.SubFactory(CustomerMasterMasterFactory) distribution_type = factory.SubFactory(DistributionTypeFactory) vendor_contract = factory.SubFactory(VendorContractFactory)