Skip to content

Regression 0.23.0: multiple mocks with various params #311

Description

@ziima

Following test

import httpx
import respx
from httpx import Response

with respx.mock(using="httpx") as rsps:
    rsps.get("http://example.org/", params={"page": 0}).mock(Response(200))
    rsps.get("http://example.org/", params={"page": 1}).mock(Response(400))

    response_1 = httpx.get("http://example.org/", params={"page": 0})
    assert response_1.status_code == 200
    response_2 = httpx.get("http://example.org/", params={"page": 1})
    assert response_2.status_code == 400

runs properly up to respx 0.22.0, but it fails in 0.23.0 with

respx.models.AllMockedAssertionError: RESPX: <Request('GET', 'http://example.org/?page=0')> not mocked!

I was able to debug to a point that second mock overrides the first mock, even though they mock for a different requests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions