Skip to content

Commit 447b8bb

Browse files
Resolve #17: Deprecate --provider-states-url
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
1 parent 04107db commit 447b8bb

File tree

3 files changed

+3
-23
lines changed

3 files changed

+3
-23
lines changed

pact/test/test_verify.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,6 @@ def test_local_pact_urls_must_exist(self):
7474
self.assertIn(b'./pacts/consumer-provider.json', result.output_bytes)
7575
self.assertFalse(self.mock_Popen.called)
7676

77-
def test_must_provide_both_provide_states_options(self):
78-
result = self.runner.invoke(verify.main, [
79-
'--provider-base-url=http://localhost',
80-
'--pact-urls=./pacts/consumer-provider.json',
81-
'--provider-states-url=http://localhost/provider-state'
82-
])
83-
self.assertEqual(result.exit_code, 1)
84-
self.assertIn(b'--provider-states-url', result.output_bytes)
85-
self.assertIn(b'--provider-states-setup-url', result.output_bytes)
86-
self.assertFalse(self.mock_Popen.called)
87-
8877
def test_verification_timeout(self):
8978
self.mock_Popen.return_value.communicate.side_effect = TimeoutExpired(
9079
[], 30)
@@ -129,7 +118,6 @@ def test_all_options(self):
129118
'./pacts/consumer-provider2.json',
130119
'--pact-url=./pacts/consumer-provider3.json',
131120
'--pact-url=./pacts/consumer-provider4.json',
132-
'--provider-states-url=http=//localhost/provider-states',
133121
'--provider-states-setup-url=http://localhost/provider-states/set',
134122
'--pact-broker-username=user',
135123
'--pact-broker-password=pass',
@@ -142,7 +130,6 @@ def test_all_options(self):
142130
'--pact-urls=./pacts/consumer-provider3.json,'
143131
'./pacts/consumer-provider4.json,'
144132
'./pacts/consumer-provider.json,./pacts/consumer-provider2.json',
145-
'--provider-states-url=http=//localhost/provider-states',
146133
'--provider-states-setup-url=http://localhost/provider-states/set',
147134
'--broker-username=user',
148135
'--broker-password=pass')

pact/verify.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
multiple=True) # Remove in major version 1.0.0
3333
@click.option(
3434
'states_url', '--provider-states-url',
35-
help='URL to fetch the provider states for the given provider API.')
35+
help='DEPRECATED: URL to fetch the provider states for'
36+
' the given provider API.') # Remove in major version 1.0.0
3637
@click.option(
3738
'states_setup_url', '--provider-states-setup-url',
3839
help='URL to send PUT requests to setup a given provider state.')
@@ -61,13 +62,6 @@ def main(base_url, pact_url, pact_urls, states_url, states_setup_url, username,
6162
""" # NOQA
6263
error = click.style('Error:', fg='red')
6364
warning = click.style('Warning:', fg='yellow')
64-
if bool(states_url) != bool(states_setup_url):
65-
click.echo(
66-
error
67-
+ ' To use provider states you must provide both'
68-
' --provider-states-url and --provider-states-setup-url.')
69-
raise click.Abort()
70-
7165
all_pact_urls = list(pact_url)
7266
for urls in pact_urls: # Remove in major version 1.0.0
7367
all_pact_urls.extend(p for p in urls.split(',') if p)
@@ -96,7 +90,6 @@ def main(base_url, pact_url, pact_urls, states_url, states_setup_url, username,
9690
options = {
9791
'--provider-base-url': base_url,
9892
'--pact-urls': ','.join(all_pact_urls),
99-
'--provider-states-url': states_url,
10093
'--provider-states-setup-url': states_setup_url,
10194
'--broker-username': username,
10295
'--broker-password': password

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
IS_64 = sys.maxsize > 2 ** 32
16-
PACT_STANDALONE_VERSION = '1.0.0'
16+
PACT_STANDALONE_VERSION = '1.1.1'
1717

1818

1919
here = os.path.abspath(os.path.dirname(__file__))

0 commit comments

Comments
 (0)