"""Test for statement_period_payment_entity serialization.""" from royalties.schemas.statement_period_payment_entity import ( StatementPeriodPaymentEntityAbacusStateSchema, StatementPeriodPaymentEntitySchema, ) from royalties.tests.utils.factories import ( StatementPeriodFactory, StatementPeriodPaymentEntityFactory, ) def test_statement_period_payment_entity_schema(reference_payment_entity_fixtures): """Test statement period payment entity schema.""" statement_period = StatementPeriodFactory.build() statement_period_payment_entity = StatementPeriodPaymentEntityFactory.build( statement_period_id=statement_period.statement_period_id ) result = StatementPeriodPaymentEntitySchema().dump(statement_period_payment_entity) assert result == { 'statement_period_payment_entity_id': statement_period_payment_entity.statement_period_payment_entity_id, 'statement_period_id': statement_period.statement_period_id, 'reference_payment_entity_id': statement_period_payment_entity.reference_payment_entity_id, 'is_visible_to_customer': False, } def test_statement_period_payment_entity_abacus_state_schema(): """Test StatementPeriodPaymentEntityAbacusState schema.""" data = { 'statement_period_payment_entity_id': 1, 'reference_payment_entity_id': 2, 'statement_period_id': 300, 'abacus_state_id': 1000, 'action_name': 'close_balance', 'action_status': 'init', } res = StatementPeriodPaymentEntityAbacusStateSchema().dump(data) assert res == data