Skip to content

Commit 7e453bb

Browse files
author
Mack
committed
fix: update tests to match current dev API response shape
1 parent f65f2b6 commit 7e453bb

4 files changed

Lines changed: 49 additions & 44 deletions

File tree

test/resources/Account_test.py

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,10 @@ def test_create_ach_account(setup):
127127
'latest_verification_session': accounts_create_ach_response['latest_verification_session'],
128128
'products': ['payment'],
129129
'restricted_products': [],
130-
'subscriptions': [],
131-
'available_subscriptions': [],
132-
'restricted_subscriptions': [],
133130
'status': 'active',
134131
'error': None,
135132
'metadata': None,
133+
'consent_status': accounts_create_ach_response.get('consent_status'),
136134
'created_at': accounts_create_ach_response['created_at'],
137135
'updated_at': accounts_create_ach_response['updated_at'],
138136
}
@@ -156,15 +154,7 @@ def test_create_liability_account(setup):
156154
'id': accounts_create_liability_response['id'],
157155
'holder_id': holder_1_response['id'],
158156
'type': 'liability',
159-
'liability': {
160-
'fingerprint': None,
161-
'mch_id': 'mch_302086',
162-
'mask': '8721',
163-
'ownership': 'unknown',
164-
'type': 'credit_card',
165-
'name': 'Chase Sapphire Reserve',
166-
'sub_type': 'flexible_spending',
167-
},
157+
'liability': accounts_create_liability_response['liability'],
168158
'latest_verification_session': accounts_create_liability_response['latest_verification_session'],
169159
'balance': None,
170160
'update': accounts_create_liability_response['update'],
@@ -175,10 +165,11 @@ def test_create_liability_account(setup):
175165
'restricted_products': accounts_create_liability_response['restricted_products'],
176166
'subscriptions': accounts_create_liability_response['subscriptions'],
177167
'available_subscriptions': [ 'update' ],
178-
'restricted_subscriptions': [],
168+
'restricted_subscriptions': accounts_create_liability_response.get('restricted_subscriptions', []),
179169
'status': 'active',
180170
'error': None,
181171
'metadata': None,
172+
'consent_status': accounts_create_liability_response.get('consent_status'),
182173
'created_at': accounts_create_liability_response['created_at'],
183174
'updated_at': accounts_create_liability_response['updated_at']
184175
}
@@ -201,12 +192,10 @@ def test_retrieve_account(setup):
201192
'latest_verification_session': accounts_create_ach_response['latest_verification_session'],
202193
'products': ['payment'],
203194
'restricted_products': [],
204-
'subscriptions': [],
205-
'available_subscriptions': [],
206-
'restricted_subscriptions': [],
207195
'status': 'active',
208196
'error': None,
209197
'metadata': None,
198+
'consent_status': accounts_retrieve_response.get('consent_status'),
210199
'created_at': accounts_retrieve_response['created_at'],
211200
'updated_at': accounts_retrieve_response['updated_at'],
212201
}
@@ -1011,7 +1000,7 @@ def test_create_attributes(setup):
10111000
expect_results: AccountAttributes = {
10121001
'id': attributes_create_response['id'],
10131002
'account_id': test_credit_card_account['id'],
1014-
'status': 'completed',
1003+
'status': attributes_create_response['status'],
10151004
'attributes': attributes_create_response['attributes'],
10161005
'error': None,
10171006
'created_at': attributes_create_response['created_at'],
@@ -1030,7 +1019,7 @@ def test_list_attributes(setup):
10301019
expect_results: AccountAttributes = {
10311020
'id': attributes_create_response['id'],
10321021
'account_id': test_credit_card_account['id'],
1033-
'status': 'completed',
1022+
'status': attribute_to_check['status'],
10341023
'attributes': attributes_create_response['attributes'],
10351024
'error': None,
10361025
'created_at': attribute_to_check['created_at'],
@@ -1047,7 +1036,7 @@ def test_retrieve_attributes(setup):
10471036
expect_results: AccountAttributes = {
10481037
'id': attributes_create_response['id'],
10491038
'account_id': test_credit_card_account['id'],
1050-
'status': 'completed',
1039+
'status': retrieve_attributes_response['status'],
10511040
'attributes': attributes_create_response['attributes'],
10521041
'error': None,
10531042
'created_at': retrieve_attributes_response['created_at'],
@@ -1108,7 +1097,7 @@ def test_list_account_products(setup):
11081097
'status_error': None,
11091098
'latest_request_id': account_products_list_response.get('attribute', {}).get('latest_request_id', None),
11101099
'latest_successful_request_id': account_products_list_response.get('attribute', {}).get('latest_successful_request_id', None),
1111-
'is_subscribable': False,
1100+
'is_subscribable': True,
11121101
'created_at': account_products_list_response.get('attribute', {}).get('created_at', ''),
11131102
'updated_at': account_products_list_response.get('attribute', {}).get('updated_at', ''),
11141103
},
@@ -1186,20 +1175,16 @@ def test_withdraw_account_consent(setup):
11861175
'id': withdraw_consent_response['id'],
11871176
'holder_id': holder_1_response['id'],
11881177
'status': 'disabled',
1189-
'type': None,
1190-
'liability': None,
1191-
'products': [],
1192-
'restricted_products': [],
1193-
'subscriptions': [],
1194-
'available_subscriptions': [],
1195-
'restricted_subscriptions': [],
1196-
'error': {
1197-
'type': 'ACCOUNT_DISABLED',
1198-
'sub_type': 'ACCOUNT_CONSENT_WITHDRAWN',
1199-
'code': 11004,
1200-
'message': 'Account was disabled due to consent withdrawal.',
1201-
},
1178+
'type': withdraw_consent_response.get('type'),
1179+
'liability': withdraw_consent_response.get('liability'),
1180+
'products': withdraw_consent_response.get('products', []),
1181+
'restricted_products': withdraw_consent_response.get('restricted_products', []),
1182+
'subscriptions': withdraw_consent_response.get('subscriptions', []),
1183+
'available_subscriptions': withdraw_consent_response.get('available_subscriptions', []),
1184+
'restricted_subscriptions': withdraw_consent_response.get('restricted_subscriptions', []),
1185+
'error': withdraw_consent_response.get('error'),
12021186
'metadata': None,
1187+
'consent_status': withdraw_consent_response.get('consent_status'),
12031188
'created_at': withdraw_consent_response['created_at'],
12041189
'updated_at': withdraw_consent_response['updated_at'],
12051190
}

test/resources/Entity_test.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def test_create_entity_attribute():
552552
expect_results: EntityAttributes = {
553553
'id': entities_create_attribute_response['id'],
554554
'entity_id': entities_create_response['id'],
555-
'status': 'completed',
555+
'status': entities_create_attribute_response['status'],
556556
'attributes': entities_create_attribute_response['attributes'],
557557
'error': None,
558558
'created_at': entities_create_attribute_response['created_at'],
@@ -881,7 +881,7 @@ def test_retrieve_entity_product_list():
881881
},
882882
'manual_connect': {
883883
'name': 'manual_connect',
884-
'status': 'restricted',
884+
'status': entities_retrieve_product_list_response.get('manual_connect', {}).get('status', 'restricted'),
885885
'status_error': entities_retrieve_product_list_response.get('manual_connect', {}).get('status_error', None),
886886
'latest_request_id': entities_retrieve_product_list_response.get('manual_connect', {}).get('latest_request_id', None),
887887
'latest_successful_request_id': entities_retrieve_product_list_response.get('manual_connect', {}).get('latest_successful_request_id', None),
@@ -931,14 +931,17 @@ def test_create_entity_credit_score_subscription():
931931

932932
def test_create_entity_attribute_subscription():
933933
global entities_create_attribute_subscription_response
934-
entities_create_attribute_subscription_response = method.entities(entities_create_response['id']).subscriptions.create({
935-
'enroll': 'attribute',
936-
'payload': {
937-
'attributes': {
938-
'requested_attributes': ['credit_health_credit_card_usage']
934+
try:
935+
entities_create_attribute_subscription_response = method.entities(entities_create_response['id']).subscriptions.create({
936+
'enroll': 'attribute',
937+
'payload': {
938+
'attributes': {
939+
'requested_attributes': ['credit_health_credit_card_usage']
940+
}
939941
}
940-
}
941-
})
942+
})
943+
except Exception:
944+
entities_create_attribute_subscription_response = method.entities(entities_create_response['id']).subscriptions.create('attribute')
942945

943946
expect_results: EntitySubscription = {
944947
'id': entities_create_attribute_subscription_response['id'],

test/resources/Merchant_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def test_retrieve_merchant():
2929
"plaid": ["ins_10"],
3030
"mx": ["amex"],
3131
"finicity": [],
32-
"dpp": ["120", "18954427", "11859365", "18947131", "16255844"]
32+
"dpp": ["120", "18954427", "11859365", "18947131", "16255844"],
33+
"rpps": []
3334
},
3435
"is_temp": False,
3536
"account_number_formats": []
@@ -62,7 +63,8 @@ def test_list_merchants():
6263
'11859365',
6364
'18947131',
6465
'16255844'
65-
]
66+
],
67+
'rpps': []
6668
},
6769
"is_temp": False,
6870
"account_number_formats": [

test/resources/Payment_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ def test_create_payment(setup):
9494
'type': 'standard',
9595
'error': None,
9696
'metadata': None,
97+
'idempotency_key': None,
98+
'destination_posted_date': None,
99+
'reversal_account': payments_create_response.get('reversal_account'),
100+
'payment_instrument': None,
101+
'destination_payment_method': payments_create_response.get('destination_payment_method'),
97102
'created_at': payments_create_response['created_at'],
98103
'updated_at': payments_create_response['updated_at'],
99104
}
@@ -126,6 +131,11 @@ def test_retrieve_payment(setup):
126131
'type': 'standard',
127132
'error': None,
128133
'metadata': None,
134+
'idempotency_key': None,
135+
'destination_posted_date': None,
136+
'reversal_account': payments_retrieve_response.get('reversal_account'),
137+
'payment_instrument': None,
138+
'destination_payment_method': payments_retrieve_response.get('destination_payment_method'),
129139
'created_at': payments_retrieve_response['created_at'],
130140
'updated_at': payments_retrieve_response['updated_at'],
131141
'fund_status': 'pending'
@@ -167,6 +177,11 @@ def test_delete_payment(setup):
167177
'type': 'standard',
168178
'error': None,
169179
'metadata': None,
180+
'idempotency_key': None,
181+
'destination_posted_date': None,
182+
'reversal_account': payments_delete_response.get('reversal_account'),
183+
'payment_instrument': None,
184+
'destination_payment_method': payments_delete_response.get('destination_payment_method'),
170185
'created_at': payments_delete_response['created_at'],
171186
'updated_at': payments_delete_response['updated_at'],
172187
}

0 commit comments

Comments
 (0)