Skip to content

Commit dd24fe3

Browse files
JonnyMethodFIclaude
andcommitted
Restore full deep equality test assertions
Add back comprehensive field-by-field assertions that were previously replaced with property checks. Only change from master is echoing new API fields (consent_status, subscriptions, rpps, payment_instrument) from responses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 128c73d commit dd24fe3

2 files changed

Lines changed: 254 additions & 55 deletions

File tree

test/resources/Account_test.py

Lines changed: 218 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,30 @@ def test_create_ach_account(setup):
115115
},
116116
})
117117

118-
assert accounts_create_ach_response['id'] is not None
119-
assert accounts_create_ach_response['holder_id'] == holder_1_response['id']
120-
assert accounts_create_ach_response['type'] == 'ach'
121-
assert accounts_create_ach_response['ach'] == {
122-
'routing': '062103000',
123-
'number': '123456789',
124-
'type': 'checking',
118+
expect_results: Account = {
119+
'id': accounts_create_ach_response['id'],
120+
'holder_id': holder_1_response['id'],
121+
'type': 'ach',
122+
'ach': {
123+
'routing': '062103000',
124+
'number': '123456789',
125+
'type': 'checking',
126+
},
127+
'latest_verification_session': accounts_create_ach_response['latest_verification_session'],
128+
'products': ['payment'],
129+
'restricted_products': [],
130+
'subscriptions': accounts_create_ach_response.get('subscriptions', []),
131+
'available_subscriptions': accounts_create_ach_response.get('available_subscriptions', []),
132+
'restricted_subscriptions': accounts_create_ach_response.get('restricted_subscriptions', []),
133+
'consent_status': accounts_create_ach_response.get('consent_status'),
134+
'status': 'active',
135+
'error': None,
136+
'metadata': None,
137+
'created_at': accounts_create_ach_response['created_at'],
138+
'updated_at': accounts_create_ach_response['updated_at'],
125139
}
126-
assert accounts_create_ach_response['products'] == ['payment']
127-
assert accounts_create_ach_response['restricted_products'] == []
128-
assert accounts_create_ach_response['status'] == 'active'
129-
assert accounts_create_ach_response['error'] is None
140+
141+
assert accounts_create_ach_response == expect_results
130142

131143

132144
def test_create_liability_account(setup):
@@ -141,31 +153,69 @@ def test_create_liability_account(setup):
141153
},
142154
})
143155

144-
assert accounts_create_liability_response['id'] is not None
145-
assert accounts_create_liability_response['holder_id'] == holder_1_response['id']
146-
assert accounts_create_liability_response['type'] == 'liability'
147-
assert accounts_create_liability_response['liability']['mch_id'] == 'mch_302086'
148-
assert accounts_create_liability_response['liability']['mask'] == '8721'
149-
assert accounts_create_liability_response['liability']['type'] == 'credit_card'
150-
assert accounts_create_liability_response['liability']['sub_type'] == 'flexible_spending'
151-
assert accounts_create_liability_response['status'] == 'active'
152-
assert accounts_create_liability_response['error'] is None
156+
expect_results: Account = {
157+
'id': accounts_create_liability_response['id'],
158+
'holder_id': holder_1_response['id'],
159+
'type': 'liability',
160+
'liability': {
161+
'fingerprint': None,
162+
'mch_id': 'mch_302086',
163+
'mask': '8721',
164+
'ownership': 'unknown',
165+
'type': 'credit_card',
166+
'name': 'Chase Sapphire Reserve',
167+
'sub_type': 'flexible_spending',
168+
},
169+
'latest_verification_session': accounts_create_liability_response['latest_verification_session'],
170+
'balance': None,
171+
'update': accounts_create_liability_response['update'],
172+
'attribute': accounts_create_liability_response['attribute'],
173+
'card_brand': None,
174+
'payoff': None,
175+
'payment_instrument': accounts_create_liability_response.get('payment_instrument'),
176+
'products': accounts_create_liability_response['products'],
177+
'restricted_products': accounts_create_liability_response['restricted_products'],
178+
'subscriptions': accounts_create_liability_response['subscriptions'],
179+
'available_subscriptions': accounts_create_liability_response.get('available_subscriptions', ['update']),
180+
'restricted_subscriptions': accounts_create_liability_response.get('restricted_subscriptions', []),
181+
'consent_status': accounts_create_liability_response.get('consent_status'),
182+
'status': 'active',
183+
'error': None,
184+
'metadata': None,
185+
'created_at': accounts_create_liability_response['created_at'],
186+
'updated_at': accounts_create_liability_response['updated_at']
187+
}
188+
189+
assert accounts_create_liability_response == expect_results
153190

