"""Unit tests for creating contract_mechanical_deduction snapshots in snowflake.""" from templates.accounting_run_calculate.snapshot_contract_mechanical_deductions \ import insert_snapshot_contract_mechanical_deduction_template def test_insert_snapshot_contract_mechanical_deduction_template(): """Test that the template renders the copying of data from royalty_accounting contract_mechanical_deduction replica.""" template = insert_snapshot_contract_mechanical_deduction_template().render( accounting_run_id=1021, run_controller_id=11, schema='TEST', ) assert template == """ INSERT INTO ROYALTY_ACCOUNTING.TEST.SNAPSHOT_CONTRACT_MECHANICAL_DEDUCTION( ACCOUNTING_RUN_ID, CONTRACT_MECHANICAL_DEDUCTION_ID, CONTRACT_ID, TERRITORY, MECHANICAL_TYPE, ADMIN_TYPE, ADMIN_FEE ) SELECT 1021, cmd.CONTRACT_MECHANICAL_DEDUCTION_ID, cmd.CONTRACT_ID, cmd.TERRITORY, cmd.MECHANICAL_TYPE, cmd.ADMIN_TYPE, cmd.ADMIN_FEE FROM ORCHARD_APP_REPORTING_V2.TEST_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.CONTRACT_MECHANICAL_DEDUCTION AS cmd INNER JOIN ORCHARD_APP_REPORTING_V2.TEST_ROYALTY_ACCOUNTING_ROYALTY_ACCOUNTING.RUN_CONTROLLER_CONTRACT AS rcc ON cmd.CONTRACT_ID = rcc.CONTRACT_ID WHERE rcc.RUN_CONTROLLER_ID = 11; """