pact_broker-client 0.0.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile.lock +57 -32
  4. data/README.md +47 -0
  5. data/doc/markdown/Pact Broker Client - Pact Broker.md +582 -0
  6. data/doc/markdown/README.md +3 -0
  7. data/lib/pact_broker/client/base_client.rb +3 -1
  8. data/lib/pact_broker/client/pact_broker_client.rb +4 -3
  9. data/lib/pact_broker/client/pacticipants.rb +1 -1
  10. data/lib/pact_broker/client/pacts.rb +22 -6
  11. data/lib/pact_broker/client/publish_pacts.rb +16 -6
  12. data/lib/pact_broker/client/retry.rb +26 -0
  13. data/lib/pact_broker/client/tasks/publication_task.rb +3 -2
  14. data/lib/pact_broker/client/version.rb +1 -1
  15. data/lib/pact_broker/client/versions.rb +1 -1
  16. data/spec/lib/pact_broker/client/base_client_spec.rb +51 -0
  17. data/spec/lib/pact_broker/client/pact_broker_client_spec.rb +28 -1
  18. data/spec/lib/pact_broker/client/pacticipants_spec.rb +18 -0
  19. data/spec/lib/pact_broker/client/publish_pacts_spec.rb +67 -5
  20. data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +4 -2
  21. data/spec/lib/pact_broker/client/versions_spec.rb +18 -0
  22. data/spec/pacts/pact_broker_client-pact_broker.json +87 -91
  23. data/spec/service_providers/pact_broker_client_pacticipant_version_spec.rb +56 -0
  24. data/spec/service_providers/pact_broker_client_publish_spec.rb +34 -12
  25. data/spec/service_providers/pact_broker_client_register_repository_spec.rb +2 -2
  26. data/spec/service_providers/pact_broker_client_retrive_pact_spec.rb +4 -47
  27. data/spec/service_providers/pact_broker_client_tags_spec.rb +3 -3
  28. data/spec/support/pacticipant_get.json +3 -3
  29. data/spec/support/pacticipants_list.json +1 -1
  30. data/spec/support/pacts_latest_list.json +2 -2
  31. metadata +34 -45
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6a967616dbb7645aee64d92eb651df824eafc0c2
4
+ data.tar.gz: a71df89ab5813ff99fe394b95132181e8411512f
5
+ SHA512:
6
+ metadata.gz: 54a964cd4ee363a53da92ea018b94ea9fbc868c485a4351a7c69ba359d2cde0c013136298a1c736b54da8e767c243f8e548f5290e8c52f8dc7568dfb8fb4b987
7
+ data.tar.gz: 965141aba58e46843f5f6defd961c3f5077086920bf7fe3e760c1c3b4925face6f4aeb3210c7bda523a06a0c37c7f226137463fc401ee44920dbb50ff97b2942
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@ Do this to generate your change history
2
2
 
3
3
  $ git log --pretty=format:' * %h - %s (%an, %ad)'
4
4
 
5
+ #### 1.0.0 (2014-10-09)
6
+
7
+ * 2c08da2 - added pact_broker_basic_auth options to publish task (lifei zhou, Fri Feb 27 21:33:09 2015 +1100)
8
+ * 1b84a54 - Updated pact-version rel name (Beth, Mon Dec 22 11:30:57 2014 +1100)
9
+ * 04c1e4e - Updated link rels (Beth, Thu Dec 11 14:32:27 2014 +1100)
10
+ * d1b2cad - Correcting pact publish message (Beth Skurrie, Mon Aug 25 07:15:57 2014 +1000)
11
+ * 6b1d147 - Added backwards compatibility for pact broker publish response (Beth Skurrie, Sun Aug 24 17:50:16 2014 +1000)
12
+ * 8c8aa89 - Added location of latest pact to output of pact:publish (Beth Skurrie, Sun Aug 24 17:43:02 2014 +1000)
13
+ * e6b56d0 - Added retries for pact publishing (Beth Skurrie, Sun Aug 24 16:55:10 2014 +1000)
14
+ * 27c00e5 - Disabled pacticipant version interactions, not needed yet. (Beth Skurrie, Sat May 17 17:57:33 2014 +1000)
15
+ * cfefdc4 - Changed path from /pact to /pacts (Beth Skurrie, Sat May 17 15:58:32 2014 +1000)
16
+
5
17
  #### 0.0.6 (2014-03-24)
