"""AccountPaymentTermTemplate model tests.""" from abacus_account.models.account_payment_term_template import ( AccountPaymentTermTemplate, ) from abacus_account.tests.utils.factories import AccountPaymentTermTemplateFactory def test_create_account_payment_term_template(fresh_db): """Test to create an account payment term template.""" assert AccountPaymentTermTemplate.count() == 0 AccountPaymentTermTemplate.create( template_name='Test template 1', currency_code='USD', payment_terms=dict( signing_entity_id=1, payment_minimum='100', payment_schedule='45_days_after_month_end', ), ) assert AccountPaymentTermTemplate.count() == 1 def test_get_by_currency_code(fresh_db): """Test to get an account_payment_term_template by currency_code.""" currency_code = 'GBP' AccountPaymentTermTemplateFactory.create(currency_code=currency_code) template = AccountPaymentTermTemplate.get_by_currency_code( currency_code=currency_code ) assert template.currency_code == currency_code