How to use the pactman.verifier.broker_pact.BrokerPacts 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 / verifier / pytest_plugin.py View on Github external
pact_files = get_pact_files(metafunc.config.getoption("pact_files"))
            if not pact_files:
                raise ValueError("need a --pact-broker-url or --pact-files option")
            metafunc.parametrize(
                "pact_verifier", flatten_pacts(pact_files), ids=test_id, indirect=True
            )
        else:
            provider_name = metafunc.config.getoption("pact_provider_name")
            if not provider_name:
                raise ValueError("--pact-broker-url requires the --pact-provider-name option")
            broker = PactBrokerConfig(
                broker_url,
                metafunc.config.getoption("pact_broker_token"),
                metafunc.config.getoption("pact_consumer_version_tag", []),
            )
            broker_pacts = BrokerPacts(
                provider_name, pact_broker=broker, result_factory=PytestResult
            )
            pacts = broker_pacts.consumers()
            filter_consumer_name = metafunc.config.getoption("pact_verify_consumer")
            if not filter_consumer_name:
                filter_consumer_name = metafunc.config.getoption("pact_consumer_name")
                if filter_consumer_name:
                    warnings.warn(
                        "The --pact-consumer-name command-line option is deprecated "
                        "and will be removed in the 3.0.0 release.",
                        DeprecationWarning,
                    )
            if filter_consumer_name:
                pacts = [pact for pact in pacts if pact.consumer == filter_consumer_name]
            metafunc.parametrize("pact_verifier", flatten_pacts(pacts), ids=test_id, indirect=True)
github reecetech / pactman / pactman / verifier / command_line.py View on Github external
def get_pacts(args):
    result_log_level = get_log_level(args)
    result_factory = partial(CaptureResult, level=result_log_level)
    if args.local_pact_file:
        pacts = [BrokerPact.load_file(args.local_pact_file, result_factory)]
    else:
        broker_config = PactBrokerConfig(
            args.broker_url, args.broker_token, args.consumer_version_tag
        )
        pacts = BrokerPacts(args.provider_name, broker_config, result_factory).consumers()
    return pacts