6
18
 
7
19
  * 2ad5f7d - Updated method of tagging versions (bethesque, Sat Mar 22 16:54:37 2014 +1100)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pact_broker-client (0.0.6)
4
+ pact_broker-client (1.0.0)
5
5
  httparty
6
6
  json
7
7
  pact
@@ -9,54 +9,76 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- awesome_print (1.2.0)
13
- coderay (1.0.9)
14
- daemons (1.1.9)
12
+ awesome_print (1.6.1)
13
+ coderay (1.1.0)
15
14
  diff-lcs (1.2.5)
16
- eventmachine (1.0.3)
17
- fakefs (0.4.2)
15
+ fakefs (0.6.0)
18
16
  find_a_port (1.0.1)
19
- httparty (0.13.0)
17
+ httparty (0.13.7)
20
18
  json (~> 1.8)
21
19
  multi_xml (>= 0.5.2)
22
- json (1.8.1)
20
+ json (1.8.3)
23
21
  method_source (0.8.2)
24
22
  multi_xml (0.5.5)
25
- pact (1.0.30)
23
+ pact (1.9.0)
26
24
  awesome_print (~> 1.1)
27
25
  find_a_port (~> 1.0.1)
28
26
  json
27
+ pact-mock_service (~> 0.7)
28
+ pact-support (~> 0.5)
29
29
  rack-test (~> 0.6.2)
30
30
  randexp (~> 0.1.7)
31
- rspec (~> 2.12)
32
- thin
31
+ rspec (>= 2.14)
32
+ term-ansicolor (~> 1.0)
33
33
  thor
34
34
  webrick
35
- pry (0.9.12.2)
36
- coderay (~> 1.0.5)
37
- method_source (~> 0.8)
35
+ pact-mock_service (0.7.2)
36
+ find_a_port (~> 1.0.1)
37
+ json
38
+ pact-support (~> 0.5.3)
39
+ rack
40
+ rack-test (~> 0.6.2)
41
+ rspec (>= 2.14)
42
+ term-ansicolor (~> 1.0)
43
+ thor
44
+ webrick
45
+ pact-support (0.5.3)
46
+ awesome_print (~> 1.1)
47
+ find_a_port (~> 1.0.1)
48
+ json
49
+ rack-test (~> 0.6.2)
50
+ randexp (~> 0.1.7)
51
+ rspec (>= 2.14)
52
+ term-ansicolor (~> 1.0)
53
+ thor
54
+ pry (0.10.1)
55
+ coderay (~> 1.1.0)
56
+ method_source (~> 0.8.1)
38
57
  slop (~> 3.4)
39
- rack (1.5.2)
40
- rack-test (0.6.2)
58
+ rack (1.6.4)
59
+ rack-test (0.6.3)
41
60
  rack (>= 1.0)
42
61
  rake (10.0.4)
43
62
  randexp (0.1.7)
