With given code:
import httpx
from respx.router import MockRouter
class TestErrorFeedback:
def test_missing_path(self, respx_mock: MockRouter) -> None:
url: str = 'https://example.com'
respx_mock.get(url=url + '/hey').respond(status_code=200)
httpx.get(url=url)
def test_missing_header(self, respx_mock: MockRouter) -> None:
url: str = 'https://example.com'
headers: dict[str, str] = {'session': 'TheSuperSecretKey'}
respx_mock.get(url=url, headers=headers).respond(status_code=200)
httpx.get(url=url)
def test_missing_params(self, respx_mock: MockRouter) -> None:
url: str = 'https://example.com/'
params: dict[str, str | int] = {'expand': 0}
respx_mock.get(url=url, params=params).respond(status_code=200)
httpx.get(url=url)
def test_missing_json(self, respx_mock: MockRouter) -> None:
url: str = 'https://example.com/'
json: dict[str, str | int] = {"code": 42}
respx_mock.get(url=url, json=json).respond(status_code=200)
httpx.get(url=url)
it gives the same error for all test cases:
respx.models.AllMockedAssertionError: RESPX: <Request('GET', 'https://example.com/')> not mocked!.
It would be nice if it wrote where the different occurred.
With given code:
it gives the same error for all test cases:
respx.models.AllMockedAssertionError: RESPX: <Request('GET', 'https://example.com/')> not mocked!.It would be nice if it wrote where the different occurred.