Skip to content

assert_called_with for multiple requests with same url and method #268

@dyens

Description

@dyens

Hi. I have a two post requests with different payloads:

url = "http://some-url"
mock.post(url, payload={"request": 1})
mock.post(url, payload={"request": 2})

# Make some calls

mock.assert_called_with(
            url,
            method=HTTPMethod.POST,
            json={"request": 1}
)

mock.assert_called_with(
            url,
            method=HTTPMethod.POST,
            json={"request": 2}
)

One of assert_called_with calls must be failed, cause in https://github.com/pnuckowski/aioresponses/blob/master/aioresponses/core.py#L389 we search only last request by (url, method)

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