-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tdl 15338 fix primary key for events (#84)
* TDL-15338: Updated primary keys for events * TDL-15338: Updated integration test * updated readme file * Resolved internal PR review comments * Resolved review comments * run bookmark test with hour and day range Co-authored-by: harshpatel4_crest <[email protected]> Co-authored-by: Harsh <[email protected]>
- Loading branch information
1 parent
f1523ca
commit ce2b0cb
Showing
4 changed files
with
36 additions
and
3 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
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,32 @@ | ||
import unittest | ||
from tap_pendo.streams import Events | ||
|
||
class TestEventsPrimaryKeys(unittest.TestCase): | ||
|
||
def test_event_primary_key_with_hourRange(self): | ||
''' | ||
Verify that primary keys should have expected fields with 'hour' field when period is hourRange | ||
''' | ||
# Reset key properties to default value | ||
Events.key_properties = ['visitor_id', 'account_id', 'server', 'remote_ip', 'user_agent'] | ||
config = {"period": "hourRange"} # set hourRange as a period | ||
expected_primary_keys = ["visitor_id", "account_id", "server", "remote_ip", "user_agent", "hour"] | ||
|
||
event_stream1 = Events(config) # Initialize Events object which sets primary keys | ||
|
||
self.assertEqual(event_stream1.key_properties, expected_primary_keys) | ||
|
||
|
||
|
||
def test_event_primary_key_with_dayRange(self): | ||
''' | ||
Verify that primary keys should have expected fields with 'day' field when period is dayRange | ||
''' | ||
# Reset key properties to default value | ||
Events.key_properties = ['visitor_id', 'account_id', 'server', 'remote_ip', 'user_agent'] | ||
config = {"period": "dayRange"} # set dayRange as a period | ||
expected_primary_keys = ["visitor_id", "account_id", "server", "remote_ip", "user_agent", "day"] | ||
|
||
event_stream2 = Events(config) # Initialize Events object which sets primary keys | ||
|
||
self.assertEqual(event_stream2.key_properties, expected_primary_keys) |