import json import unittest from pathlib import Path BLOCK_DIR = Path(__file__).resolve().parent class TestDbPushV1SqlContract(unittest.TestCase): def test_application_customer_type_direct_new_mapping(self): schema = json.loads((BLOCK_DIR / "request_schema.json").read_text()) sql = (BLOCK_DIR / "main.sql").read_text().lower() self.assertEqual(schema["properties"]["application_customer_type"]["type"], ["string", "null"]) self.assertNotIn("application_source_name", schema["properties"]) self.assertIn("$application_customer_type::text", sql) self.assertIn("= 'uprwebnew' then 'direct new'", sql) self.assertIn("else $application_customer_type", sql) if __name__ == "__main__": unittest.main()