pact_broker-client 1.14.1 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +21 -0
- data/README.md +27 -1
- data/Rakefile +9 -0
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +521 -10
- data/lib/pact_broker/client/base_client.rb +1 -1
- data/lib/pact_broker/client/cli/broker.rb +63 -0
- data/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt +1 -1
- data/lib/pact_broker/client/cli/create_webhook_long_desc.txt +1 -0
- data/lib/pact_broker/client/command_result.rb +12 -0
- data/lib/pact_broker/client/hal.rb +4 -0
- data/lib/pact_broker/client/hal/entity.rb +78 -0
- data/lib/pact_broker/client/hal/entry_point.rb +13 -0
- data/lib/pact_broker/client/hal/http_client.rb +82 -0
- data/lib/pact_broker/client/hal/link.rb +79 -0
- data/lib/pact_broker/client/pacts.rb +7 -1
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions.rb +0 -1
- data/lib/pact_broker/client/webhooks/create.rb +114 -0
- data/spec/integration/can_i_deploy_spec.rb +1 -3
- data/spec/integration/create_version_tag_spec.rb +1 -3
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +1 -1
- data/spec/lib/pact_broker/client/cli/broker_create_webhook_spec.rb +190 -0
- data/spec/lib/pact_broker/client/hal/entity_spec.rb +93 -0
- data/spec/lib/pact_broker/client/hal/http_client_spec.rb +105 -0
- data/spec/lib/pact_broker/client/hal/link_spec.rb +108 -0
- data/spec/lib/pact_broker/client/webhooks/create_spec.rb +61 -0
- data/spec/pacts/pact_broker_client-pact_broker.json +499 -9
- data/spec/service_providers/pact_broker_client_publish_spec.rb +6 -1
- data/spec/service_providers/pact_broker_client_retrieve_all_pacts_for_provider_spec.rb +1 -1
- data/spec/service_providers/{pact_broker_client_retrive_pact_spec.rb → pact_broker_client_retrieve_pact_spec.rb} +2 -3
- data/spec/service_providers/pact_broker_client_versions_spec.rb +1 -1
- data/spec/service_providers/pact_helper.rb +46 -0
- data/spec/service_providers/webhooks_create_spec.rb +255 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/support/latest_pacts_for_provider.json +1 -1
- data/spec/support/shared_context.rb +6 -3
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4728263e0450411e62b5e4a8b4f2f1b0355e6485
|
4
|
+
data.tar.gz: 0ba8a17822c1e6d7bd146d807c37664f4acca01e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9590d446cb7d337fb86992fa88c7443e390835050f982be534ba9a1c450b9025ca7afacc6a9d1b0cfa4b416f39119a96084179ba966a987d097c44b04345fb3
|
7
|
+
data.tar.gz: 157507bc90bddc1109aa1f75beb51c8ac81cc3b9bb5a3d464c23f4c00ee45ed3b98b6d2dbc2c5b4a02c00d120b7d0bc922e740f23f70341a6dc65c17683ebe27
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
<a name="v1.15.0"></a>
|
2
|
+
### v1.15.0 (2018-06-22)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* allow webhooks with optional consumer and provider to be created using the create-webhooks CLI ([c6763b0](/../../commit/c6763b0))
|
8
|
+
* update expectation of error response ([d45244f](/../../commit/d45244f))
|
9
|
+
* add create-webhook to CLI ([e1ec885](/../../commit/e1ec885))
|
10
|
+
* add title, name and title_or_name methods to Link ([dc24caa](/../../commit/dc24caa))
|
11
|
+
* add http debug logging for create environment call ([5f31fcb](/../../commit/5f31fcb))
|
12
|
+
* add hal client ([4d93bf9](/../../commit/4d93bf9))
|
13
|
+
* update pacts relation name in retrieve pacts query ([7d965bf](/../../commit/7d965bf))
|
14
|
+
|
15
|
+
|
16
|
+
#### Bug Fixes
|
17
|
+
|
18
|
+
* correctly escape expanded URL links ([d6dbce8](/../../commit/d6dbce8))
|
19
|
+
* correct accept headers for requests to the pact broker ([415d9d5](/../../commit/415d9d5))
|
20
|
+
|
21
|
+
|
1
22
|
<a name="v1.14.1"></a>
|
2
23
|
### v1.14.1 (2018-04-11)
|
3
24
|
|
data/README.md
CHANGED
@@ -77,7 +77,7 @@ Options:
|
|
77
77
|
Description:
|
78
78
|
Returns exit code 0 or 1, indicating whether or not the specified pacticipant versions are compatible. Prints out the relevant pact/verification details.
|
79
79
|
|
80
|
-
The environment variables
|
80
|
+
The environment variables PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD may be used instead of their respective command line options.
|
81
81
|
|
82
82
|
SCENARIOS
|
83
83
|
|
@@ -123,6 +123,32 @@ Description:
|
|
123
123
|
|
124
124
|
```
|
125
125
|
|
126
|
+
### create-webhook
|
127
|
+
|
128
|
+
```
|
129
|
+
Usage:
|
130
|
+
pact-broker create-webhook URL --consumer=CONSUMER --provider=PROVIDER -X, --request=REQUEST -b, --broker-base-url=BROKER_BASE_URL
|
131
|
+
|
132
|
+
Options:
|
133
|
+
-X, --request=REQUEST # HTTP method
|
134
|
+
-H, [--header=one two three] # Header
|
135
|
+
-d, [--data=DATA] # Data
|
136
|
+
-u, [--user=USER] # Basic auth username and password eg. username:password
|
137
|
+
--consumer=CONSUMER # Consumer name
|
138
|
+
--provider=PROVIDER # Provider name
|
139
|
+
-b, --broker-base-url=BROKER_BASE_URL # The base URL of the Pact Broker
|
140
|
+
-u, [--broker-username=BROKER_USERNAME] # Pact Broker basic auth username
|
141
|
+
-p, [--broker-password=BROKER_PASSWORD] # Pact Broker basic auth password
|
142
|
+
[--contract-content-changed], [--no-contract-content-changed] # Trigger this webhook when the pact content changes
|
143
|
+
[--provider-verification-published], [--no-provider-verification-published] # Trigger this webhook when a provider verification result is published
|
144
|
+
-v, [--verbose], [--no-verbose] # Verbose output. Default: false
|
145
|
+
|
146
|
+
Description:
|
147
|
+
Create a curl command that executes the request that you want your webhook to execute, then replace "curl" with "pact-broker
|
148
|
+
create-webhook" and add the consumer, provider, event types and broker details. Note that the URL must be the first parameter
|
149
|
+
when executing create-webhook.
|
150
|
+
```
|
151
|
+
|
126
152
|
## Usage - Ruby
|
127
153
|
|
128
154
|
### Consumer
|
data/Rakefile
CHANGED
@@ -23,3 +23,12 @@ task :generate_changelog do
|
|
23
23
|
require 'pact_broker/client/version'
|
24
24
|
ConventionalChangelog::Generator.new.generate! version: "v#{PactBroker::Client::VERSION}"
|
25
25
|
end
|
26
|
+
|
27
|
+
desc 'List provider states'
|
28
|
+
task 'pact:list_provider_states' do
|
29
|
+
require 'json'
|
30
|
+
puts Dir.glob("spec/pacts/**.json").collect { | pact_file |
|
31
|
+
puts pact_file
|
32
|
+
JSON.parse(File.read(pact_file))['interactions'].collect{ | interaction| interaction['providerState'] }
|
33
|
+
}.flatten.compact.sort.uniq
|
34
|
+
end
|
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
* [A request for the compatibility matrix where only the version of Foo is specified](#a_request_for_the_compatibility_matrix_where_only_the_version_of_Foo_is_specified_given_the_pact_for_Foo_version_1.2.3_has_been_verified_by_Bar_version_4.5.6_and_version_5.6.7) given the pact for Foo version 1.2.3 has been verified by Bar version 4.5.6 and version 5.6.7
|
22
22
|
|
23
|
+
* [A request for the index resource](#a_request_for_the_index_resource)
|
24
|
+
|
23
25
|
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pb:latest-tagged-version_relation_exists_in_the_index_resource) given the pb:latest-tagged-version relation exists in the index resource
|
24
26
|
|
25
27
|
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pb:latest-version_relation_exists_in_the_index_resource) given the pb:latest-version relation exists in the index resource
|
@@ -32,6 +34,20 @@
|
|
32
34
|
|
33
35
|
* [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
|
34
36
|
|
37
|
+
* [A request to create a global webhook with a JSON body](#a_request_to_create_a_global_webhook_with_a_JSON_body)
|
38
|
+
|
39
|
+
* [A request to create a webhook for a consumer and provider](#a_request_to_create_a_webhook_for_a_consumer_and_provider_given_'Condor'_does_not_exist_in_the_pact-broker) given 'Condor' does not exist in the pact-broker
|
40
|
+
|
41
|
+
* [A request to create a webhook with a JSON body for a consumer](#a_request_to_create_a_webhook_with_a_JSON_body_for_a_consumer_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker) given the 'Pricing Service' and 'Condor' already exist in the pact-broker
|
42
|
+
|
43
|
+
* [A request to create a webhook with a JSON body for a consumer and provider](#a_request_to_create_a_webhook_with_a_JSON_body_for_a_consumer_and_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker) given the 'Pricing Service' and 'Condor' already exist in the pact-broker
|
44
|
+
|
45
|
+
* [A request to create a webhook with a JSON body for a consumer that does not exist](#a_request_to_create_a_webhook_with_a_JSON_body_for_a_consumer_that_does_not_exist)
|
46
|
+
|
47
|
+
* [A request to create a webhook with a JSON body for a provider](#a_request_to_create_a_webhook_with_a_JSON_body_for_a_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker) given the 'Pricing Service' and 'Condor' already exist in the pact-broker
|
48
|
+
|
49
|
+
* [A request to create a webhook with a non-JSON body for a consumer and provider](#a_request_to_create_a_webhook_with_a_non-JSON_body_for_a_consumer_and_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker) given the 'Pricing Service' and 'Condor' already exist in the pact-broker
|
50
|
+
|
35
51
|
* [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
|
36
52
|
|
37
53
|
* [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
|
@@ -70,6 +86,8 @@
|
|
70
86
|
|
71
87
|
* [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
|
72
88
|
|
89
|
+
* [An invalid request to create a webhook for a consumer and provider](#an_invalid_request_to_create_a_webhook_for_a_consumer_and_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker) given the 'Pricing Service' and 'Condor' already exist in the pact-broker
|
90
|
+
|
73
91
|
#### Interactions
|
74
92
|
|
75
93
|
<a name="a_request_for_the_compatibility_matrix_for_a_pacticipant_that_does_not_exist"></a>
|
@@ -85,6 +103,9 @@ Pact Broker will respond with:
|
|
85
103
|
```json
|
86
104
|
{
|
87
105
|
"status": 400,
|
106
|
+
"headers": {
|
107
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
108
|
+
},
|
88
109
|
"body": {
|
89
110
|
"errors": [
|
90
111
|
"an error message"
|
@@ -105,6 +126,9 @@ Pact Broker will respond with:
|
|
105
126
|
```json
|
106
127
|
{
|
107
128
|
"status": 200,
|
129
|
+
"headers": {
|
130
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
131
|
+
},
|
108
132
|
"body": {
|
109
133
|
"matrix": [
|
110
134
|
{
|
@@ -166,6 +190,9 @@ Pact Broker will respond with:
|
|
166
190
|
```json
|
167
191
|
{
|
168
192
|
"status": 200,
|
193
|
+
"headers": {
|
194
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
195
|
+
},
|
169
196
|
"body": {
|
170
197
|
"summary": {
|
171
198
|
"deployable": true,
|
@@ -210,6 +237,9 @@ Pact Broker will respond with:
|
|
210
237
|
```json
|
211
238
|
{
|
212
239
|
"status": 200,
|
240
|
+
"headers": {
|
241
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
242
|
+
},
|
213
243
|
"body": {
|
214
244
|
"summary": {
|
215
245
|
"deployable": true,
|
@@ -254,6 +284,9 @@ Pact Broker will respond with:
|
|
254
284
|
```json
|
255
285
|
{
|
256
286
|
"status": 200,
|
287
|
+
"headers": {
|
288
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
289
|
+
},
|
257
290
|
"body": {
|
258
291
|
"summary": {
|
259
292
|
"deployable": true,
|
@@ -298,6 +331,9 @@ Pact Broker will respond with:
|
|
298
331
|
```json
|
299
332
|
{
|
300
333
|
"status": 200,
|
334
|
+
"headers": {
|
335
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
336
|
+
},
|
301
337
|
"body": {
|
302
338
|
"matrix": [
|
303
339
|
{
|
@@ -331,6 +367,9 @@ Pact Broker will respond with:
|
|
331
367
|
```json
|
332
368
|
{
|
333
369
|
"status": 200,
|
370
|
+
"headers": {
|
371
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
372
|
+
},
|
334
373
|
"body": {
|
335
374
|
"summary": {
|
336
375
|
"deployable": true,
|
@@ -375,6 +414,9 @@ Pact Broker will respond with:
|
|
375
414
|
```json
|
376
415
|
{
|
377
416
|
"status": 400,
|
417
|
+
"headers": {
|
418
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
419
|
+
},
|
378
420
|
"body": {
|
379
421
|
"errors": [
|
380
422
|
"an error message"
|
@@ -395,6 +437,9 @@ Pact Broker will respond with:
|
|
395
437
|
```json
|
396
438
|
{
|
397
439
|
"status": 200,
|
440
|
+
"headers": {
|
441
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
442
|
+
},
|
398
443
|
"body": {
|
399
444
|
"summary": {
|
400
445
|
"deployable": true,
|
@@ -426,6 +471,33 @@ Pact Broker will respond with:
|
|
426
471
|
}
|
427
472
|
}
|
428
473
|
```
|
474
|
+
<a name="a_request_for_the_index_resource"></a>
|
475
|
+
Upon receiving **a request for the index resource** from Pact Broker Client, with
|
476
|
+
```json
|
477
|
+
{
|
478
|
+
"method": "get",
|
479
|
+
"path": "/",
|
480
|
+
"headers": {
|
481
|
+
"Accept": "application/hal+json"
|
482
|
+
}
|
483
|
+
}
|
484
|
+
```
|
485
|
+
Pact Broker will respond with:
|
486
|
+
```json
|
487
|
+
{
|
488
|
+
"status": 200,
|
489
|
+
"headers": {
|
490
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
491
|
+
},
|
492
|
+
"body": {
|
493
|
+
"_links": {
|
494
|
+
"pb:webhooks": {
|
495
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-WEBHOOKS"
|
496
|
+
}
|
497
|
+
}
|
498
|
+
}
|
499
|
+
}
|
500
|
+
```
|
429
501
|
<a name="a_request_for_the_index_resource_given_the_pb:latest-tagged-version_relation_exists_in_the_index_resource"></a>
|
430
502
|
Given **the pb:latest-tagged-version relation exists in the index resource**, upon receiving **a request for the index resource** from Pact Broker Client, with
|
431
503
|
```json
|
@@ -433,7 +505,7 @@ Given **the pb:latest-tagged-version relation exists in the index resource**, up
|
|
433
505
|
"method": "get",
|
434
506
|
"path": "/",
|
435
507
|
"headers": {
|
436
|
-
"Accept": "application/json, application/
|
508
|
+
"Accept": "application/hal+json, application/json"
|
437
509
|
}
|
438
510
|
}
|
439
511
|
```
|
@@ -441,6 +513,9 @@ Pact Broker will respond with:
|
|
441
513
|
```json
|
442
514
|
{
|
443
515
|
"status": 200,
|
516
|
+
"headers": {
|
517
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
518
|
+
},
|
444
519
|
"body": {
|
445
520
|
"_links": {
|
446
521
|
"pb:latest-tagged-version": {
|
@@ -457,7 +532,7 @@ Given **the pb:latest-version relation exists in the index resource**, upon rece
|
|
457
532
|
"method": "get",
|
458
533
|
"path": "/",
|
459
534
|
"headers": {
|
460
|
-
"Accept": "application/json, application/
|
535
|
+
"Accept": "application/hal+json, application/json"
|
461
536
|
}
|
462
537
|
}
|
463
538
|
```
|
@@ -465,6 +540,9 @@ Pact Broker will respond with:
|
|
465
540
|
```json
|
466
541
|
{
|
467
542
|
"status": 200,
|
543
|
+
"headers": {
|
544
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
545
|
+
},
|
468
546
|
"body": {
|
469
547
|
"_links": {
|
470
548
|
"pb:latest-version": {
|
@@ -492,7 +570,7 @@ Pact Broker will respond with:
|
|
492
570
|
"href": "http://example.org/pacticipants/Pricing%20Service",
|
493
571
|
"title": "Pricing Service"
|
494
572
|
},
|
495
|
-
"pacts": [
|
573
|
+
"pb:pacts": [
|
496
574
|
{
|
497
575
|
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
|
498
576
|
"title": "Pact between Condor (v1.3.0) and Pricing Service",
|
@@ -521,7 +599,7 @@ Pact Broker will respond with:
|
|
521
599
|
"href": "http://example.org/pacticipants/Pricing%20Service",
|
522
600
|
"title": "Pricing Service"
|
523
601
|
},
|
524
|
-
"pacts": [
|
602
|
+
"pb:pacts": [
|
525
603
|
{
|
526
604
|
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
|
527
605
|
"title": "Pact between Condor (v1.3.0) and Pricing Service",
|
@@ -545,6 +623,9 @@ Pact Broker will respond with:
|
|
545
623
|
```json
|
546
624
|
{
|
547
625
|
"status": 200,
|
626
|
+
"headers": {
|
627
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
628
|
+
},
|
548
629
|
"body": {
|
549
630
|
"summary": {
|
550
631
|
"deployable": true,
|
@@ -588,6 +669,9 @@ Pact Broker will respond with:
|
|
588
669
|
```json
|
589
670
|
{
|
590
671
|
"status": 200,
|
672
|
+
"headers": {
|
673
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
674
|
+
},
|
591
675
|
"body": {
|
592
676
|
"consumer": {
|
593
677
|
"name": "Condor"
|
@@ -601,6 +685,347 @@ Pact Broker will respond with:
|
|
601
685
|
}
|
602
686
|
}
|
603
687
|
```
|
688
|
+
<a name="a_request_to_create_a_global_webhook_with_a_JSON_body"></a>
|
689
|
+
Upon receiving **a request to create a global webhook with a JSON body** from Pact Broker Client, with
|
690
|
+
```json
|
691
|
+
{
|
692
|
+
"method": "post",
|
693
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
694
|
+
"headers": {
|
695
|
+
"Content-Type": "application/json",
|
696
|
+
"Accept": "application/hal+json"
|
697
|
+
},
|
698
|
+
"body": {
|
699
|
+
"events": [
|
700
|
+
{
|
701
|
+
"name": "contract_content_changed"
|
702
|
+
}
|
703
|
+
],
|
704
|
+
"request": {
|
705
|
+
"url": "https://webhook",
|
706
|
+
"method": "POST",
|
707
|
+
"headers": {
|
708
|
+
"Foo": "bar",
|
709
|
+
"Bar": "foo"
|
710
|
+
},
|
711
|
+
"body": {
|
712
|
+
"some": "body"
|
713
|
+
},
|
714
|
+
"username": "username",
|
715
|
+
"password": "password"
|
716
|
+
}
|
717
|
+
}
|
718
|
+
}
|
719
|
+
```
|
720
|
+
Pact Broker will respond with:
|
721
|
+
```json
|
722
|
+
{
|
723
|
+
"status": 201,
|
724
|
+
"headers": {
|
725
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
726
|
+
},
|
727
|
+
"body": {
|
728
|
+
"_links": {
|
729
|
+
"self": {
|
730
|
+
"href": "http://localhost:1234/some-url",
|
731
|
+
"title": "A title"
|
732
|
+
}
|
733
|
+
}
|
734
|
+
}
|
735
|
+
}
|
736
|
+
```
|
737
|
+
<a name="a_request_to_create_a_webhook_for_a_consumer_and_provider_given_'Condor'_does_not_exist_in_the_pact-broker"></a>
|
738
|
+
Given **'Condor' does not exist in the pact-broker**, upon receiving **a request to create a webhook for a consumer and provider** from Pact Broker Client, with
|
739
|
+
```json
|
740
|
+
{
|
741
|
+
"method": "post",
|
742
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
743
|
+
"headers": {
|
744
|
+
"Content-Type": "application/json",
|
745
|
+
"Accept": "application/hal+json"
|
746
|
+
},
|
747
|
+
"body": {
|
748
|
+
"events": [
|
749
|
+
{
|
750
|
+
"name": "contract_content_changed"
|
751
|
+
}
|
752
|
+
],
|
753
|
+
"request": {
|
754
|
+
"url": "https://webhook",
|
755
|
+
"method": "POST",
|
756
|
+
"headers": {
|
757
|
+
"Foo": "bar",
|
758
|
+
"Bar": "foo"
|
759
|
+
},
|
760
|
+
"body": {
|
761
|
+
"some": "body"
|
762
|
+
},
|
763
|
+
"username": "username",
|
764
|
+
"password": "password"
|
765
|
+
}
|
766
|
+
}
|
767
|
+
}
|
768
|
+
```
|
769
|
+
Pact Broker will respond with:
|
770
|
+
```json
|
771
|
+
{
|
772
|
+
"status": 404,
|
773
|
+
"headers": {
|
774
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
775
|
+
}
|
776
|
+
}
|
777
|
+
```
|
778
|
+
<a name="a_request_to_create_a_webhook_with_a_JSON_body_for_a_consumer_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker"></a>
|
779
|
+
Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker**, upon receiving **a request to create a webhook with a JSON body for a consumer** from Pact Broker Client, with
|
780
|
+
```json
|
781
|
+
{
|
782
|
+
"method": "post",
|
783
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
784
|
+
"headers": {
|
785
|
+
"Content-Type": "application/json",
|
786
|
+
"Accept": "application/hal+json"
|
787
|
+
},
|
788
|
+
"body": {
|
789
|
+
"events": [
|
790
|
+
{
|
791
|
+
"name": "contract_content_changed"
|
792
|
+
}
|
793
|
+
],
|
794
|
+
"request": {
|
795
|
+
"url": "https://webhook",
|
796
|
+
"method": "POST",
|
797
|
+
"headers": {
|
798
|
+
"Foo": "bar",
|
799
|
+
"Bar": "foo"
|
800
|
+
},
|
801
|
+
"body": {
|
802
|
+
"some": "body"
|
803
|
+
},
|
804
|
+
"username": "username",
|
805
|
+
"password": "password"
|
806
|
+
},
|
807
|
+
"consumer": {
|
808
|
+
"name": "Condor"
|
809
|
+
}
|
810
|
+
}
|
811
|
+
}
|
812
|
+
```
|
813
|
+
Pact Broker will respond with:
|
814
|
+
```json
|
815
|
+
{
|
816
|
+
"status": 201,
|
817
|
+
"headers": {
|
818
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
819
|
+
},
|
820
|
+
"body": {
|
821
|
+
"_links": {
|
822
|
+
"self": {
|
823
|
+
"href": "http://localhost:1234/some-url",
|
824
|
+
"title": "A title"
|
825
|
+
}
|
826
|
+
}
|
827
|
+
}
|
828
|
+
}
|
829
|
+
```
|
830
|
+
<a name="a_request_to_create_a_webhook_with_a_JSON_body_for_a_consumer_and_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker"></a>
|
831
|
+
Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker**, upon receiving **a request to create a webhook with a JSON body for a consumer and provider** from Pact Broker Client, with
|
832
|
+
```json
|
833
|
+
{
|
834
|
+
"method": "post",
|
835
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
836
|
+
"headers": {
|
837
|
+
"Content-Type": "application/json",
|
838
|
+
"Accept": "application/hal+json"
|
839
|
+
},
|
840
|
+
"body": {
|
841
|
+
"events": [
|
842
|
+
{
|
843
|
+
"name": "contract_content_changed"
|
844
|
+
}
|
845
|
+
],
|
846
|
+
"request": {
|
847
|
+
"url": "https://webhook",
|
848
|
+
"method": "POST",
|
849
|
+
"headers": {
|
850
|
+
"Foo": "bar",
|
851
|
+
"Bar": "foo"
|
852
|
+
},
|
853
|
+
"body": {
|
854
|
+
"some": "body"
|
855
|
+
},
|
856
|
+
"username": "username",
|
857
|
+
"password": "password"
|
858
|
+
}
|
859
|
+
}
|
860
|
+
}
|
861
|
+
```
|
862
|
+
Pact Broker will respond with:
|
863
|
+
```json
|
864
|
+
{
|
865
|
+
"status": 201,
|
866
|
+
"headers": {
|
867
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
868
|
+
},
|
869
|
+
"body": {
|
870
|
+
"_links": {
|
871
|
+
"self": {
|
872
|
+
"href": "http://localhost:1234/some-url",
|
873
|
+
"title": "A title"
|
874
|
+
}
|
875
|
+
}
|
876
|
+
}
|
877
|
+
}
|
878
|
+
```
|
879
|
+
<a name="a_request_to_create_a_webhook_with_a_JSON_body_for_a_consumer_that_does_not_exist"></a>
|
880
|
+
Upon receiving **a request to create a webhook with a JSON body for a consumer that does not exist** from Pact Broker Client, with
|
881
|
+
```json
|
882
|
+
{
|
883
|
+
"method": "post",
|
884
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
885
|
+
"headers": {
|
886
|
+
"Content-Type": "application/json",
|
887
|
+
"Accept": "application/hal+json"
|
888
|
+
},
|
889
|
+
"body": {
|
890
|
+
"events": [
|
891
|
+
{
|
892
|
+
"name": "contract_content_changed"
|
893
|
+
}
|
894
|
+
],
|
895
|
+
"request": {
|
896
|
+
"url": "https://webhook",
|
897
|
+
"method": "POST",
|
898
|
+
"headers": {
|
899
|
+
"Foo": "bar",
|
900
|
+
"Bar": "foo"
|
901
|
+
},
|
902
|
+
"body": {
|
903
|
+
"some": "body"
|
904
|
+
},
|
905
|
+
"username": "username",
|
906
|
+
"password": "password"
|
907
|
+
},
|
908
|
+
"consumer": {
|
909
|
+
"name": "Condor"
|
910
|
+
}
|
911
|
+
}
|
912
|
+
}
|
913
|
+
```
|
914
|
+
Pact Broker will respond with:
|
915
|
+
```json
|
916
|
+
{
|
917
|
+
"status": 400,
|
918
|
+
"headers": {
|
919
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
920
|
+
},
|
921
|
+
"body": {
|
922
|
+
"errors": {
|
923
|
+
"consumer.name": [
|
924
|
+
"Some error"
|
925
|
+
]
|
926
|
+
}
|
927
|
+
}
|
928
|
+
}
|
929
|
+
```
|
930
|
+
<a name="a_request_to_create_a_webhook_with_a_JSON_body_for_a_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker"></a>
|
931
|
+
Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker**, upon receiving **a request to create a webhook with a JSON body for a provider** from Pact Broker Client, with
|
932
|
+
```json
|
933
|
+
{
|
934
|
+
"method": "post",
|
935
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
936
|
+
"headers": {
|
937
|
+
"Content-Type": "application/json",
|
938
|
+
"Accept": "application/hal+json"
|
939
|
+
},
|
940
|
+
"body": {
|
941
|
+
"events": [
|
942
|
+
{
|
943
|
+
"name": "contract_content_changed"
|
944
|
+
}
|
945
|
+
],
|
946
|
+
"request": {
|
947
|
+
"url": "https://webhook",
|
948
|
+
"method": "POST",
|
949
|
+
"headers": {
|
950
|
+
"Foo": "bar",
|
951
|
+
"Bar": "foo"
|
952
|
+
},
|
953
|
+
"body": {
|
954
|
+
"some": "body"
|
955
|
+
},
|
956
|
+
"username": "username",
|
957
|
+
"password": "password"
|
958
|
+
},
|
959
|
+
"provider": {
|
960
|
+
"name": "Pricing Service"
|
961
|
+
}
|
962
|
+
}
|
963
|
+
}
|
964
|
+
```
|
965
|
+
Pact Broker will respond with:
|
966
|
+
```json
|
967
|
+
{
|
968
|
+
"status": 201,
|
969
|
+
"headers": {
|
970
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
971
|
+
},
|
972
|
+
"body": {
|
973
|
+
"_links": {
|
974
|
+
"self": {
|
975
|
+
"href": "http://localhost:1234/some-url",
|
976
|
+
"title": "A title"
|
977
|
+
}
|
978
|
+
}
|
979
|
+
}
|
980
|
+
}
|
981
|
+
```
|
982
|
+
<a name="a_request_to_create_a_webhook_with_a_non-JSON_body_for_a_consumer_and_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker"></a>
|
983
|
+
Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker**, upon receiving **a request to create a webhook with a non-JSON body for a consumer and provider** from Pact Broker Client, with
|
984
|
+
```json
|
985
|
+
{
|
986
|
+
"method": "post",
|
987
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
988
|
+
"headers": {
|
989
|
+
"Content-Type": "application/json",
|
990
|
+
"Accept": "application/hal+json"
|
991
|
+
},
|
992
|
+
"body": {
|
993
|
+
"events": [
|
994
|
+
{
|
995
|
+
"name": "contract_content_changed"
|
996
|
+
}
|
997
|
+
],
|
998
|
+
"request": {
|
999
|
+
"url": "https://webhook",
|
1000
|
+
"method": "POST",
|
1001
|
+
"headers": {
|
1002
|
+
"Foo": "bar",
|
1003
|
+
"Bar": "foo"
|
1004
|
+
},
|
1005
|
+
"body": "<xml></xml>",
|
1006
|
+
"username": "username",
|
1007
|
+
"password": "password"
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
}
|
1011
|
+
```
|
1012
|
+
Pact Broker will respond with:
|
1013
|
+
```json
|
1014
|
+
{
|
1015
|
+
"status": 201,
|
1016
|
+
"headers": {
|
1017
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1018
|
+
},
|
1019
|
+
"body": {
|
1020
|
+
"_links": {
|
1021
|
+
"self": {
|
1022
|
+
"href": "http://localhost:1234/some-url",
|
1023
|
+
"title": "A title"
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
}
|
1028
|
+
```
|
604
1029
|
<a name="a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
|
605
1030
|
Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to get the Pricing Service** from Pact Broker Client, with
|
606
1031
|
```json
|
@@ -791,6 +1216,9 @@ Pact Broker will respond with:
|
|
791
1216
|
```json
|
792
1217
|
{
|
793
1218
|
"status": 201,
|
1219
|
+
"headers": {
|
1220
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1221
|
+
},
|
794
1222
|
"body": {
|
795
1223
|
"_links": {
|
796
1224
|
"pb:latest-pact-version": {
|
@@ -826,6 +1254,9 @@ Pact Broker will respond with:
|
|
826
1254
|
```json
|
827
1255
|
{
|
828
1256
|
"status": 201,
|
1257
|
+
"headers": {
|
1258
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1259
|
+
},
|
829
1260
|
"body": {
|
830
1261
|
"_links": {
|
831
1262
|
"pb:latest-pact-version": {
|
@@ -865,7 +1296,9 @@ Pact Broker will respond with:
|
|
865
1296
|
"Content-Type": "application/hal+json"
|
866
1297
|
},
|
867
1298
|
"body": {
|
868
|
-
"
|
1299
|
+
"error": {
|
1300
|
+
"message": "An error occurred"
|
1301
|
+
}
|
869
1302
|
}
|
870
1303
|
}
|
871
1304
|
```
|
@@ -895,6 +1328,9 @@ Pact Broker will respond with:
|
|
895
1328
|
```json
|
896
1329
|
{
|
897
1330
|
"status": 200,
|
1331
|
+
"headers": {
|
1332
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1333
|
+
},
|
898
1334
|
"body": {
|
899
1335
|
"_links": {
|
900
1336
|
"pb:latest-pact-version": {
|
@@ -930,6 +1366,9 @@ Pact Broker will respond with:
|
|
930
1366
|
```json
|
931
1367
|
{
|
932
1368
|
"status": 200,
|
1369
|
+
"headers": {
|
1370
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1371
|
+
},
|
933
1372
|
"body": {
|
934
1373
|
"_links": {
|
935
1374
|
"pb:latest-pact-version": {
|
@@ -956,7 +1395,10 @@ Given **the 'Pricing Service' already exists in the pact-broker**, upon receivin
|
|
956
1395
|
Pact Broker will respond with:
|
957
1396
|
```json
|
958
1397
|
{
|
959
|
-
"status": 200
|
1398
|
+
"status": 200,
|
1399
|
+
"headers": {
|
1400
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1401
|
+
}
|
960
1402
|
}
|
961
1403
|
```
|
962
1404
|
<a name="a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_does_not_exist_in_the_pact-broker"></a>
|
@@ -976,7 +1418,10 @@ Given **the 'Pricing Service' does not exist in the pact-broker**, upon receivin
|
|
976
1418
|
Pact Broker will respond with:
|
977
1419
|
```json
|
978
1420
|
{
|
979
|
-
"status": 201
|
1421
|
+
"status": 201,
|
1422
|
+
"headers": {
|
1423
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1424
|
+
}
|
980
1425
|
}
|
981
1426
|
```
|
982
1427
|
<a name="a_request_to_retrieve_the_latest_'production'_version_of_Condor_given_'Condor'_exists_in_the_pact-broker_with_the_latest_tagged_'production'_version_1.2.3"></a>
|
@@ -986,7 +1431,7 @@ Given **'Condor' exists in the pact-broker with the latest tagged 'production' v
|
|
986
1431
|
"method": "get",
|
987
1432
|
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-TAGGED-VERSION-Condor-production",
|
988
1433
|
"headers": {
|
989
|
-
"Accept": "application/json, application/
|
1434
|
+
"Accept": "application/hal+json, application/json"
|
990
1435
|
}
|
991
1436
|
}
|
992
1437
|
```
|
@@ -994,6 +1439,9 @@ Pact Broker will respond with:
|
|
994
1439
|
```json
|
995
1440
|
{
|
996
1441
|
"status": 200,
|
1442
|
+
"headers": {
|
1443
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1444
|
+
},
|
997
1445
|
"body": {
|
998
1446
|
"number": "1.2.3",
|
999
1447
|
"_links": {
|
@@ -1054,7 +1502,7 @@ Given **'Condor' exists in the pact-broker with the latest version 1.2.3**, upon
|
|
1054
1502
|
"method": "get",
|
1055
1503
|
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor",
|
1056
1504
|
"headers": {
|
1057
|
-
"Accept": "application/json, application/
|
1505
|
+
"Accept": "application/hal+json, application/json"
|
1058
1506
|
}
|
1059
1507
|
}
|
1060
1508
|
```
|
@@ -1062,6 +1510,9 @@ Pact Broker will respond with:
|
|
1062
1510
|
```json
|
1063
1511
|
{
|
1064
1512
|
"status": 200,
|
1513
|
+
"headers": {
|
1514
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1515
|
+
},
|
1065
1516
|
"body": {
|
1066
1517
|
"number": "1.2.3",
|
1067
1518
|
"_links": {
|
@@ -1079,7 +1530,7 @@ Given **a pact between Condor and the Pricing Service exists for the production
|
|
1079
1530
|
"method": "get",
|
1080
1531
|
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/latest/prod",
|
1081
1532
|
"headers": {
|
1082
|
-
"Accept": "application/json, application/
|
1533
|
+
"Accept": "application/hal+json, application/json"
|
1083
1534
|
}
|
1084
1535
|
}
|
1085
1536
|
```
|
@@ -1087,6 +1538,9 @@ Pact Broker will respond with:
|
|
1087
1538
|
```json
|
1088
1539
|
{
|
1089
1540
|
"status": 200,
|
1541
|
+
"headers": {
|
1542
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1543
|
+
},
|
1090
1544
|
"body": {
|
1091
1545
|
"consumer": {
|
1092
1546
|
"name": "Condor"
|
@@ -1115,6 +1569,9 @@ Pact Broker will respond with:
|
|
1115
1569
|
```json
|
1116
1570
|
{
|
1117
1571
|
"status": 200,
|
1572
|
+
"headers": {
|
1573
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1574
|
+
},
|
1118
1575
|
"body": {
|
1119
1576
|
"_links": {
|
1120
1577
|
"self": {
|
@@ -1139,6 +1596,9 @@ Pact Broker will respond with:
|
|
1139
1596
|
```json
|
1140
1597
|
{
|
1141
1598
|
"status": 201,
|
1599
|
+
"headers": {
|
1600
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1601
|
+
},
|
1142
1602
|
"body": {
|
1143
1603
|
"_links": {
|
1144
1604
|
"self": {
|
@@ -1163,6 +1623,9 @@ Pact Broker will respond with:
|
|
1163
1623
|
```json
|
1164
1624
|
{
|
1165
1625
|
"status": 201,
|
1626
|
+
"headers": {
|
1627
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1628
|
+
},
|
1166
1629
|
"body": {
|
1167
1630
|
"_links": {
|
1168
1631
|
"self": {
|
@@ -1172,3 +1635,51 @@ Pact Broker will respond with:
|
|
1172
1635
|
}
|
1173
1636
|
}
|
1174
1637
|
```
|
1638
|
+
<a name="an_invalid_request_to_create_a_webhook_for_a_consumer_and_provider_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker"></a>
|
1639
|
+
Given **the 'Pricing Service' and 'Condor' already exist in the pact-broker**, upon receiving **an invalid request to create a webhook for a consumer and provider** from Pact Broker Client, with
|
1640
|
+
```json
|
1641
|
+
{
|
1642
|
+
"method": "post",
|
1643
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
1644
|
+
"headers": {
|
1645
|
+
"Content-Type": "application/json",
|
1646
|
+
"Accept": "application/hal+json"
|
1647
|
+
},
|
1648
|
+
"body": {
|
1649
|
+
"events": [
|
1650
|
+
{
|
1651
|
+
"name": "contract_content_changed"
|
1652
|
+
}
|
1653
|
+
],
|
1654
|
+
"request": {
|
1655
|
+
"url": null,
|
1656
|
+
"method": "POST",
|
1657
|
+
"headers": {
|
1658
|
+
"Foo": "bar",
|
1659
|
+
"Bar": "foo"
|
1660
|
+
},
|
1661
|
+
"body": {
|
1662
|
+
"some": "body"
|
1663
|
+
},
|
1664
|
+
"username": "username",
|
1665
|
+
"password": "password"
|
1666
|
+
}
|
1667
|
+
}
|
1668
|
+
}
|
1669
|
+
```
|
1670
|
+
Pact Broker will respond with:
|
1671
|
+
```json
|
1672
|
+
{
|
1673
|
+
"status": 400,
|
1674
|
+
"headers": {
|
1675
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1676
|
+
},
|
1677
|
+
"body": {
|
1678
|
+
"errors": {
|
1679
|
+
"request.url": [
|
1680
|
+
"Some error"
|
1681
|
+
]
|
1682
|
+
}
|
1683
|
+
}
|
1684
|
+
}
|
1685
|
+
```
|