44
- rspec (2.14.1)
45
- rspec-core (~> 2.14.0)
46
- rspec-expectations (~> 2.14.0)
47
- rspec-mocks (~> 2.14.0)
48
- rspec-core (2.14.7)
49
- rspec-expectations (2.14.4)
50
- diff-lcs (>= 1.1.3, < 2.0)
51
- rspec-fire (1.2.0)
52
- rspec (~> 2.11)
53
- rspec-mocks (2.14.4)
54
- slop (3.4.6)
55
- thin (1.6.1)
56
- daemons (>= 1.0.9)
57
- eventmachine (>= 1.0.0)
58
- rack (>= 1.0.0)
59
- thor (0.18.1)
63
+ rspec (3.1.0)
64
+ rspec-core (~> 3.1.0)
65
+ rspec-expectations (~> 3.1.0)
66
+ rspec-mocks (~> 3.1.0)
67
+ rspec-core (3.1.7)
68
+ rspec-support (~> 3.1.0)
69
+ rspec-expectations (3.1.2)
70
+ diff-lcs (>= 1.2.0, < 2.0)
71
+ rspec-support (~> 3.1.0)
72
+ rspec-fire (1.3.0)
73
+ rspec (>= 2.11, < 4)
74
+ rspec-mocks (3.1.3)
75
+ rspec-support (~> 3.1.0)
76
+ rspec-support (3.1.2)
77
+ slop (3.6.0)
78
+ term-ansicolor (1.3.2)
79
+ tins (~> 1.0)
80
+ thor (0.19.1)
81
+ tins (1.6.0)
60
82
  webrick (1.3.1)
61
83
 
62
84
  PLATFORMS
@@ -68,3 +90,6 @@ DEPENDENCIES
68
90
  pry
69
91
  rake (~> 10.0.3)
70
92
  rspec-fire
93
+
94
+ BUNDLED WITH
95
+ 1.10.6
data/README.md CHANGED
@@ -1,3 +1,50 @@
1
1
  # Pact Broker Client
2
2
 
3
3
  A client for the Pact Broker. Publishes pacts to, and retrieves pacts from, the pact broker.
