pact_broker-client 1.25.0 → 1.27.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/trigger_pact_cli_release.yml +15 -0
- data/.github/workflows/trigger_pact_docs_update.yml +21 -0
- data/CHANGELOG.md +55 -0
- data/Gemfile +6 -1
- data/README.md +4 -3
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +234 -10
- data/lib/pact_broker/client/can_i_deploy.rb +6 -0
- data/lib/pact_broker/client/cli/broker.rb +33 -0
- data/lib/pact_broker/client/cli/custom_thor.rb +36 -14
- data/lib/pact_broker/client/git.rb +2 -1
- data/lib/pact_broker/client/hal/entity.rb +13 -4
- data/lib/pact_broker/client/hal/http_client.rb +6 -0
- data/lib/pact_broker/client/hal/link.rb +5 -1
- data/lib/pact_broker/client/hal_client_methods.rb +15 -0
- data/lib/pact_broker/client/matrix/resource.rb +5 -1
- data/lib/pact_broker/client/pacticipants/create.rb +57 -0
- data/lib/pact_broker/client/pacts/list_latest_versions.rb +65 -0
- data/lib/pact_broker/client/publish_pacts.rb +1 -1
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/webhooks/create.rb +7 -1
- data/lib/pact_broker/client/webhooks/test.rb +16 -0
- data/pact-broker-client.gemspec +3 -4
- data/spec/integration/can_i_deploy_spec.rb +3 -3
- data/spec/integration/create_version_tag_spec.rb +2 -3
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +22 -4
- data/spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb +2 -0
- data/spec/lib/pact_broker/client/cli/custom_thor_spec.rb +6 -0
- data/spec/lib/pact_broker/client/hal/entity_spec.rb +1 -0
- data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +28 -0
- data/spec/lib/pact_broker/client/webhooks/create_spec.rb +22 -0
- data/spec/pacts/pact_broker_client-pact_broker.json +273 -10
- data/spec/service_providers/pact_broker_client_matrix_spec.rb +10 -10
- data/spec/service_providers/pact_helper.rb +29 -0
- data/spec/service_providers/pacticipants_create_spec.rb +118 -0
- data/spec/service_providers/webhooks_create_spec.rb +46 -17
- metadata +25 -30
@@ -101,7 +101,13 @@ module PactBroker
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def success_result(webhook_entity)
|
104
|
-
|
104
|
+
action = webhook_entity.response.status == 201 ? "created" : "updated"
|
105
|
+
name = if webhook_entity.description && webhook_entity.description.size > 0
|
106
|
+
webhook_entity.description
|
107
|
+
else
|
108
|
+
webhook_entity._link('self').title_or_name
|
109
|
+
end
|
110
|
+
CommandResult.new(true, "Webhook #{name.inspect} #{action}")
|
105
111
|
end
|
106
112
|
|
107
113
|
def error_result(message)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'pact_broker/client/hal'
|
2
|
+
require 'pact_broker/client/command_result'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module Client
|
6
|
+
module Webhooks
|
7
|
+
class Test
|
8
|
+
def self.call(options, pact_broker_client_options)
|
9
|
+
http_client = PactBroker::Client::Hal::HttpClient.new(pact_broker_client_options.merge(pact_broker_client_options[:basic_auth] || {}))
|
10
|
+
execution_result = PactBroker::Client::Hal::EntryPoint.new(options.broker_base_url, http_client).get!._link!('pb:webhook').expand('uuid' => options.uuid).get!.post('pb:execute')
|
11
|
+
PactBroker::Client::CommandResult.new(true, execution_result.response.body['logs'])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/pact-broker-client.gemspec
CHANGED
@@ -21,12 +21,11 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.require_paths = ["lib"]
|
22
22
|
gem.license = 'MIT'
|
23
23
|
|
24
|
-
gem.add_runtime_dependency 'httparty'
|
25
|
-
gem.add_runtime_dependency '
|
26
|
-
gem.add_runtime_dependency 'term-ansicolor'
|
24
|
+
gem.add_runtime_dependency 'httparty', '~>0.18'
|
25
|
+
gem.add_runtime_dependency 'term-ansicolor', '~> 1.7'
|
27
26
|
gem.add_runtime_dependency 'table_print', '~> 1.5'
|
28
27
|
gem.add_runtime_dependency 'thor', '~> 0.20'
|
29
|
-
gem.add_runtime_dependency 'rake' #For FileList
|
28
|
+
gem.add_runtime_dependency 'rake', '~> 13.0' #For FileList
|
30
29
|
|
31
30
|
gem.add_development_dependency 'fakefs', '~> 0.4'
|
32
31
|
gem.add_development_dependency 'webmock', '~> 3.0'
|
@@ -1,7 +1,7 @@
|
|
1
|
-
describe "pact-broker can-i-deploy", skip_windows: true
|
1
|
+
describe "pact-broker can-i-deploy", skip_windows: true do
|
2
2
|
before(:all) do
|
3
|
-
@pipe = IO.popen("bundle exec pact-stub-service spec/pacts/pact_broker_client-pact_broker.json -p 5000")
|
4
|
-
sleep
|
3
|
+
@pipe = IO.popen("bundle exec pact-stub-service spec/pacts/pact_broker_client-pact_broker.json -p 5000 --log tmp/pact-stub-can-i-deploy.log")
|
4
|
+
sleep 4
|
5
5
|
end
|
6
6
|
|
7
7
|
context "when the pacticipants can be deployed" do
|
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
describe "pact-broker create-version-tag", skip_windows: true, skip_ci: true do
|
1
|
+
describe "pact-broker create-version-tag", skip_windows: true do
|
3
2
|
before(:all) do
|
4
|
-
@pipe = IO.popen("bundle exec pact-stub-service spec/pacts/pact_broker_client-pact_broker.json -p 5001")
|
3
|
+
@pipe = IO.popen("bundle exec pact-stub-service spec/pacts/pact_broker_client-pact_broker.json -p 5001 --log tmp/pact-stub-service-create-verison-tag.log")
|
5
4
|
sleep 2
|
6
5
|
end
|
7
6
|
|
@@ -9,11 +9,19 @@ module PactBroker
|
|
9
9
|
let(:matrix_options) { {} }
|
10
10
|
let(:pact_broker_client_options) { { foo: 'bar' } }
|
11
11
|
let(:matrix_client) { instance_double('PactBroker::Client::Matrix') }
|
12
|
-
let(:matrix)
|
13
|
-
|
12
|
+
let(:matrix) do
|
13
|
+
instance_double('Matrix::Resource',
|
14
|
+
deployable?: true,
|
15
|
+
reason: 'some reason',
|
16
|
+
any_unknown?: any_unknown,
|
17
|
+
supports_unknown_count?: supports_unknown_count,
|
18
|
+
unknown_count: unknown_count)
|
19
|
+
end
|
20
|
+
let(:unknown_count) { 0 }
|
21
|
+
let(:any_unknown) { unknown_count > 0 }
|
14
22
|
let(:supports_unknown_count) { true }
|
15
23
|
let(:retry_while_unknown) { 0 }
|
16
|
-
let(:options) { { output: 'text', retry_while_unknown: retry_while_unknown, retry_interval: 5} }
|
24
|
+
let(:options) { { output: 'text', retry_while_unknown: retry_while_unknown, retry_interval: 5 } }
|
17
25
|
|
18
26
|
|
19
27
|
before do
|
@@ -76,7 +84,17 @@ module PactBroker
|
|
76
84
|
end
|
77
85
|
|
78
86
|
context "when any_unknown? is true" do
|
79
|
-
|
87
|
+
before do
|
88
|
+
allow($stderr).to receive(:puts)
|
89
|
+
allow(Retry).to receive(:until_truthy_or_max_times)
|
90
|
+
end
|
91
|
+
|
92
|
+
let(:unknown_count) { 1 }
|
93
|
+
|
94
|
+
it "puts a message to stderr" do
|
95
|
+
expect($stderr).to receive(:puts).with("Waiting for 1 verification result to be published (maximum of 5 seconds)")
|
96
|
+
subject
|
97
|
+
end
|
80
98
|
|
81
99
|
it "retries the request" do
|
82
100
|
expect(Retry).to receive(:until_truthy_or_max_times).with(hash_including(times: 1, sleep: 5, sleep_first: true))
|
@@ -22,6 +22,7 @@ module PactBroker
|
|
22
22
|
let(:options_hash) do
|
23
23
|
{
|
24
24
|
uuid: '9999',
|
25
|
+
description: "some webhook",
|
25
26
|
request: "POST",
|
26
27
|
header: header,
|
27
28
|
data: data,
|
@@ -39,6 +40,7 @@ module PactBroker
|
|
39
40
|
let(:expected_params) do
|
40
41
|
{
|
41
42
|
uuid: '9999',
|
43
|
+
description: "some webhook",
|
42
44
|
http_method: "POST",
|
43
45
|
url: "http://webhook",
|
44
46
|
headers: { "Foo" => "bar", "Bar" => "foo"},
|
@@ -109,6 +109,12 @@ module PactBroker::Client::CLI
|
|
109
109
|
expect(TestThor.turn_muliple_tag_options_into_array(input)).to eq output
|
110
110
|
end
|
111
111
|
|
112
|
+
it "turns '--tag=foo --tag=bar' into '--tag foo bar'" do
|
113
|
+
input = %w{--ignore this --tag=foo --tag=bar --wiffle --that}
|
114
|
+
output = %w{--ignore this --tag foo bar --wiffle --that }
|
115
|
+
expect(TestThor.turn_muliple_tag_options_into_array(input)).to eq output
|
116
|
+
end
|
117
|
+
|
112
118
|
it "doesn't change anything when there are no duplicate options" do
|
113
119
|
input = %w{--ignore this --taggy foo --blah bar --wiffle --that}
|
114
120
|
expect(TestThor.turn_muliple_tag_options_into_array(input)).to eq input
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'pact_broker/client/pacticipants/create'
|
2
|
+
|
3
|
+
module PactBroker
|
4
|
+
module Client
|
5
|
+
module Pacticipants2
|
6
|
+
describe Create do
|
7
|
+
describe ".call" do
|
8
|
+
let(:pact_broker_client_options) { {} }
|
9
|
+
let(:broker_base_url) { "http://url" }
|
10
|
+
let(:params) { { name: 'Foo' } }
|
11
|
+
|
12
|
+
subject { Create.call(params, broker_base_url, pact_broker_client_options)}
|
13
|
+
|
14
|
+
context "when there is an http error" do
|
15
|
+
let!(:index_request) do
|
16
|
+
stub_request(:get, broker_base_url).to_return(status: 500, body: 'some error', headers: { "Content-Type" => "application/hal+json" } )
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns a failure result" do
|
20
|
+
expect(subject.success).to be false
|
21
|
+
expect(subject.message).to include 'some error'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -70,6 +70,28 @@ module PactBroker
|
|
70
70
|
expect(subject.message).to match /"some":"error"/
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
context "when there is an empty description returned" do
|
75
|
+
let!(:webhook_request) do
|
76
|
+
stub_request(:post, "http://broker/webhooks").to_return(status: 200, body: response_body.to_json, headers: { "Content-Type" => "application/hal+json" })
|
77
|
+
end
|
78
|
+
|
79
|
+
let(:response_body) do
|
80
|
+
{
|
81
|
+
description: "",
|
82
|
+
_links: {
|
83
|
+
self: {
|
84
|
+
href: "href",
|
85
|
+
title: "the title"
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
it "uses the self title in the message instead" do
|
92
|
+
expect(subject.message).to include "the title"
|
93
|
+
end
|
94
|
+
end
|
73
95
|
end
|
74
96
|
end
|
75
97
|
end
|
@@ -192,7 +192,7 @@
|
|
192
192
|
"request": {
|
193
193
|
"method": "get",
|
194
194
|
"path": "/matrix",
|
195
|
-
"query": "q
|
195
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bversion%5D=1.2.3&q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Bversion%5D=4.5.6&latestby=cvpv"
|
196
196
|
},
|
197
197
|
"response": {
|
198
198
|
"status": 200,
|
@@ -242,7 +242,7 @@
|
|
242
242
|
"request": {
|
243
243
|
"method": "get",
|
244
244
|
"path": "/matrix",
|
245
|
-
"query": "q
|
245
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo%20Thing&q%5B%5D%5Bversion%5D=1.2.3&q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Bversion%5D=4.5.6&latestby=cvpv"
|
246
246
|
},
|
247
247
|
"response": {
|
248
248
|
"status": 200,
|
@@ -292,7 +292,7 @@
|
|
292
292
|
"request": {
|
293
293
|
"method": "get",
|
294
294
|
"path": "/matrix",
|
295
|
-
"query": "q
|
295
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bversion%5D=1.2.3&latestby=cvp&latest=true"
|
296
296
|
},
|
297
297
|
"response": {
|
298
298
|
"status": 200,
|
@@ -342,7 +342,7 @@
|
|
342
342
|
"request": {
|
343
343
|
"method": "get",
|
344
344
|
"path": "/matrix",
|
345
|
-
"query": "q
|
345
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bversion%5D=1.2.3&q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Bversion%5D=9.9.9&latestby=cvpv"
|
346
346
|
},
|
347
347
|
"response": {
|
348
348
|
"status": 200,
|
@@ -366,7 +366,7 @@
|
|
366
366
|
"request": {
|
367
367
|
"method": "get",
|
368
368
|
"path": "/matrix",
|
369
|
-
"query": "q
|
369
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Wiffle&q%5B%5D%5Bversion%5D=1.2.3&q%5B%5D%5Bpacticipant%5D=Meep&q%5B%5D%5Bversion%5D=9.9.9&latestby=cvpv"
|
370
370
|
},
|
371
371
|
"response": {
|
372
372
|
"status": 400,
|
@@ -394,7 +394,7 @@
|
|
394
394
|
"request": {
|
395
395
|
"method": "get",
|
396
396
|
"path": "/matrix",
|
397
|
-
"query": "q
|
397
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bpacticipant%5D=Bar&latestby=cvpv"
|
398
398
|
},
|
399
399
|
"response": {
|
400
400
|
"status": 200,
|
@@ -463,7 +463,7 @@
|
|
463
463
|
"request": {
|
464
464
|
"method": "get",
|
465
465
|
"path": "/matrix",
|
466
|
-
"query": "q
|
466
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bpacticipant%5D=Bar&latestby=cvpv&success%5B%5D=true"
|
467
467
|
},
|
468
468
|
"response": {
|
469
469
|
"status": 200,
|
@@ -513,7 +513,7 @@
|
|
513
513
|
"request": {
|
514
514
|
"method": "get",
|
515
515
|
"path": "/matrix",
|
516
|
-
"query": "q
|
516
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bversion%5D=1.2.3&q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Blatest%5D=true&q%5B%5D%5Btag%5D=prod&latestby=cvpv"
|
517
517
|
},
|
518
518
|
"response": {
|
519
519
|
"status": 200,
|
@@ -563,7 +563,7 @@
|
|
563
563
|
"request": {
|
564
564
|
"method": "get",
|
565
565
|
"path": "/matrix",
|
566
|
-
"query": "q
|
566
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bversion%5D=1.2.4&q%5B%5D%5Bpacticipant%5D=Bar&q%5B%5D%5Blatest%5D=true&latestby=cvpv"
|
567
567
|
},
|
568
568
|
"response": {
|
569
569
|
"status": 200,
|
@@ -613,7 +613,7 @@
|
|
613
613
|
"request": {
|
614
614
|
"method": "get",
|
615
615
|
"path": "/matrix",
|
616
|
-
"query": "q
|
616
|
+
"query": "q%5B%5D%5Bpacticipant%5D=Foo&q%5B%5D%5Bversion%5D=1.2.3&latestby=cvp&latest=true&tag=prod"
|
617
617
|
},
|
618
618
|
"response": {
|
619
619
|
"status": 200,
|
@@ -1249,6 +1249,161 @@
|
|
1249
1249
|
}
|
1250
1250
|
}
|
1251
1251
|
},
|
1252
|
+
{
|
1253
|
+
"description": "a request for the index resource",
|
1254
|
+
"providerState": "the pacticipant relations are present",
|
1255
|
+
"request": {
|
1256
|
+
"method": "get",
|
1257
|
+
"path": "/",
|
1258
|
+
"headers": {
|
1259
|
+
"Accept": "application/hal+json"
|
1260
|
+
}
|
1261
|
+
},
|
1262
|
+
"response": {
|
1263
|
+
"status": 200,
|
1264
|
+
"headers": {
|
1265
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1266
|
+
},
|
1267
|
+
"body": {
|
1268
|
+
"_links": {
|
1269
|
+
"pb:pacticipants": {
|
1270
|
+
"href": "http://localhost:1234/pacticipants"
|
1271
|
+
},
|
1272
|
+
"pb:pacticipant": {
|
1273
|
+
"href": "http://localhost:1234/pacticipants/{pacticipant}"
|
1274
|
+
}
|
1275
|
+
}
|
1276
|
+
},
|
1277
|
+
"matchingRules": {
|
1278
|
+
"$.body._links.pb:pacticipants.href": {
|
1279
|
+
"match": "regex",
|
1280
|
+
"regex": "http:\\/\\/.*"
|
1281
|
+
},
|
1282
|
+
"$.body._links.pb:pacticipant.href": {
|
1283
|
+
"match": "regex",
|
1284
|
+
"regex": "http:\\/\\/.*\\{pacticipant\\}"
|
1285
|
+
}
|
1286
|
+
}
|
1287
|
+
}
|
1288
|
+
},
|
1289
|
+
{
|
1290
|
+
"description": "a request to retrieve a pacticipant",
|
1291
|
+
"request": {
|
1292
|
+
"method": "get",
|
1293
|
+
"path": "/pacticipants/Foo",
|
1294
|
+
"headers": {
|
1295
|
+
"Accept": "application/hal+json"
|
1296
|
+
}
|
1297
|
+
},
|
1298
|
+
"response": {
|
1299
|
+
"status": 404,
|
1300
|
+
"headers": {
|
1301
|
+
}
|
1302
|
+
}
|
1303
|
+
},
|
1304
|
+
{
|
1305
|
+
"description": "a request to create a pacticipant",
|
1306
|
+
"request": {
|
1307
|
+
"method": "post",
|
1308
|
+
"path": "/pacticipants",
|
1309
|
+
"headers": {
|
1310
|
+
"Content-Type": "application/json",
|
1311
|
+
"Accept": "application/hal+json"
|
1312
|
+
},
|
1313
|
+
"body": {
|
1314
|
+
"name": "Foo",
|
1315
|
+
"repositoryUrl": "http://foo"
|
1316
|
+
}
|
1317
|
+
},
|
1318
|
+
"response": {
|
1319
|
+
"status": 201,
|
1320
|
+
"headers": {
|
1321
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1322
|
+
},
|
1323
|
+
"body": {
|
1324
|
+
"name": "Foo",
|
1325
|
+
"repositoryUrl": "http://foo",
|
1326
|
+
"_links": {
|
1327
|
+
"self": {
|
1328
|
+
"href": "http://localhost:1234/pacticipants/Foo"
|
1329
|
+
}
|
1330
|
+
}
|
1331
|
+
},
|
1332
|
+
"matchingRules": {
|
1333
|
+
"$.body._links.self.href": {
|
1334
|
+
"match": "regex",
|
1335
|
+
"regex": "http:\\/\\/.*"
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
}
|
1339
|
+
},
|
1340
|
+
{
|
1341
|
+
"description": "a request to retrieve a pacticipant",
|
1342
|
+
"providerState": "a pacticipant with name Foo exists",
|
1343
|
+
"request": {
|
1344
|
+
"method": "get",
|
1345
|
+
"path": "/pacticipants/Foo",
|
1346
|
+
"headers": {
|
1347
|
+
"Accept": "application/hal+json"
|
1348
|
+
}
|
1349
|
+
},
|
1350
|
+
"response": {
|
1351
|
+
"status": 200,
|
1352
|
+
"headers": {
|
1353
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1354
|
+
},
|
1355
|
+
"body": {
|
1356
|
+
"_links": {
|
1357
|
+
"self": {
|
1358
|
+
"href": "http://localhost:1234/pacticipants/Foo"
|
1359
|
+
}
|
1360
|
+
}
|
1361
|
+
},
|
1362
|
+
"matchingRules": {
|
1363
|
+
"$.body._links.self.href": {
|
1364
|
+
"match": "regex",
|
1365
|
+
"regex": "http:\\/\\/.*"
|
1366
|
+
}
|
1367
|
+
}
|
1368
|
+
}
|
1369
|
+
},
|
1370
|
+
{
|
1371
|
+
"description": "a request to update a pacticipant",
|
1372
|
+
"providerState": "a pacticipant with name Foo exists",
|
1373
|
+
"request": {
|
1374
|
+
"method": "patch",
|
1375
|
+
"path": "/pacticipants/Foo",
|
1376
|
+
"headers": {
|
1377
|
+
"Content-Type": "application/json",
|
1378
|
+
"Accept": "application/hal+json"
|
1379
|
+
},
|
1380
|
+
"body": {
|
1381
|
+
"name": "Foo",
|
1382
|
+
"repositoryUrl": "http://foo"
|
1383
|
+
}
|
1384
|
+
},
|
1385
|
+
"response": {
|
1386
|
+
"status": 200,
|
1387
|
+
"headers": {
|
1388
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1389
|
+
},
|
1390
|
+
"body": {
|
1391
|
+
"name": "Foo",
|
1392
|
+
"repositoryUrl": "http://foo",
|
1393
|
+
"_links": {
|
1394
|
+
"self": {
|
1395
|
+
"href": "http://localhost:1234/pacticipants/Foo"
|
1396
|
+
}
|
1397
|
+
}
|
1398
|
+
},
|
1399
|
+
"matchingRules": {
|
1400
|
+
"$.body._links.self.href": {
|
1401
|
+
"match": "regex",
|
1402
|
+
"regex": "http:\\/\\/.*"
|
1403
|
+
}
|
1404
|
+
}
|
1405
|
+
}
|
1406
|
+
},
|
1252
1407
|
{
|
1253
1408
|
"description": "a request to create a webhook with a JSON body for a consumer and provider",
|
1254
1409
|
"providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",
|
@@ -1287,6 +1442,7 @@
|
|
1287
1442
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1288
1443
|
},
|
1289
1444
|
"body": {
|
1445
|
+
"description": "a webhook",
|
1290
1446
|
"_links": {
|
1291
1447
|
"self": {
|
1292
1448
|
"href": "http://localhost:1234/some-url",
|
@@ -1295,6 +1451,9 @@
|
|
1295
1451
|
}
|
1296
1452
|
},
|
1297
1453
|
"matchingRules": {
|
1454
|
+
"$.body.description": {
|
1455
|
+
"match": "type"
|
1456
|
+
},
|
1298
1457
|
"$.body._links.self.href": {
|
1299
1458
|
"match": "regex",
|
1300
1459
|
"regex": "http:\\/\\/.*"
|
@@ -1355,6 +1514,7 @@
|
|
1355
1514
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1356
1515
|
},
|
1357
1516
|
"body": {
|
1517
|
+
"description": "a webhook",
|
1358
1518
|
"_links": {
|
1359
1519
|
"self": {
|
1360
1520
|
"href": "http://localhost:1234/some-url",
|
@@ -1363,6 +1523,9 @@
|
|
1363
1523
|
}
|
1364
1524
|
},
|
1365
1525
|
"matchingRules": {
|
1526
|
+
"$.body.description": {
|
1527
|
+
"match": "type"
|
1528
|
+
},
|
1366
1529
|
"$.body._links.self.href": {
|
1367
1530
|
"match": "regex",
|
1368
1531
|
"regex": "http:\\/\\/.*"
|
@@ -1409,6 +1572,7 @@
|
|
1409
1572
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1410
1573
|
},
|
1411
1574
|
"body": {
|
1575
|
+
"description": "a webhook",
|
1412
1576
|
"_links": {
|
1413
1577
|
"self": {
|
1414
1578
|
"href": "http://localhost:1234/some-url",
|
@@ -1417,6 +1581,9 @@
|
|
1417
1581
|
}
|
1418
1582
|
},
|
1419
1583
|
"matchingRules": {
|
1584
|
+
"$.body.description": {
|
1585
|
+
"match": "type"
|
1586
|
+
},
|
1420
1587
|
"$.body._links.self.href": {
|
1421
1588
|
"match": "regex",
|
1422
1589
|
"regex": "http:\\/\\/.*"
|
@@ -1538,6 +1705,12 @@
|
|
1538
1705
|
"_links": {
|
1539
1706
|
"pb:webhooks": {
|
1540
1707
|
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-WEBHOOKS"
|
1708
|
+
},
|
1709
|
+
"pb:pacticipants": {
|
1710
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANTS"
|
1711
|
+
},
|
1712
|
+
"pb:pacticipant": {
|
1713
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-{pacticipant}"
|
1541
1714
|
}
|
1542
1715
|
}
|
1543
1716
|
},
|
@@ -1545,6 +1718,14 @@
|
|
1545
1718
|
"$.body._links.pb:webhooks.href": {
|
1546
1719
|
"match": "regex",
|
1547
1720
|
"regex": "http:\\/\\/.*"
|
1721
|
+
},
|
1722
|
+
"$.body._links.pb:pacticipants.href": {
|
1723
|
+
"match": "regex",
|
1724
|
+
"regex": "http:\\/\\/.*"
|
1725
|
+
},
|
1726
|
+
"$.body._links.pb:pacticipant.href": {
|
1727
|
+
"match": "regex",
|
1728
|
+
"regex": "http:\\/\\/.*{pacticipant}"
|
1548
1729
|
}
|
1549
1730
|
}
|
1550
1731
|
}
|
@@ -1590,6 +1771,7 @@
|
|
1590
1771
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1591
1772
|
},
|
1592
1773
|
"body": {
|
1774
|
+
"description": "a webhook",
|
1593
1775
|
"_links": {
|
1594
1776
|
"self": {
|
1595
1777
|
"href": "http://localhost:1234/some-url",
|
@@ -1598,6 +1780,9 @@
|
|
1598
1780
|
}
|
1599
1781
|
},
|
1600
1782
|
"matchingRules": {
|
1783
|
+
"$.body.description": {
|
1784
|
+
"match": "type"
|
1785
|
+
},
|
1601
1786
|
"$.body._links.self.href": {
|
1602
1787
|
"match": "regex",
|
1603
1788
|
"regex": "http:\\/\\/.*"
|
@@ -1705,6 +1890,7 @@
|
|
1705
1890
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1706
1891
|
},
|
1707
1892
|
"body": {
|
1893
|
+
"description": "a webhook",
|
1708
1894
|
"_links": {
|
1709
1895
|
"self": {
|
1710
1896
|
"href": "http://localhost:1234/some-url",
|
@@ -1713,6 +1899,9 @@
|
|
1713
1899
|
}
|
1714
1900
|
},
|
1715
1901
|
"matchingRules": {
|
1902
|
+
"$.body.description": {
|
1903
|
+
"match": "type"
|
1904
|
+
},
|
1716
1905
|
"$.body._links.self.href": {
|
1717
1906
|
"match": "regex",
|
1718
1907
|
"regex": "http:\\/\\/.*"
|
@@ -1760,6 +1949,7 @@
|
|
1760
1949
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1761
1950
|
},
|
1762
1951
|
"body": {
|
1952
|
+
"description": "a webhook",
|
1763
1953
|
"_links": {
|
1764
1954
|
"self": {
|
1765
1955
|
"href": "http://localhost:1234/some-url",
|
@@ -1768,6 +1958,9 @@
|
|
1768
1958
|
}
|
1769
1959
|
},
|
1770
1960
|
"matchingRules": {
|
1961
|
+
"$.body.description": {
|
1962
|
+
"match": "type"
|
1963
|
+
},
|
1771
1964
|
"$.body._links.self.href": {
|
1772
1965
|
"match": "regex",
|
1773
1966
|
"regex": "http:\\/\\/.*"
|
@@ -1852,6 +2045,7 @@
|
|
1852
2045
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1853
2046
|
},
|
1854
2047
|
"body": {
|
2048
|
+
"description": "a webhook",
|
1855
2049
|
"_links": {
|
1856
2050
|
"self": {
|
1857
2051
|
"href": "http://localhost:1234/some-url",
|
@@ -1860,6 +2054,75 @@
|
|
1860
2054
|
}
|
1861
2055
|
},
|
1862
2056
|
"matchingRules": {
|
2057
|
+
"$.body.description": {
|
2058
|
+
"match": "type"
|
2059
|
+
},
|
2060
|
+
"$.body._links.self.href": {
|
2061
|
+
"match": "regex",
|
2062
|
+
"regex": "http:\\/\\/.*"
|
2063
|
+
},
|
2064
|
+
"$.body._links.self.title": {
|
2065
|
+
"match": "type"
|
2066
|
+
}
|
2067
|
+
}
|
2068
|
+
}
|
2069
|
+
},
|
2070
|
+
{
|
2071
|
+
"description": "a request to update a webhook",
|
2072
|
+
"providerState": "a webhook with the uuid 696c5f93-1b7f-44bc-8d03-59440fcaa9a0 exists",
|
2073
|
+
"request": {
|
2074
|
+
"method": "put",
|
2075
|
+
"path": "/webhooks/696c5f93-1b7f-44bc-8d03-59440fcaa9a0",
|
2076
|
+
"headers": {
|
2077
|
+
"Content-Type": "application/json",
|
2078
|
+
"Accept": "application/hal+json"
|
2079
|
+
},
|
2080
|
+
"body": {
|
2081
|
+
"description": "a webhook",
|
2082
|
+
"events": [
|
2083
|
+
{
|
2084
|
+
"name": "contract_content_changed"
|
2085
|
+
}
|
2086
|
+
],
|
2087
|
+
"request": {
|
2088
|
+
"url": "https://webhook",
|
2089
|
+
"method": "POST",
|
2090
|
+
"headers": {
|
2091
|
+
"Foo": "bar",
|
2092
|
+
"Bar": "foo"
|
2093
|
+
},
|
2094
|
+
"body": {
|
2095
|
+
"some": "body"
|
2096
|
+
},
|
2097
|
+
"username": "username",
|
2098
|
+
"password": "password"
|
2099
|
+
},
|
2100
|
+
"provider": {
|
2101
|
+
"name": "Pricing Service"
|
2102
|
+
},
|
2103
|
+
"consumer": {
|
2104
|
+
"name": "Condor"
|
2105
|
+
}
|
2106
|
+
}
|
2107
|
+
},
|
2108
|
+
"response": {
|
2109
|
+
"status": 200,
|
2110
|
+
"headers": {
|
2111
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
2112
|
+
},
|
2113
|
+
"body": {
|
2114
|
+
"description": "a webhook",
|
2115
|
+
"_links": {
|
2116
|
+
"self": {
|
2117
|
+
"href": "http://localhost:1234/some-url",
|
2118
|
+
"title": "A title"
|
2119
|
+
}
|
2120
|
+
}
|
2121
|
+
},
|
2122
|
+
"matchingRules": {
|
2123
|
+
"$.body.description": {
|
2124
|
+
"match": "type"
|
2125
|
+
},
|
1863
2126
|
"$.body._links.self.href": {
|
1864
2127
|
"match": "regex",
|
1865
2128
|
"regex": "http:\\/\\/.*"
|