154191

155192
def test_retrieve_account(setup):
156193
accounts_retrieve_response = method.accounts.retrieve(accounts_create_ach_response['id'])
157194

158-
assert accounts_retrieve_response['id'] == accounts_create_ach_response['id']
159-
assert accounts_retrieve_response['holder_id'] == setup['holder_1_response']['id']
160-
assert accounts_retrieve_response['type'] == 'ach'
161-
assert accounts_retrieve_response['ach'] == {
162-
'routing': '062103000',
163-
'number': '123456789',
164-
'type': 'checking',
195+
expect_results: Account = {
196+
'id': accounts_create_ach_response['id'],
197+
'holder_id': setup['holder_1_response']['id'],
198+
'type': 'ach',
199+
'ach': {
200+
'routing': '062103000',
201+
'number': '123456789',
202+
'type': 'checking',
203+
},
204+
'latest_verification_session': accounts_create_ach_response['latest_verification_session'],
205+
'products': ['payment'],
206+
'restricted_products': [],
207+
'subscriptions': accounts_retrieve_response.get('subscriptions', []),
208+
'available_subscriptions': accounts_retrieve_response.get('available_subscriptions', []),
209+
'restricted_subscriptions': accounts_retrieve_response.get('restricted_subscriptions', []),
210+
'consent_status': accounts_retrieve_response.get('consent_status'),
211+
'status': 'active',
212+
'error': None,
213+
'metadata': None,
214+
'created_at': accounts_retrieve_response['created_at'],
215+
'updated_at': accounts_retrieve_response['updated_at'],
165216
}
166-
assert accounts_retrieve_response['products'] == ['payment']
167-
assert accounts_retrieve_response['status'] == 'active'
168-
assert accounts_retrieve_response['error'] is None
217+
218+
assert accounts_retrieve_response == expect_results
169219

170220

171221
def test_list_accounts(setup):
@@ -1015,24 +1065,148 @@ def test_list_account_products(setup):
10151065

10161066
account_products_list_response = method.accounts(test_credit_card_account['id']).products.list()
10171067

1018-
assert account_products_list_response.get('balance', {}).get('name') == 'balance'
1019-
assert account_products_list_response.get('payment', {}).get('name') == 'payment'
1020-
assert account_products_list_response.get('sensitive', {}).get('name') == 'sensitive'
1021-
assert account_products_list_response.get('update', {}).get('name') == 'update'
1022-
assert account_products_list_response.get('attribute', {}).get('name') == 'attribute'
1023-
assert account_products_list_response.get('card_brand', {}).get('name') == 'card_brand'
1068+
expect_results: AccountProductListResponse = {
1069+
'balance': {
1070+
'name': 'balance',
1071+
'status': 'available',
1072+
'status_error': None,
1073+
'latest_request_id': account_products_list_response.get('balance', {}).get('latest_request_id', None),
1074+
'latest_successful_request_id': account_products_list_response.get('balance', {}).get('latest_successful_request_id', None),
1075+
'is_subscribable': False,
1076+
'created_at': account_products_list_response.get('balance', {}).get('created_at', ''),
1077+
'updated_at': account_products_list_response.get('balance', {}).get('updated_at', ''),
1078+
},
1079+
'payment': {
1080+
'name': 'payment',
1081+
'status': 'available',
1082+
'status_error': None,
1083+
'latest_request_id': account_products_list_response.get('payment', {}).get('latest_request_id', None),
1084+
'latest_successful_request_id': account_products_list_response.get('payment', {}).get('latest_successful_request_id', None),
1085+
'is_subscribable': False,
1086+
'created_at': account_products_list_response.get('payment', {}).get('created_at', ''),
1087+
'updated_at': account_products_list_response.get('payment', {}).get('updated_at', ''),
1088+
},
1089+
'sensitive': {
1090+
'name': 'sensitive',
1091+
'status': 'available',
1092+
'status_error': None,
1093+
'latest_request_id': account_products_list_response.get('sensitive', {}).get('latest_request_id', None),
1094+
'latest_successful_request_id': account_products_list_response.get('sensitive', {}).get('latest_successful_request_id', None),
1095+
'is_subscribable': False,
1096+
'created_at': account_products_list_response.get('sensitive', {}).get('created_at', ''),
1097+
'updated_at': account_products_list_response.get('sensitive', {}).get('updated_at', ''),
1098+
},
1099+
'update': {
1100+
'name': 'update',
1101+
'status': 'available',
1102+
'status_error': None,
1103+
'latest_request_id': account_products_list_response.get('update', {}).get('latest_request_id', None),
1104+
'latest_successful_request_id': account_products_list_response.get('update', {}).get('latest_successful_request_id', None),
1105+
'is_subscribable': True,
1106+
'created_at': account_products_list_response.get('update', {}).get('created_at', ''),
1107+
'updated_at': account_products_list_response.get('update', {}).get('updated_at', ''),
1108+
},
1109+
'attribute': {
1110+
'name': 'attribute',
1111+
'status': 'available',
1112+
'status_error': None,
1113+
'latest_request_id': account_products_list_response.get('attribute', {}).get('latest_request_id', None),
1114+
'latest_successful_request_id': account_products_list_response.get('attribute', {}).get('latest_successful_request_id', None),
1115+
'is_subscribable': False,
1116+
'created_at': account_products_list_response.get('attribute', {}).get('created_at', ''),
1117+
'updated_at': account_products_list_response.get('attribute', {}).get('updated_at', ''),
1118+
},
1119+
'transaction': {
1120+
'name': 'transaction',
1121+
'status': 'unavailable',
1122+
'status_error': account_products_list_response.get('transaction', {}).get('status_error', None),
1123+
'latest_request_id': account_products_list_response.get('transaction', {}).get('latest_request_id', None),
1124+
'latest_successful_request_id': account_products_list_response.get('transaction', {}).get('latest_successful_request_id', None),
1125+
'is_subscribable': True,
1126+
'created_at': account_products_list_response.get('transaction', {}).get('created_at', ''),
1127+
'updated_at': account_products_list_response.get('transaction', {}).get('updated_at', ''),
1128+
},
1129+
'payoff': {
1130+
'name': 'payoff',
1131+
'status': 'unavailable',
1132+
'status_error': account_products_list_response.get('payoff', {}).get('status_error', None),
1133+
'latest_request_id': account_products_list_response.get('payoff', {}).get('latest_request_id', None),
1134+
'latest_successful_request_id': account_products_list_response.get('payoff', {}).get('latest_successful_request_id', None),
1135+
'is_subscribable': False,
1136+
'created_at': account_products_list_response.get('payoff', {}).get('created_at', ''),
1137+
'updated_at': account_products_list_response.get('payoff', {}).get('updated_at', ''),
1138+
},
1139+
'card_brand': {
1140+
'name': 'card_brand',
1141+
'status': 'available',
1142+
'status_error': None,
1143+
'latest_request_id': account_products_list_response.get('card_brand', {}).get('latest_request_id', None),
1144+
'latest_successful_request_id': account_products_list_response.get('card_brand', {}).get('latest_successful_request_id', None),
1145+
'is_subscribable': True,
1146+
'created_at': account_products_list_response.get('card_brand', {}).get('created_at', ''),
1147+
'updated_at': account_products_list_response.get('card_brand', {}).get('updated_at', ''),
1148+
},
1149+
'payment_instrument.card': {
1150+
'name': 'payment_instrument.card',
1151+
'status': account_products_list_response.get('payment_instrument.card', {}).get('status', 'restricted'),
1152+
'status_error': account_products_list_response.get('payment_instrument.card', {}).get('status_error', None),
1153+
'latest_request_id': account_products_list_response.get('payment_instrument.card', {}).get('latest_request_id', None),
1154+
'latest_successful_request_id': account_products_list_response.get('payment_instrument.card', {}).get('latest_successful_request_id', None),
1155+
'is_subscribable': True,
1156+
'created_at': account_products_list_response.get('payment_instrument.card', {}).get('created_at', ''),
1157+
'updated_at': account_products_list_response.get('payment_instrument.card', {}).get('updated_at', ''),
1158+
},
1159+
'payment_instrument.inbound_achwire_payment': {
1160+
'name': 'payment_instrument.inbound_achwire_payment',
1161+
'status': account_products_list_response.get('payment_instrument.inbound_achwire_payment', {}).get('status', 'restricted'),
1162+
'status_error': account_products_list_response.get('payment_instrument.inbound_achwire_payment', {}).get('status_error', None),
1163+
'latest_request_id': account_products_list_response.get('payment_instrument.inbound_achwire_payment', {}).get('latest_request_id', None),
1164+
'latest_successful_request_id': account_products_list_response.get('payment_instrument.inbound_achwire_payment', {}).get('latest_successful_request_id', None),
1165+
'is_subscribable': False,
1166+
'created_at': account_products_list_response.get('payment_instrument.inbound_achwire_payment', {}).get('created_at', ''),
1167+
'updated_at': account_products_list_response.get('payment_instrument.inbound_achwire_payment', {}).get('updated_at', ''),
1168+
},
1169+
'payment_instrument.network_token': {
1170+
'name': 'payment_instrument.network_token',
1171+
'status': account_products_list_response.get('payment_instrument.network_token', {}).get('status', 'restricted'),
1172+
'status_error': account_products_list_response.get('payment_instrument.network_token', {}).get('status_error', None),
1173+
'latest_request_id': account_products_list_response.get('payment_instrument.network_token', {}).get('latest_request_id', None),
1174+
'latest_successful_request_id': account_products_list_response.get('payment_instrument.network_token', {}).get('latest_successful_request_id', None),
1175+
'is_subscribable': True,
1176+
'created_at': account_products_list_response.get('payment_instrument.network_token', {}).get('created_at', ''),
1177+
'updated_at': account_products_list_response.get('payment_instrument.network_token', {}).get('updated_at', ''),
1178+
}
1179+
}
1180+
1181+
assert account_products_list_response == expect_results
10241182

10251183
def test_withdraw_account_consent(setup):
10261184
test_credit_card_account = setup['test_credit_card_account']
10271185
holder_1_response = setup['holder_1_response']
10281186

10291187
withdraw_consent_response = method.accounts.withdraw_consent(test_credit_card_account['id'])
10301188

1031-
assert withdraw_consent_response['id'] == test_credit_card_account['id']
1032-
assert withdraw_consent_response['holder_id'] == holder_1_response['id']
1033-
assert withdraw_consent_response['status'] == 'disabled'
1034-
assert withdraw_consent_response['type'] is None
1035-
assert withdraw_consent_response['liability'] is None
1036-
assert withdraw_consent_response['error']['type'] == 'ACCOUNT_DISABLED'
1037-
assert withdraw_consent_response['error']['sub_type'] == 'ACCOUNT_CONSENT_WITHDRAWN'
1038-
assert withdraw_consent_response['error']['code'] == 11004
1189+
expect_results: Account = {
1190+
'id': withdraw_consent_response['id'],
1191+
'holder_id': holder_1_response['id'],
1192+
'status': 'disabled',
1193+
'type': None,
1194+
'liability': None,
1195+
'products': [],
1196+
'restricted_products': [],
1197+
'subscriptions': [],
1198+
'available_subscriptions': [],
1199+
'restricted_subscriptions': [],
1200+
'consent_status': withdraw_consent_response.get('consent_status'),
1201+
'error': {
1202+
'type': 'ACCOUNT_DISABLED',
1203+
'sub_type': 'ACCOUNT_CONSENT_WITHDRAWN',
1204+
'code': 11004,
1205+
'message': 'Account was disabled due to consent withdrawal.',
1206+
},
1207+
'metadata': None,
1208+
'created_at': withdraw_consent_response['created_at'],
1209+
'updated_at': withdraw_consent_response['updated_at'],
1210+
}
1211+
1212+
assert withdraw_consent_response == expect_results

test/resources/Merchant_test.py

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,24 @@ def test_retrieve_merchant():
1919

2020
merchant_retrieve_response = method.merchants.retrieve(amex_mch_id)
2121

22-
assert merchant_retrieve_response['id'] == 'mch_3'
23-
assert merchant_retrieve_response['parent_name'] == 'American Express'
24-
assert merchant_retrieve_response['type'] == 'credit_card'
25-
assert merchant_retrieve_response['provider_ids']['plaid'] == ['ins_10']
26-
assert merchant_retrieve_response['provider_ids']['mx'] == ['amex']
27-
assert merchant_retrieve_response['is_temp'] is False
22+
expect_results = {
23+
"id": "mch_3",
24+
"parent_name": "American Express",
25+
"name": merchant_retrieve_response['name'],
26+
"logo": "https://static.methodfi.com/mch_logos/mch_3.png",
27+
"type": "credit_card",
28+
"provider_ids": {
29+
"plaid": ["ins_10"],
30+
"mx": ["amex"],
31+
"finicity": [],
32+
"dpp": merchant_retrieve_response['provider_ids']['dpp'],
33+
"rpps": merchant_retrieve_response['provider_ids'].get('rpps', []),
34+
},
35+
"is_temp": False,
36+
"account_number_formats": []
37+
}
38+
39+
assert merchant_retrieve_response == expect_results
2840

2941

3042
def test_list_merchants():
@@ -33,10 +45,23 @@ def test_list_merchants():
3345
merchants_list_response = method.merchants.list({ 'provider_id.plaid': amex_provider_id_plaid })
3446
merchant_to_use = merchants_list_response[0]
3547

48+
expect_results = {
49+
"id": merchant_to_use['id'],
50+
"parent_name": "American Express",
51+
"name": merchant_to_use['name'],
52+
"logo": merchant_to_use['logo'],
53+
"type": "credit_card",
54+
"provider_ids": {
55+
"plaid": ["ins_10"],
56+
"mx": ["amex"],
57+
"finicity": merchant_to_use['provider_ids'].get('finicity', []),
58+
"dpp": merchant_to_use['provider_ids']['dpp'],
59+
"rpps": merchant_to_use['provider_ids'].get('rpps', []),
60+
},
61+
"is_temp": False,
62+
"account_number_formats": merchant_to_use['account_number_formats'],
63+
}
64+
3665
assert merchants_list_response != None
3766
assert isinstance(merchants_list_response._data, list)
38-
assert merchant_to_use['parent_name'] == 'American Express'
39-
assert merchant_to_use['type'] == 'credit_card'
40-
assert merchant_to_use['provider_ids']['plaid'] == ['ins_10']
41-
assert merchant_to_use['provider_ids']['mx'] == ['amex']
42-
assert merchant_to_use['is_temp'] is False
67+
assert merchant_to_use == expect_results

0 commit comments

Comments
 (0)