Skip to content

Commit

Permalink
Remove problem stream from applicable tests, fail test when associate…
Browse files Browse the repository at this point in the history
…d JIRA card is done (#228)
  • Loading branch information
bhtowles authored Oct 13, 2023
1 parent 510eeb0 commit 37274c3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
16 changes: 15 additions & 1 deletion tests/test_facebook_attribution_window.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base
import os

from tap_tester import runner, connections
Expand All @@ -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."""
Expand Down
15 changes: 13 additions & 2 deletions tests/test_facebook_bookmarks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import base
import datetime
import dateutil.parser
import os
import pytz

from tap_tester import runner, menagerie, connections
Expand All @@ -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):
Expand Down
11 changes: 10 additions & 1 deletion tests/test_facebook_start_date.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base
import os

from tap_tester import connections, runner, LOGGER
Expand All @@ -7,6 +8,7 @@

class FacebookStartDateTest(FacebookBaseTest):

is_done = None
start_date_1 = ""
start_date_2 = ""

Expand All @@ -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"""
Expand Down

0 comments on commit 37274c3

Please sign in to comment.