Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_deprecated():
url = "https://foo.bar/"
with respx.mock:
respx.request("POST", url, status_code=201)
with respx.HTTPXMock() as httpx_mock:
httpx_mock.request("GET", url)
response = httpx.post(url)
assert response.status_code == 201
response = httpx.get(url)
assert response.status_code == 200
async def test_alias():
async with respx.HTTPXMock(assert_all_called=False) as httpx_mock:
url = "https://foo.bar/"
request = httpx_mock.get(url, alias="foobar")
assert "foobar" not in respx.aliases
assert "foobar" in httpx_mock.aliases
assert httpx_mock.aliases["foobar"].url == request.url
assert httpx_mock["foobar"].url == request.url