Map UPRWebNew to Direct New
This commit is contained in:
parent
3d0f92e462
commit
744c55a615
7
main.sql
7
main.sql
@ -16,7 +16,10 @@ VALUES (
|
||||
$application_bank_account_number,
|
||||
$application_is_rejected,
|
||||
$application_date_of_birth,
|
||||
$application_customer_type
|
||||
CASE
|
||||
WHEN LOWER(TRIM($application_customer_type::text)) = 'uprwebnew' THEN 'Direct New'
|
||||
ELSE $application_customer_type
|
||||
END
|
||||
)
|
||||
ON CONFLICT (application_key)
|
||||
DO UPDATE
|
||||
@ -26,4 +29,4 @@ DO UPDATE
|
||||
application_bank_account_number = EXCLUDED.application_bank_account_number,
|
||||
application_is_rejected = EXCLUDED.application_is_rejected,
|
||||
application_date_of_birth = EXCLUDED.application_date_of_birth,
|
||||
application_customer_type = EXCLUDED.application_customer_type;
|
||||
application_customer_type = EXCLUDED.application_customer_type;
|
||||
|
||||
22
test_block.py
Normal file
22
test_block.py
Normal file
@ -0,0 +1,22 @@
|
||||
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()
|
||||
Loading…
x
Reference in New Issue
Block a user