From 423483924ae9a0fe1715ad5b517d53e7cf62f4d0 Mon Sep 17 00:00:00 2001 From: danielpdwalker Date: Sun, 25 Jun 2023 14:05:44 +0100 Subject: [PATCH] Added tests around streams being enabled depending on tap settings provided --- tests/test_core.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 7379a3f..581d6b6 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1,22 +1,36 @@ """Tests standard tap features using the built-in SDK tests library.""" -import datetime +import unittest from singer_sdk.testing import get_tap_test_class from tap_theme_parks.tap import TapThemeParks -SAMPLE_CONFIG = { - "start_date": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"), - # TODO: Initialize minimal tap config -} +DEFAULT_CONFIG = {} + +SAMPLE_CONFIG = {"live_data_array": ["1", "2", "3"]} # Run standard built-in tap tests from the SDK: TestTapThemeParks = get_tap_test_class( tap_class=TapThemeParks, - config=SAMPLE_CONFIG, + config=DEFAULT_CONFIG, ) -# TODO: Create additional tests as appropriate for your tap. +class TestEnabledStreams(unittest.TestCase): + """Test class for enabled streams""" + + def test_default_streams(self): + catalog = TapThemeParks().discover_streams() + + self.assertEqual(len(catalog), 3, "Expected 3 streams from catalog by default") + + def test_streams_with_live_data_array(self): + catalog = TapThemeParks(config=SAMPLE_CONFIG).discover_streams() + + self.assertEqual( + len(catalog), + 5, + "Expected 5 streams from catalog with the live_data_array setting provided", + )