-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement all_fields test using new framework-tdl-7499 (#159)
* Implement all_fields test using new framework-tdl-7499 * Added couple of methods for table_reset test * Removed the conflicts * Added comments for future work * Test if custom fields are replicated fine * Test if non custom fields are replicated fine * Added custom_fields and non_custom_fields and method to select streams based on the api type * Renamed the testfiles for custom and non-custom fields tests * Added comments for the todo tests * Renamed to different filename * Removed as custom and non-custom fields are split to separate testfiles * Added comment for future work for custom and non-custom fields * override test_all_fields_for_streams_are_replicated to exclude automatic fields * Use automatic fields instead of hardcoding * Implemented PR Review changes to remove the overriden method and add assertion for the custom field name * New method to count custom and non-custom fields from replicated fields * Get the count of custom and non-custom fields and assert * Removed blank spaces around paranthesis * Changed the assertions * fixed assertions * tdl-23781,23563,23654 * Add new tests * review changes * move streams_to test method to base class --------- Co-authored-by: bhtowles <[email protected]> Co-authored-by: JYOTHINARAYANSETTY <[email protected]> Co-authored-by: Jyothi Narayanasetty <[email protected]>
- Loading branch information
1 parent
4c92b4d
commit 5ae6b93
Showing
6 changed files
with
454 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
Test that with only custom fields selected for a stream automatic fields and custom fields are still replicated | ||
""" | ||
from tap_tester.base_suite_tests.all_fields_test import AllFieldsTest | ||
from sfbase import SFBaseTest | ||
|
||
class SFCustomFieldsTest(AllFieldsTest, SFBaseTest): | ||
|
||
salesforce_api = 'BULK' | ||
|
||
@staticmethod | ||
def name(): | ||
return "tt_sf_all_fields_custom" | ||
|
||
streams_to_test = SFBaseTest.streams_to_test | ||
|
||
def streams_to_selected_fields(self): | ||
found_catalogs = AllFieldsTest.found_catalogs | ||
conn_id = AllFieldsTest.conn_id | ||
custom_fields = self.get_custom_fields(found_catalogs, conn_id) | ||
return custom_fields | ||
|
||
def test_all_fields_for_streams_are_replicated(self): | ||
for stream in self.streams_to_test(): | ||
with self.subTest(stream=stream): | ||
automatic_fields = self.expected_automatic_fields(stream) | ||
expected_custom_fields = self.selected_fields.get(stream, set()).union(automatic_fields) | ||
replicated_custom_fields = self.actual_fields.get(stream, set()) | ||
|
||
#Verify that custom and automatic fields are replicated | ||
self.assertSetEqual(expected_custom_fields, replicated_custom_fields, | ||
msg = f"verify all fields are replicated for stream {stream}") | ||
|
||
#Verify at least one custom field is replicated if exists | ||
if len(expected_custom_fields) > len(automatic_fields): | ||
self.assertGreater(len(replicated_custom_fields.difference(automatic_fields)),0, | ||
msg = f"Replication didn't return any custom fields for stream {stream}") | ||
|
||
#Verify that only custom fields are replicated besides automatic fields | ||
_, num_non_custom = self.count_custom_non_custom_fields(replicated_custom_fields) | ||
self.assertEqual(num_non_custom, len(automatic_fields), | ||
msg = f"Replicated some fields that are not custom fields for stream {stream}") |
Oops, something went wrong.