Skip to content

Conversation

@B3nnyL
Copy link
Contributor

@B3nnyL B3nnyL commented Aug 24, 2022

Issue:

#267

Context:

  • Support verify with a provider branch
  • Updated readme

Actual verification

broken url

ignore = E226,E302,E41,W503
max-line-length = 160
max-complexity = 10
max-complexity = 15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 did this tip us over the edge?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this but in terms of adding a param to the ruby engine this seems legit. I can test early next week and get a release done. To Matt's point do we know why it has bumped to 15? Quite a jump. Assume it's the extra param?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the extra parameter breaks complexity rules, same in #300

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can drop it to 12

./pact/verify_wrapper.py:136:5: C901 'VerifyWrapper.call_verify' is too complex (11)
./pact/broker.py:51:5: C901 'Broker.publish' is too complex (12)

@B3nnyL B3nnyL marked this pull request as ready for review August 24, 2022 04:13
@B3nnyL B3nnyL requested review from YOU54F and elliottmurray August 24, 2022 04:13
@YOU54F
Copy link
Member

YOU54F commented Sep 9, 2022

Tested this out locally and looks good to me, nice work @B3nnyL

import unittest
from pact import Verifier


# PACT_BROKER_URL = "http://localhost"
# PACT_BROKER_USERNAME = "pactbroker"
# PACT_BROKER_PASSWORD = "pactbroker"
PACT_BROKER_URL = "https://saf.pactflow.io"
PACT_BROKER_TOKEN = "foobar"
PROVIDER_HOST = "localhost"
PROVIDER_PORT = 5001
PROVIDER_URL = f"http://{PROVIDER_HOST}:{PROVIDER_PORT}"
PROVIDER_NAME = "bar"
PROVIDER_BRANCH = 'foo'

class GetUserInfoContract(unittest.TestCase):
    def test_get_user(self):
        broker_opts = {
            # "broker_username": PACT_BROKER_USERNAME,
            # "broker_password": PACT_BROKER_PASSWORD,
            "broker_url": PACT_BROKER_URL,
            "broker_token": PACT_BROKER_TOKEN,
            "publish_version": "3",
            "publish_verification_results": True,
        }
        verifier = Verifier(provider=PROVIDER_NAME,
                            provider_base_url=PROVIDER_URL)
        success, logs = verifier.verify_with_broker(
            **broker_opts,
            verbose=True,
            provider_version_branch=PROVIDER_BRANCH,
            enable_pending=True,
        )
        print(success)
        print(logs)
        assert success == 0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants