SpinTheMic
Pro

Interview practice question

Testing a job that calls an external API

Data Engineering · Python · Intermediate

How would you unit test a Python job that pulls data from a paginated external API?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Mock HTTP responses with responses or requests-mock.
  • Simulate multiple pages, empty pages and the last page.
  • Simulate errors like 429 and timeouts to test retries.
  • Assert the job writes the expected records.
  • Keep the API client separate from transform logic.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics