How to use the pactman.mock.matchers.Equals function in pactman

To help you get started, we’ve selected a few pactman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reecetech / pactman / pactman / mock / matchers.py View on Github external
for i, v in enumerate(input):
            sub_path = path + "[*]"
            rules.update(get_matching_rules_v2(v, sub_path))
        return rules
    if isinstance(input, LIKE_CLASSES):
        rules = {path: {"match": "type"}}
        rules.update(get_matching_rules_v2(input.matcher, path))
        return rules
    if isinstance(input, EACHLIKE_CLASSES):
        rules = {path: {"match": "type", "min": input.minimum}}
        rules.update(get_matching_rules_v2(input.matcher, path))
        return rules
    if isinstance(input, TERM_CLASSES):
        return {path: {"regex": input.matcher}}
    if isinstance(input, Equals):
        raise Equals.NotAllowed(f"Equals() cannot be used in pact version 2")
    if isinstance(input, Includes):
        raise Includes.NotAllowed(f"Includes() cannot be used in pact version 2")

    raise ValueError("Unknown type: %s" % type(input))
github reecetech / pactman / pactman / mock / matchers.py View on Github external
rules = {}
        for i, v in enumerate(input):
            sub_path = path + "[*]"
            rules.update(get_matching_rules_v2(v, sub_path))
        return rules
    if isinstance(input, LIKE_CLASSES):
        rules = {path: {"match": "type"}}
        rules.update(get_matching_rules_v2(input.matcher, path))
        return rules
    if isinstance(input, EACHLIKE_CLASSES):
        rules = {path: {"match": "type", "min": input.minimum}}
        rules.update(get_matching_rules_v2(input.matcher, path))
        return rules
    if isinstance(input, TERM_CLASSES):
        return {path: {"regex": input.matcher}}
    if isinstance(input, Equals):
        raise Equals.NotAllowed(f"Equals() cannot be used in pact version 2")
    if isinstance(input, Includes):
        raise Includes.NotAllowed(f"Includes() cannot be used in pact version 2")

    raise ValueError("Unknown type: %s" % type(input))