Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def test_start_stop(client):
url = "https://foo.bar/"
request = respx.add("GET", url, status_code=202)
assert respx.stats.call_count == 0
try:
respx.start()
response = await client.get(url)
assert request.called is True
assert response.status_code == 202
assert response.text == ""
assert respx.stats.call_count == 1
respx.stop(clear=False, reset=False)
assert len(respx.mock.patterns) == 1
assert respx.stats.call_count == 1
assert request.called is True
respx.reset()