-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TDL-15168: Use unique_line_item_id
for invoice updates' lines value instead of id
#134
Changes from 5 commits
6508646
406194d
f0dff09
baa485a
f1ff1a8
3b3935a
8574501
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,28 @@ | |
'payment_intents': set() | ||
} | ||
|
||
# we have observed that the SDK object creation returns some new fields intermittently | ||
SCHEMA_MISSING_FIELDS = { | ||
'customers': { | ||
'test_clock' | ||
}, | ||
'subscriptions': { | ||
'test_clock', | ||
}, | ||
'products':set(), | ||
'invoice_items':{ | ||
'test_clock', | ||
}, | ||
'payouts':set(), | ||
'charges': set(), | ||
'subscription_items': set(), | ||
'plans': set(), | ||
'invoice_line_items': set(), | ||
'invoices': { | ||
'test_clock', | ||
} | ||
} | ||
|
||
KNOWN_FAILING_FIELDS = { | ||
'coupons': { | ||
'percent_off', # BUG_9720 | Decimal('67') != Decimal('66.6') (value is changing in duplicate records) | ||
|
@@ -254,7 +276,10 @@ | |
# As for the `price` field added in the schema, the API doc doesn't mention any | ||
# `trial_period_days` in the field, hence skipping the assertion error for the same. | ||
KNOWN_NESTED_MISSING_FIELDS = { | ||
'subscription_items': {'price': 'recurring.trial_period_days'} | ||
'subscription_items': {'price': 'recurring.trial_period_days'}, | ||
'charges': {'payment_method_details': 'card.mandate'}, | ||
'payment_intents': {'charges': 'payment_method_details.card.mandate', | ||
'payment_method_options': 'card.mandate_options'} | ||
} | ||
|
||
class ALlFieldsTest(BaseTapTest): | ||
|
@@ -373,6 +398,19 @@ def find_nested_key(self, nested_key, actual_field_value, field): | |
if keys[-1] in temp_value: | ||
return True | ||
|
||
def handle_list_data(self, expected_field_value, field, nested_key): | ||
""" | ||
Find the nested key that is failing in the list and ignore the assertion error, if any. | ||
""" | ||
is_fickle = True | ||
for each_expected_field_value in expected_field_value: | ||
if self.find_nested_key(nested_key, each_expected_field_value, field): | ||
continue | ||
else: | ||
is_fickle = False | ||
break | ||
return is_fickle | ||
|
||
def all_fields_test(self, streams_to_test): | ||
""" | ||
Verify that for each stream data is synced when all fields are selected. | ||
|
@@ -456,7 +494,6 @@ def all_fields_test(self, streams_to_test): | |
adjusted_actual_keys = actual_records_keys.union( # BUG_12478 | ||
KNOWN_MISSING_FIELDS.get(stream, set()) | ||
).union(SCHEMA_MISSING_FIELDS.get(stream, set())) | ||
|
||
if stream == 'invoice_items': | ||
adjusted_actual_keys = adjusted_actual_keys.union({'subscription_item'}) # BUG_13666 | ||
|
||
|
@@ -548,8 +585,14 @@ def all_fields_test(self, streams_to_test): | |
f"AssertionError({failure_1})") | ||
|
||
nested_key = KNOWN_NESTED_MISSING_FIELDS.get(stream, {}) | ||
if self.find_nested_key(nested_key, expected_field_value, field): | ||
continue | ||
# Check whether expected_field_value is list or not. | ||
# If expected_field_value is list then loop through each item of list | ||
if type(expected_field_value) == list: | ||
dbshah1212 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if self.handle_list_data(expected_field_value, field, nested_key): | ||
continue | ||
else: | ||
if self.find_nested_key(nested_key, expected_field_value, field): | ||
continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment in PR 133 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kspeer There were 2 types of nested fields replicated from the API, 1. dict and 2. list. So, here we have handled dict keys in |
||
|
||
if field in KNOWN_FAILING_FIELDS[stream] or field in FIELDS_TO_NOT_CHECK[stream]: | ||
continue # skip the following wokaround | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a general comment here regarding which field's value moves to another field and all or write one sample example for both records(old and new) with changed field values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comment.