4
+
5
+ ## Usage
6
+
7
+ You will need an instance of a [Pact Broker](https://github.com/bethesque/pact_broker). It's URL will be used below in the configuration for the Consumer and the Provider. eg. http://pact-broker.my.org
8
+
9
+ ### Consumer
10
+
11
+ ```ruby
12
+ # In Gemfile
13
+
14
+ gem "pact_broker-client"
15
+ ```
16
+
17
+ ```ruby
18
+ # In Rakefile
19
+
20
+ require 'pact_broker/client/tasks'
21
+
22
+ PactBroker::Client::PublicationTask.new do | task |
23
+ require 'my_consumer/version'
24
+ task.consumer_version = MyConsumer::VERSION
25
+ task.pact_broker_base_url = "http://pact-broker.my.org"
26
+ task.pact_broker_basic_auth = { username: 'basic_auth_user', password: 'basic_auth_pass'} #optional
27
+ end
28
+ ```
29
+
30
+ ```bash
31
+ # In CI script
32
+
33
+ rake pact:publish
34
+ ```
35
+
36
+ ### Provider
37
+
38
+ ```ruby
39
+ # In spec/service_consumers/pact_helper.rb
40
+
41
+ require 'pact/provider/rspec'
42
+
43
+ Pact.service_provider "My Provider" do
44
+
45
+ honours_pact_with "My Consumer" do
46
+ pact_uri URI.encode("http://pact-broker.my.org/pact/provider/My Provider/consumer/My Consumer/latest")
47
+ end
48
+
49
+ end
50
+ ```
@@ -0,0 +1,582 @@
1
+ ### A pact between Pact Broker Client and Pact Broker
2
+
3
+ #### Requests from Pact Broker Client to Pact Broker
4
+
5
+ * [A request for the latest version](#a_request_for_the_latest_version_given_no_version_exists_for_the_Pricing_Service) given no version exists for the Pricing Service
6
+
7
+ * [A request for the latest version tagged with 'prod'](#a_request_for_the_latest_version_tagged_with_'prod'_given_a_version_with_production_details_exists_for_the_Pricing_Service) given a version with production details exists for the Pricing Service
8
+
9
+ * [A request retrieve a pact for a specific version](#a_request_retrieve_a_pact_for_a_specific_version_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0) given the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0
10
+
11
+ * [A request to get the Pricing Service](#a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
12
+
13
+ * [A request to get the Pricing Service](#a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker) given the 'Pricing Service' does not exist in the pact-broker
14
+
15
+ * [A request to list pacticipants](#a_request_to_list_pacticipants_given_'Condor'_exists_in_the_pact-broker) given 'Condor' exists in the pact-broker
16
+
17
+ * [A request to list the latest pacts](#a_request_to_list_the_latest_pacts_given_a_pact_between_Condor_and_the_Pricing_Service_exists) given a pact between Condor and the Pricing Service exists
18
+
19
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0) given the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0
20
+
21
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_'Condor'_already_exist_in_the_pact-broker,_but_the_'Pricing_Service'_does_not) given 'Condor' already exist in the pact-broker, but the 'Pricing Service' does not
22
+
23
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
24
+
25
+ * [A request to publish a pact](#a_request_to_publish_a_pact_given_an_error_occurs_while_publishing_a_pact) given an error occurs while publishing a pact
26
+
27
+ * [A request to register the repository URL of a pacticipant](#a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
28
+
29
+ * [A request to register the repository URL of a pacticipant](#a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker) given the 'Pricing Service' does not exist in the pact-broker
30
+
31
+ * [A request to retrieve the latest pact between Condor and the Pricing Service](#a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists) given a pact between Condor and the Pricing Service exists
32
+
33
+ * [A request to retrieve the latest pact between Condor and the Pricing Service](#a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_no_pact_between_Condor_and_the_Pricing_Service_exists) given no pact between Condor and the Pricing Service exists
34
+
35
+ * [A request to retrieve the pact between the production verison of Condor and the Pricing Service](#a_request_to_retrieve_the_pact_between_the_production_verison_of_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists_for_the_production_version_of_Condor) given a pact between Condor and the Pricing Service exists for the production version of Condor
36
+
37
+ * [A request to tag the production version of Condor](#a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker_with_version_1.3.0,_tagged_with_'prod') given 'Condor' exists in the pact-broker with version 1.3.0, tagged with 'prod'
38
+
39
+ * [A request to tag the production version of Condor](#a_request_to_tag_the_production_version_of_Condor_given_'Condor'_does_not_exist_in_the_pact-broker) given 'Condor' does not exist in the pact-broker
40
+
41
+ * [A request to tag the production version of Condor](#a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker) given 'Condor' exists in the pact-broker
42
+
43
+ #### Interactions
44
+
45
+ <a name="a_request_for_the_latest_version_given_no_version_exists_for_the_Pricing_Service"></a>
46
+ Given **no version exists for the Pricing Service**, upon receiving **a request for the latest version** from Pact Broker Client, with
47
+ ```json
48
+ {
49
+ "method": "get",
50
+ "path": "/pacticipants/Pricing%20Service/versions/latest",
51
+ "headers": {
52
+ "Accept": "application/json"
53
+ }
54
+ }
55
+ ```
56
+ Pact Broker will respond with:
57
+ ```json
58
+ {
59
+ "status": 404
60
+ }
61
+ ```
62
+ <a name="a_request_for_the_latest_version_tagged_with_'prod'_given_a_version_with_production_details_exists_for_the_Pricing_Service"></a>
63
+ Given **a version with production details exists for the Pricing Service**, upon receiving **a request for the latest version tagged with 'prod'** from Pact Broker Client, with
64
+ ```json
65
+ {
66
+ "method": "get",
67
+ "path": "/pacticipants/Pricing%20Service/versions/latest",
68
+ "query": "tag=prod",
69
+ "headers": {
70
+ "Accept": "application/json"
71
+ }
72
+ }
73
+ ```
74
+ Pact Broker will respond with:
75
+ ```json
76
+ {
77
+ "status": 200,
78
+ "headers": {
79
+ "Content-Type": "application/json"
80
+ },
81
+ "body": {
82
+ "number": "1.2.3",
83
+ "repository_ref": "package/pricing-service-1.2.3",
84
+ "tags": [
85
+ "prod"
86
+ ]
87
+ }
88
+ }
89
+ ```
90
+ <a name="a_request_retrieve_a_pact_for_a_specific_version_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0"></a>
91
+ Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0**, upon receiving **a request retrieve a pact for a specific version** from Pact Broker Client, with
92
+ ```json
93
+ {
94
+ "method": "get",
95
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0"
96
+ }
97
+ ```
98
+ Pact Broker will respond with:
99
+ ```json
100
+ {
101
+ "status": 200,
102
+ "body": {
103
+ "consumer": {
104
+ "name": "Condor"
105
+ },
106
+ "provider": {
107
+ "name": "Pricing Service"
108
+ },
109
+ "interactions": [
110
+
111
+ ]
112
+ }
113
+ }
114
+ ```
115
+ <a name="a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
116
+ Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to get the Pricing Service** from Pact Broker Client, with
117
+ ```json
118
+ {
119
+ "method": "get",
120
+ "path": "/pacticipants/Pricing%20Service"
121
+ }
122
+ ```
123
+ Pact Broker will respond with:
124
+ ```json
125
+ {
126
+ "status": 200,
127
+ "headers": {
128
+ "Content-Type": "application/hal+json"
129
+ },
130
+ "body": {
131
+ "_links": {
132
+ "self": {
133
+ "href": "http://example.org/pacticipants/Pricing%20Service"
134
+ },
135
+ "versions": {
136
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions"
137
+ },
138
+ "latest_version": {
139
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions/latest"
140
+ }
141
+ },
142
+ "name": "Pricing Service",
143
+ "repository_url": "git@git.realestate.com.au:business-systems/pricing-service",
144
+ "_embedded": {
145
+ "latest_version": {
146
+ "_links": {
147
+ "self": {
148
+ "href": "http://example.org/pacticipants/Pricing%20Service/versions/1.3.0"
149
+ }
150
+ },
151
+ "number": "1.3.0"
152
+ }
153
+ }
154
+ }
155
+ }
156
+ ```
157
+ <a name="a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker"></a>
158
+ Given **the 'Pricing Service' does not exist in the pact-broker**, upon receiving **a request to get the Pricing Service** from Pact Broker Client, with
159
+ ```json
160
+ {
161
+ "method": "get",
162
+ "path": "/pacticipants/Pricing%20Service"
163
+ }
164
+ ```
165
+ Pact Broker will respond with:
166
+ ```json
167
+ {
168
+ "status": 404
169
+ }
170
+ ```
171
+ <a name="a_request_to_list_pacticipants_given_'Condor'_exists_in_the_pact-broker"></a>
172
+ Given **'Condor' exists in the pact-broker**, upon receiving **a request to list pacticipants** from Pact Broker Client, with
173
+ ```json
174
+ {
175
+ "method": "get",
176
+ "path": "/pacticipants"
177
+ }
178
+ ```
179
+ Pact Broker will respond with:
180
+ ```json
181
+ {
182
+ "status": 200,
183
+ "headers": {
184
+ "Content-Type": "application/hal+json"
185
+ },
186
+ "body": {
187
+ "_links": {
188
+ "self": {
189
+ "href": "http://example.org/pacticipants"
190
+ },
191
+ "pacticipants": [
192
+ {
193
+ "href": "http://example.org/pacticipants/Condor",
194
+ "title": "Condor"
195
+ }
196
+ ]
197
+ },
198
+ "pacticipants": [
199
+ {
200
+ "_links": {
201
+ "self": {
202
+ "href": "http://example.org/pacticipants/Condor"
203
+ }
204
+ },
205
+ "name": "Condor",
206
+ "_embedded": {
207
+ "latest_version": {
208
+ "_links": {
209
+ "self": {
210
+ "href": "http://example.org/pacticipants/Condor/versions/1.3.0"
211
+ }
212
+ },
213
+ "number": "1.3.0"
214
+ }
215
+ }
216
+ }
217
+ ]
218
+ }
219
+ }
220
+ ```
221
+ <a name="a_request_to_list_the_latest_pacts_given_a_pact_between_Condor_and_the_Pricing_Service_exists"></a>
222
+ Given **a pact between Condor and the Pricing Service exists**, upon receiving **a request to list the latest pacts** from Pact Broker Client, with
223
+ ```json
224
+ {
225
+ "method": "get",
226
+ "path": "/pacts/latest"
227
+ }
228
+ ```
229
+ Pact Broker will respond with:
230
+ ```json
231
+ {
232
+ "status": 200,
233
+ "headers": {
234
+ "Content-Type": "application/hal+json"
235
+ },
236
+ "body": {
237
+ "_links": {
238
+ "self": {
239
+ "href": "http://example.org/pacts/latest"
240
+ }
241
+ },
242
+ "pacts": [
243
+ {
244
+ "_links": {
245
+ "self": [
246
+ {
247
+ "href": "http://example.org/pact/provider/Pricing%20Service/consumer/Condor/latest"
248
+ },
249
+ {
250
+ "href": "http://example.org/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0"
251
+ }
252
+ ]
253
+ },
254
+ "_embedded": {
255
+ "consumer": {
256
+ "name": "Condor",
257
+ "_links": {
258
+ "self": {
259
+ "href": "http://example.org/pacticipants/Condor"
260
+ }
261
+ },
262
+ "_embedded": {
263
+ "version": {
264
+ "number": "1.3.0"
265
+ }
266
+ }
267
+ },
268
+ "provider": {
269
+ "_links": {
270
+ "self": {
271
+ "href": "http://example.org/pacticipants/Pricing%20Service"
272
+ }
273
+ },
274
+ "name": "Pricing Service"
275
+ }
276
+ }
277
+ }
278
+ ]
279
+ }
280
+ }
281
+ ```
282
+ <a name="a_request_to_publish_a_pact_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0"></a>
283
+ Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0**, upon receiving **a request to publish a pact** from Pact Broker Client, with
284
+ ```json
285
+ {
286
+ "method": "put",
287
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
288
+ "headers": {
289
+ "Content-Type": "application/json"
290
+ },
291
+ "body": {
292
+ "consumer": {
293
+ "name": "Condor"
294
+ },
295
+ "provider": {
296
+ "name": "Pricing Service"
297
+ },
298
+ "interactions": [
299
+
300
+ ]
301
+ }
302
+ }
303
+ ```
304
+ Pact Broker will respond with:
305
+ ```json
306
+ {
307
+ "status": 200
308
+ }
309
+ ```
310
+ <a name="a_request_to_publish_a_pact_given_'Condor'_already_exist_in_the_pact-broker,_but_the_'Pricing_Service'_does_not"></a>
311
+ Given **'Condor' already exist in the pact-broker, but the 'Pricing Service' does not**, upon receiving **a request to publish a pact** from Pact Broker Client, with
312
+ ```json
313
+ {
314
+ "method": "put",
315
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
316
+ "headers": {
317
+ "Content-Type": "application/json"
318
+ },
319
+ "body": {
320
+ "consumer": {
321
+ "name": "Condor"
322
+ },
323
+ "provider": {
324
+ "name": "Pricing Service"
325
+ },
326
+ "interactions": [
327
+
328
+ ]
329
+ }
330
+ }
331
+ ```
332
+ Pact Broker will respond with:
333
+ ```json
334
+ {
335
+ "status": 201
336
+ }
337
+ ```
338
+ <a name="a_request_to_publish_a_pact_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
339
+ Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to publish a pact** from Pact Broker Client, with
340
+ ```json
341
+ {
342
+ "method": "put",
343
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
344
+ "headers": {
345
+ "Content-Type": "application/json"
346
+ },
347
+ "body": {
348
+ "consumer": {
349
+ "name": "Condor"
350
+ },
351
+ "provider": {
352
+ "name": "Pricing Service"
353
+ },
354
+ "interactions": [
355
+
356
+ ]
357
+ }
358
+ }
359
+ ```
360
+ Pact Broker will respond with:
361
+ ```json
362
+ {
363
+ "status": 201
364
+ }
365
+ ```
366
+ <a name="a_request_to_publish_a_pact_given_an_error_occurs_while_publishing_a_pact"></a>
367
+ Given **an error occurs while publishing a pact**, upon receiving **a request to publish a pact** from Pact Broker Client, with
368
+ ```json
369
+ {
370
+ "method": "put",
371
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
372
+ "headers": {
373
+ "Content-Type": "application/json"
374
+ },
375
+ "body": {
376
+ "consumer": {
377
+ "name": "Condor"
378
+ },
379
+ "provider": {
380
+ "name": "Pricing Service"
381
+ },
382
+ "interactions": [
383
+
384
+ ]
385
+ }
386
+ }
387
+ ```
388
+ Pact Broker will respond with:
389
+ ```json
390
+ {
391
+ "status": 500,
392
+ "headers": {
393
+ "Content-Type": "application/json"
394
+ },
395
+ "body": {
396
+ "message": "An error occurred"
397
+ }
398
+ }
399
+ ```
400
+ <a name="a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
401
+ Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to register the repository URL of a pacticipant** from Pact Broker Client, with
402
+ ```json
403
+ {
404
+ "method": "patch",
405
+ "path": "/pacticipants/Pricing%20Service",
406
+ "headers": {
407
+ "Content-Type": "application/json"
408
+ },
409
+ "body": {
410
+ "repository_url": "git@git.realestate.com.au:business-systems/pricing-service"
411
+ }
412
+ }
413
+ ```
414
+ Pact Broker will respond with:
415
+ ```json
416
+ {
417
+ "status": 200
418
+ }
419
+ ```
420
+ <a name="a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker"></a>
421
+ Given **the 'Pricing Service' does not exist in the pact-broker**, upon receiving **a request to register the repository URL of a pacticipant** from Pact Broker Client, with
422
+ ```json
423
+ {
424
+ "method": "patch",
425
+ "path": "/pacticipants/Pricing%20Service",
426
+ "headers": {
427
+ "Content-Type": "application/json"
428
+ },
429
+ "body": {
430
+ "repository_url": "git@git.realestate.com.au:business-systems/pricing-service"
431
+ }
432
+ }
433
+ ```
434
+ Pact Broker will respond with:
435
+ ```json
436
+ {
437
+ "status": 201
438
+ }
439
+ ```
440
+ <a name="a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists"></a>
441
+ Given **a pact between Condor and the Pricing Service exists**, upon receiving **a request to retrieve the latest pact between Condor and the Pricing Service** from Pact Broker Client, with
442
+ ```json
443
+ {
444
+ "method": "get",
445
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/latest"
446
+ }
447
+ ```
448
+ Pact Broker will respond with:
449
+ ```json
450
+ {
451
+ "status": 200,
452
+ "headers": {
453
+ "Content-Type": "application/json",
454
+ "X-Pact-Consumer-Version": "1.3.0"
455
+ },
456
+ "body": {
457
+ "consumer": {
458
+ "name": "Condor"
459
+ },
460
+ "provider": {
461
+ "name": "Pricing Service"
462
+ },
463
+ "interactions": [
464
+
465
+ ]
466
+ }
467
+ }
468
+ ```
469
+ <a name="a_request_to_retrieve_the_latest_pact_between_Condor_and_the_Pricing_Service_given_no_pact_between_Condor_and_the_Pricing_Service_exists"></a>
470
+ Given **no pact between Condor and the Pricing Service exists**, upon receiving **a request to retrieve the latest pact between Condor and the Pricing Service** from Pact Broker Client, with
471
+ ```json
472
+ {
473
+ "method": "get",
474
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/latest"
475
+ }
476
+ ```
477
+ Pact Broker will respond with:
478
+ ```json
479
+ {
480
+ "status": 404
481
+ }
482
+ ```
483
+ <a name="a_request_to_retrieve_the_pact_between_the_production_verison_of_Condor_and_the_Pricing_Service_given_a_pact_between_Condor_and_the_Pricing_Service_exists_for_the_production_version_of_Condor"></a>
484
+ Given **a pact between Condor and the Pricing Service exists for the production version of Condor**, upon receiving **a request to retrieve the pact between the production verison of Condor and the Pricing Service** from Pact Broker Client, with
485
+ ```json
486
+ {
487
+ "method": "get",
488
+ "path": "/pact/provider/Pricing%20Service/consumer/Condor/latest/prod",
489
+ "headers": {
490
+ "Accept": "application/json"
491
+ }
492
+ }
493
+ ```
494
+ Pact Broker will respond with:
495
+ ```json
496
+ {
497
+ "status": 200,
498
+ "body": {
499
+ "consumer": {
500
+ "name": "Condor"
501
+ },
502
+ "provider": {
503
+ "name": "Pricing Service"
504
+ },
505
+ "interactions": [
506
+
507
+ ]
508
+ }
509
+ }
510
+ ```
511
+ <a name="a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker_with_version_1.3.0,_tagged_with_'prod'"></a>
512
+ Given **'Condor' exists in the pact-broker with version 1.3.0, tagged with 'prod'**, upon receiving **a request to tag the production version of Condor** from Pact Broker Client, with
513
+ ```json
514
+ {
515
+ "method": "put",
516
+ "path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
517
+ "headers": {
518
+ "Content-Type": "application/json"
519
+ }
520
+ }
521
+ ```
522
+ Pact Broker will respond with:
523
+ ```json
524
+ {
525
+ "status": 200,
526
+ "body": {
527
+ "_links": {
528
+ "self": {
529
+ "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/tags/prod"
530
+ }
531
+ }
532
+ }
533
+ }
534
+ ```
535
+ <a name="a_request_to_tag_the_production_version_of_Condor_given_'Condor'_does_not_exist_in_the_pact-broker"></a>
536
+ Given **'Condor' does not exist in the pact-broker**, upon receiving **a request to tag the production version of Condor** from Pact Broker Client, with
537
+ ```json
538
+ {
539
+ "method": "put",
540
+ "path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
541
+ "headers": {
542
+ "Content-Type": "application/json"
543
+ }
544
+ }
545
+ ```
546
+ Pact Broker will respond with:
547
+ ```json
548
+ {
549
+ "status": 201,
550
+ "body": {
551
+ "_links": {
552
+ "self": {
553
+ "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/tags/prod"
554
+ }
555
+ }
556
+ }
557
+ }
558
+ ```
559
+ <a name="a_request_to_tag_the_production_version_of_Condor_given_'Condor'_exists_in_the_pact-broker"></a>
560
+ Given **'Condor' exists in the pact-broker**, upon receiving **a request to tag the production version of Condor** from Pact Broker Client, with
561
+ ```json
562
+ {
563
+ "method": "put",
564
+ "path": "/pacticipants/Condor/versions/1.3.0/tags/prod",
565
+ "headers": {
566
+ "Content-Type": "application/json"
567
+ }
568
+ }
569
+ ```
570
+ Pact Broker will respond with:
571
+ ```json
572
+ {
573
+ "status": 201,
574
+ "body": {
575
+ "_links": {
576
+ "self": {
577
+ "href": "http://localhost:1234/pacticipants/Condor/versions/1.3.0/tags/prod"
578
+ }
579
+ }
580
+ }
581
+ }
582
+ ```