lundberg / respx

Mock HTTPX with awesome request patterns and response side effects 🦋
https://lundberg.github.io/respx
BSD 3-Clause "New" or "Revised" License
581 stars 38 forks source link

Add router context manager utility for asserting call count #248

Open lundberg opened 7 months ago

lundberg commented 7 months ago

e.g.

@respx.mock
def test_called():
    respx.get("https://example.com/foobar", name="foobar")
    respx.get("https://example.com/hamspam", name="hamspam")

    with respx.assert_call_count(foobar=1, hamspam=0):
        httpx.get("https://example.com/foobar")