Courseiva

200-901 Infrastructure and Automation Practice Question

A developer is designing unit tests for a Python function that calls a Cisco Meraki Dashboard API endpoint to retrieve organization inventory. The tests must run quickly in CI without making real network calls, and must verify that the function builds the correct request. Which TWO practices should the developer implement? (Choose two.)

⚠ Common exam trap

The trap here is believing that hitting the live Meraki API in a unit test proves correctness, when it actually introduces flakiness and rate-limit failures that a mocked client avoids entirely.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Assert on the recorded request's URL, HTTP method, and the presence of the API key header.

Unit tests for API-calling code should isolate the function from the network and assert on the request it constructs. Mocking the HTTP client provides deterministic responses, while checking the method, URL, and authentication header verifies the contract with the Meraki Dashboard API. Together these keep the suite fast, repeatable, and meaningful in CI.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Insert a fixed sleep of thirty seconds before each assertion to let the API respond.

    Why it's wrong here

    Adding a fixed sleep slows the suite dramatically and still does not guarantee the response has arrived, making tests both slow and unreliable. It addresses a symptom of live calls rather than removing the dependency. Mocking the client eliminates the need for any wait at all.

  • ✓

    Assert on the recorded request's URL, HTTP method, and the presence of the API key header.

    Why this is correct

    Verifying the captured request's URL, verb, and authentication header confirms the function builds the correct Meraki call without contacting the service. This is the behavioral contract the unit test should protect, and it catches regressions such as a wrong endpoint path or a missing X-Cisco-Meraki-API-Key header before they reach integration testing.

  • ✗

    Disable all assertions and rely on the test passing if no exception is raised during the call.

    Why it's wrong here

    A test that only checks for the absence of exceptions verifies almost nothing about correctness; the function could call the wrong endpoint and still pass. It provides no protection against regressions in URL construction, headers, or parsing. This practice defeats the purpose of unit testing the request-building logic.

  • ✓

    Mock the HTTP client so the function's request is intercepted and a canned JSON response is returned.

    Why this is correct

    Mocking the HTTP client intercepts the outbound call before it reaches the network, letting the test assert on the URL, headers, and method the function constructs while returning a deterministic canned response. This keeps the test fast and independent of Meraki availability or API rate limits, which is exactly what CI unit testing requires.

  • ✗

    Point the function at the live Meraki Dashboard API and compare the response to a previously saved response body.

    Why it's wrong here

    Calling the live API makes the test slow, flaky, and dependent on network conditions, account state, and rate limits. Saved responses also drift as the organization's inventory changes, producing false failures. This is an integration test pattern, not a fast unit test suitable for CI.

About these practice questions

One of 975 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Cisco exam blueprint

This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.