Skip to content

Commit a91deba

Browse files
committed
Update tests
1 parent 2947c11 commit a91deba

5 files changed

+82
-36
lines changed

scripts/helpers/housing_nec_migration_gx_dq_inputs.py

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"properties": {"id_field": "lpro_propref"},
33
"tenancies": {"id_field": "ltcy_alt_ref"},
44
"people": {"id_field": "lpar_per_alt_ref"},
5+
"debit_breakdowns": {"id_field": "ldbr_pay_ref"},
56
"contacts": {"id_field": "lcde_legacy_ref"},
67
"arrears_actions": {"id_field": "laca_pay_ref"},
78
"revenue_accounts": {"id_field": "lrac_pay_ref"},
@@ -12,7 +13,8 @@
1213
data_load_list = [
1314
"properties",
1415
"tenancies",
15-
"people"
16+
"people",
17+
"debit_breakdowns"
1618
# "contacts",
1719
# "arrears_actions",
1820
# "revenue_accounts",
@@ -22,38 +24,14 @@
2224

2325
table_list = {
2426
"properties": [
25-
# "properties_1a",
26-
# "properties_1b",
27-
# "properties_1c",
28-
# "properties_1d",
29-
# "properties_1e",
30-
# "properties_2a",
31-
# "properties_3a",
32-
# "properties_4a",
33-
# "properties_4b",
34-
# "properties_4c",
35-
# "properties_7a",
3627
"full_dq_full_dq_hem_pro_all_dq",
3728
],
3829
"tenancies": [
39-
# "tenancies_1a",
40-
# "tenancies_1c",
41-
# "tenancies_2a",
42-
# "tenancies_other",
4330
"full_dq_full_dq_hem_tcy_all_dq",
4431
],
45-
"people": [
46-
# "people_1a",
47-
# "people_1b",
48-
# "people_1c",
49-
# "people_2a",
50-
"full_dq_full_dq_hem_per_all_dq"
51-
],
32+
"people": ["full_dq_full_dq_hem_per_all_dq"],
33+
"debit_breakdowns": ["full_dq_full_dq_hra_dbr_all_dq"],
5234
"contacts": [
53-
# "contacts_1a",
54-
# "contacts_1b",
55-
# "contacts_1c",
56-
# "contacts_2a",
5735
"contacts_all",
5836
],
5937
"arrears_actions": [
@@ -69,10 +47,6 @@
6947
"revenue_accounts_other",
7048
],
7149
"transactions": [
72-
# "transactions_1a",
73-
# "transactions_1c",
74-
# "transactions_2a",
75-
# "transactions_other",
7650
"transactions_all",
7751
],
7852
"addresses": ["addresses_1a", "addresses_1b", "addresses_2a"],

scripts/jobs/housing/housing_nec_migration_apply_gx_dq_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import scripts.jobs.housing.housing_nec_migration_properties_data_load_gx_suite
1919
import scripts.jobs.housing.housing_nec_migration_tenancies_data_load_gx_suite
2020
import scripts.jobs.housing.housing_nec_migration_people_data_load_gx_suite
21+
import scripts.jobs.housing.housing_nec_migration_debit_breakdowns_data_load_gx_suite
2122

2223
# import scripts.jobs.housing.housing_nec_migration_contacts_data_load_gx_suite
2324
# import scripts.jobs.housing.housing_nec_migration_arrears_actions_data_load_gx_suite
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# flake8: noqa: F821
2+
3+
import sys
4+
5+
from awsglue.utils import getResolvedOptions
6+
import great_expectations as gx
7+
import great_expectations.expectations as gxe
8+
9+
10+
class DebitBreakdownsExpectPayRefColumnValuesToNotBeNull(
11+
gxe.ExpectColumnValuesToNotBeNull
12+
):
13+
column: str = "ldbr_pay_ref"
14+
description: str = "Expect ldbr_pay_ref values to not be Null"
15+
16+
17+
class DebitBreakdownsExpectElementCodeToBeInSet(gxe.ExpectColumnValuesToBeInSet):
18+
column: str = "ldbr_ele_code"
19+
value_set: list = [
20+
"DBR",
21+
"DCA",
22+
"DCC",
23+
"DCE",
24+
"DCO",
25+
"DCP",
26+
"DGA",
27+
"DGM",
28+
"DHA",
29+
"DHE",
30+
"DHM",
31+
"DLL",
32+
"DR2",
33+
"DSC",
34+
"DTA",
35+
"DTC",
36+
"DTL",
37+
"DVA",
38+
"DWR",
39+
"DWS",
40+
]
41+
description: str = "Expect element code (ldbr_ele_code) to be one of the set"
42+
43+
44+
class DebitBreakdownsExpectDBRColumnsToMatchOrderedList(
45+
gxe.ExpectTableColumnsToMatchOrderedList
46+
):
47+
column_list = [
48+
"ldbr_pay_ref",
49+
"ldbr_pro_refno",
50+
"ldbr_ele_code",
51+
"ldbr_start_date",
52+
"ldbr_end_date",
53+
"ldbr_att_code",
54+
"ldbr_ele_value",
55+
"tranche",
56+
]
57+
description: str = "Expect columns to match ordered list exactly; tranche at end"
58+
59+
60+
arg_key = ["s3_target_location"]
61+
args = getResolvedOptions(sys.argv, arg_key)
62+
locals().update(args)
63+
64+
# add to GX context
65+
context = gx.get_context(mode="file", project_root_dir=s3_target_location)
66+
67+
suite = gx.ExpectationSuite(name="debit_breakdowns_data_load_suite")
68+
69+
suite.add_expectation(DebitBreakdownsExpectPayRefColumnValuesToNotBeNull())
70+
suite.add_expectation(DebitBreakdownsExpectElementCodeToBeInSet())
71+
suite.add_expectation(DebitBreakdownsExpectDBRColumnsToMatchOrderedList())
72+
73+
suite = context.suites.add(suite)

scripts/jobs/housing/housing_nec_migration_properties_data_load_gx_suite.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ class PropertiesExpectOwnTypeToBeInSet(gxe.ExpectColumnValuesToBeInSet):
3636
value_set: list = [
3737
"ASSOC",
3838
"COUN",
39-
"LEASH",
40-
"LEASL",
41-
"LEASHOUT",
42-
"LEASLOUT",
39+
"LEASEHOLD",
4340
"PRIVATE",
41+
"ENFRAN"
4442
]
4543
description: str = (
4644
"Expect ownership type code (lpro_hou_hrv_hot_code) to be one of the set"

scripts/jobs/housing/housing_nec_migration_tenancies_data_load_gx_suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TenanciesExpectTenancyTypeCodeToBeInSet(gxe.ExpectColumnValuesToBeInSet):
3333
"LHS",
3434
"LTA",
3535
"MPA",
36-
"NONSEC",
36+
"NONSECHR",
3737
"PVG",
3838
"RTM",
3939
"SEC",

0 commit comments

Comments
 (0)