I'm trying to add some unit tests for a tap and I ...
# singer-tap-development
e
I'm trying to add some unit tests for a tap and I learned about
stream.sync
(from https://github.com/AutoIDM/tap-googleads/blob/main/tap_googleads/tests/test_customer_not_found.py) but that call doesn't return anything. What is the typical best practice to add unit tests for taps?
v
Glad to hear my code might be helping! What's your goal? The goal for this test is to be sure a specific api response doesn't fail.
e
Ah i got it working somewhat but my current issue is that when i run
example_stream.sync()
, it doesn't pick up the child_context values in the path. So I do something like:
Copy code
# in streams.py
class ProjectStream(ExampleStream):
    ...
    path = "{org_id}/projects"
    ...

# in test_core.py
tap: Tap = tap_example.tap.TapExample()
proj_stream: Stream = tap.streams["projects"]
proj_stream.sync(context={"org_id": ORG_ID})
Goal is to ensure that data that the Stream is bringing in matches the mock response (which is just a sanitized version of the actual response)
ah I figured it out, I was putting context in the wrong spot facepalm
v
Glad you figured it out!