diff --git a/tests/base.py b/tests/base.py index 7a12f7b1..48bc91a5 100644 --- a/tests/base.py +++ b/tests/base.py @@ -8,6 +8,10 @@ from tap_tester import connections, menagerie, runner, LOGGER from tap_tester.base_case import BaseCase +from tap_tester.jira_client import JiraClient as jira_client +from tap_tester.jira_client import CONFIGURATION_ENVIRONMENT as jira_config + +JIRA_CLIENT = jira_client({ **jira_config }) class FacebookBaseTest(BaseCase): diff --git a/tests/test_facebook_attribution_window.py b/tests/test_facebook_attribution_window.py index fdb066b0..3df6bd47 100644 --- a/tests/test_facebook_attribution_window.py +++ b/tests/test_facebook_attribution_window.py @@ -1,3 +1,4 @@ +import base import os from tap_tester import runner, connections @@ -7,13 +8,26 @@ class FacebookAttributionWindow(FacebookBaseTest): + is_done = None + @staticmethod def name(): return "tap_tester_facebook_attribution_window" def streams_to_test(self): """ 'attribution window' is only supported for 'ads_insights' streams """ - return [stream for stream in self.expected_streams() if self.is_insight(stream)] + + # Fail the test when the JIRA card is done to allow stream to be re-added and tested + if self.is_done is None: + self.is_done = base.JIRA_CLIENT.get_status_category("TDL-24312") == 'done' + self.assert_message = ("JIRA ticket has moved to done, re-add the " + "ads_insights_hourly_advertiser stream to the test.") + assert self.is_done != True, self.assert_message + + # return [stream for stream in self.expected_streams() if self.is_insight(stream)] + return [stream for stream in self.expected_streams() + if self.is_insight(stream) + and stream != 'ads_insights_hourly_advertiser'] def get_properties(self, original: bool = True): """Configuration properties required for the tap.""" diff --git a/tests/test_facebook_bookmarks.py b/tests/test_facebook_bookmarks.py index 30749dfb..1024d4e0 100644 --- a/tests/test_facebook_bookmarks.py +++ b/tests/test_facebook_bookmarks.py @@ -1,6 +1,7 @@ -import os +import base import datetime import dateutil.parser +import os import pytz from tap_tester import runner, menagerie, connections @@ -9,12 +10,22 @@ class FacebookBookmarks(FacebookBaseTest): + + is_done = None + @staticmethod def name(): return "tap_tester_facebook_bookmarks" def streams_to_test(self): - return self.expected_streams() + # Fail the test when the JIRA card is done to allow stream to be re-added and tested + if self.is_done is None: + self.is_done = base.JIRA_CLIENT.get_status_category("TDL-24312") == 'done' + self.assert_message = ("JIRA ticket has moved to done, re-add the " + "ads_insights_hourly_advertiser stream to the test.") + assert self.is_done != True, self.assert_message + + return self.expected_streams() - {'ads_insights_hourly_advertiser'} @staticmethod def convert_state_to_utc(date_str): diff --git a/tests/test_facebook_start_date.py b/tests/test_facebook_start_date.py index 4e86055b..f2be681f 100644 --- a/tests/test_facebook_start_date.py +++ b/tests/test_facebook_start_date.py @@ -1,3 +1,4 @@ +import base import os from tap_tester import connections, runner, LOGGER @@ -7,6 +8,7 @@ class FacebookStartDateTest(FacebookBaseTest): + is_done = None start_date_1 = "" start_date_2 = "" @@ -15,7 +17,14 @@ def name(): return "tap_tester_facebook_start_date_test" def streams_to_test(self): - return self.expected_streams() + # Fail the test when the JIRA card is done to allow stream to be re-added and tested + if self.is_done is None: + self.is_done = base.JIRA_CLIENT.get_status_category("TDL-24312") == 'done' + self.assert_message = ("JIRA ticket has moved to done, re-add the " + "ads_insights_hourly_advertiser stream to the test.") + assert self.is_done != True, self.assert_message + + return self.expected_streams() - {'ads_insights_hourly_advertiser'} def test_run(self): """Instantiate start date according to the desired data set and run the test"""