Skip to content

Matchers not working according to docs #308

Open
@MdotMertens

Description

@MdotMertens

Hello,
I want to use the matchers in my consumer tests but using them is kinda weird.
The way that I would expect them to work according to docs is:

    event = {
        "event": "delivery:created",
        "delivery_type": matchers.Term("express|standard", "standard"),
    }

    (
        pact_no_publish.given("Delivery has standard shipping")
        .expects_to_receive("delivery:created")
        .with_content(event)
        .with_metadata({"Content-Type": "application/json"})
    )

What this does is to pass the Term object into the message.

What I have to do in this case is this:

    event = {
        "event": "delivery:created",
        "delivery_type": matchers.Term("express|standard", "standard").generate()["data"]["generate"],
    }

This works but is the same as passing in a string directly and defeats the purpose of the matcher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions