Skip to content

Commit

Permalink
Resolve #17: Deprecate --provider-states-url
Browse files Browse the repository at this point in the history
The pact-verifier has removed the need for passing --provider-states-url so we can now skip
passing it to the process. We will leave our option in place until version 1.0.0 to maintain
backwards compatibility for anyone who has scripted calling the Python code
  • Loading branch information
matthewbalvanz-wf committed Jul 29, 2017
1 parent 04107db commit 447b8bb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
13 changes: 0 additions & 13 deletions pact/test/test_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,6 @@ def test_local_pact_urls_must_exist(self):
self.assertIn(b'./pacts/consumer-provider.json', result.output_bytes)
self.assertFalse(self.mock_Popen.called)

def test_must_provide_both_provide_states_options(self):
result = self.runner.invoke(verify.main, [
'--provider-base-url=http://localhost',
'--pact-urls=./pacts/consumer-provider.json',
'--provider-states-url=http://localhost/provider-state'
])
self.assertEqual(result.exit_code, 1)
self.assertIn(b'--provider-states-url', result.output_bytes)
self.assertIn(b'--provider-states-setup-url', result.output_bytes)
self.assertFalse(self.mock_Popen.called)

def test_verification_timeout(self):
self.mock_Popen.return_value.communicate.side_effect = TimeoutExpired(
[], 30)
Expand Down Expand Up @@ -129,7 +118,6 @@ def test_all_options(self):
'./pacts/consumer-provider2.json',
'--pact-url=./pacts/consumer-provider3.json',
'--pact-url=./pacts/consumer-provider4.json',
'--provider-states-url=http=//localhost/provider-states',
'--provider-states-setup-url=http://localhost/provider-states/set',
'--pact-broker-username=user',
'--pact-broker-password=pass',
Expand All @@ -142,7 +130,6 @@ def test_all_options(self):
'--pact-urls=./pacts/consumer-provider3.json,'
'./pacts/consumer-provider4.json,'
'./pacts/consumer-provider.json,./pacts/consumer-provider2.json',
'--provider-states-url=http=//localhost/provider-states',
'--provider-states-setup-url=http://localhost/provider-states/set',
'--broker-username=user',
'--broker-password=pass')
Expand Down
11 changes: 2 additions & 9 deletions pact/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
multiple=True) # Remove in major version 1.0.0
@click.option(
'states_url', '--provider-states-url',
help='URL to fetch the provider states for the given provider API.')
help='DEPRECATED: URL to fetch the provider states for'
' the given provider API.') # Remove in major version 1.0.0
@click.option(
'states_setup_url', '--provider-states-setup-url',
help='URL to send PUT requests to setup a given provider state.')
Expand Down Expand Up @@ -61,13 +62,6 @@ def main(base_url, pact_url, pact_urls, states_url, states_setup_url, username,
""" # NOQA
error = click.style('Error:', fg='red')
warning = click.style('Warning:', fg='yellow')
if bool(states_url) != bool(states_setup_url):
click.echo(
error
+ ' To use provider states you must provide both'
' --provider-states-url and --provider-states-setup-url.')
raise click.Abort()

all_pact_urls = list(pact_url)
for urls in pact_urls: # Remove in major version 1.0.0
all_pact_urls.extend(p for p in urls.split(',') if p)
Expand Down Expand Up @@ -96,7 +90,6 @@ def main(base_url, pact_url, pact_urls, states_url, states_setup_url, username,
options = {
'--provider-base-url': base_url,
'--pact-urls': ','.join(all_pact_urls),
'--provider-states-url': states_url,
'--provider-states-setup-url': states_setup_url,
'--broker-username': username,
'--broker-password': password
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


IS_64 = sys.maxsize > 2 ** 32
PACT_STANDALONE_VERSION = '1.0.0'
PACT_STANDALONE_VERSION = '1.1.1'


here = os.path.abspath(os.path.dirname(__file__))
Expand Down

1 comment on commit 447b8bb

@bethesque
Copy link
Member

Choose a reason for hiding this comment

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

@matthewbalvanz-wf could you release this soon please? I am helping out some pact users who are confused about whether it's in or out, and I'd like to tell them it's out now!

Please sign in to comment.