james_marcogliese
05/03/2023, 1:42 PMtest_core.py
which contains the following snippet which runs the built-in tests along with any custom suites:
# Run standard built-in tap tests from the SDK:
TestTapopenexchangerates = get_tap_test_class(
tap_class=Tapopenexchangerates,
config=SAMPLE_CONFIG,
custom_suites=[tap_stream_test_suite, tap_tap_test_suite]
)
If live credentials are supplied as SAMPLE_CONFIG, the tests run as expected but hit an actual endpoint ($$). Obviously, I’ve like to mock responses so that fake credentials can be used. I’ve tried placing the above code block in scope of a requests mock in the hope that all the underlying requests would be mocked, including using the requests-mock package to do so, but I can’t seem to have the underlying requests pick up the mock. Am I making a mistake due to a fundamental misunderstanding of how this is supposed to work? Has anyone run into a similar issue? Tried searching through the messages in this channel but couldn’t find much. Thanks!edgar_ramirez_mondragon
05/03/2023, 2:13 PMresponses
library in tap-dbt to mock the API responses: https://github.com/MeltanoLabs/tap-dbt/blob/main/tests/test_core.pyjames_marcogliese
05/03/2023, 6:18 PMget_standard_tap_tests
method; I suppose there’s no way to use the newer method in the same way? If not, I’ll try to disregard the newer methods and run it like the legacy style like you have.edgar_ramirez_mondragon
05/03/2023, 6:48 PM_TestTapDBT = get_tap_test_class(TapDBT, config=SAMPLE_CONFIG)
class TestTapDBT(_TestTapDBT):
@pytest.fixture(autouse=True)
@responses.activate
def _responses(self):
responses.add_passthru(re.compile("<https://raw.githubusercontent.com/>\\w+"))
...
cc @ken_payne