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
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'pact_broker/client/webhooks/create'
|
2
|
+
|
3
|
+
module PactBroker
|
4
|
+
module Client
|
5
|
+
module Webhooks
|
6
|
+
describe Create do
|
7
|
+
describe ".call" do
|
8
|
+
let(:index_body) do
|
9
|
+
{
|
10
|
+
"_links" => {
|
11
|
+
"pb:webhooks" => {
|
12
|
+
"href" => "http://broker/webhooks"
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}.to_json
|
16
|
+
end
|
17
|
+
let!(:index_request) do
|
18
|
+
stub_request(:get, "http://broker").to_return(status: 200, body: index_body, headers: { "Content-Type" => "application/hal+json" } )
|
19
|
+
end
|
20
|
+
|
21
|
+
let!(:webhook_request) do
|
22
|
+
stub_request(:post, "http://broker/webhooks").to_return(status: 405)
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:params) do
|
26
|
+
{
|
27
|
+
http_method: "POST",
|
28
|
+
url: "https://webhook",
|
29
|
+
headers: { "Foo" => "bar", "Bar" => "foo"},
|
30
|
+
username: "username",
|
31
|
+
password: "password",
|
32
|
+
body: "body",
|
33
|
+
events: ["contract_content_changed"]
|
34
|
+
}.tap { |it| Pact::Fixture.add_fixture(:create_webhook_params, it) }
|
35
|
+
end
|
36
|
+
|
37
|
+
subject { Create.call(params, "http://broker", {}) }
|
38
|
+
|
39
|
+
context "when a 405 is returned from the webhook creation request" do
|
40
|
+
|
41
|
+
it "raises an error with a message to upgrade the Pact Broker" do
|
42
|
+
expect { subject }.to raise_error PactBroker::Client::Error, /Your version of the Pact Broker/
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when a 400 is returned from the webhook creation request" do
|
47
|
+
let!(:webhook_request) do
|
48
|
+
stub_request(:post, "http://broker/webhooks").to_return(status: 400, body: '{"some":"error"}', headers: { "Content-Type" => "application/hal+json" })
|
49
|
+
end
|
50
|
+
|
51
|
+
it "returns a result with success=false" do
|
52
|
+
expect(subject.success).to be false
|
53
|
+
expect(subject.message).to match /400/
|
54
|
+
expect(subject.message).to match /"some":"error"/
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -197,6 +197,7 @@
|
|
197
197
|
"response": {
|
198
198
|
"status": 200,
|
199
199
|
"headers": {
|
200
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
200
201
|
},
|
201
202
|
"body": {
|
202
203
|
"summary": {
|
@@ -245,6 +246,7 @@
|
|
245
246
|
"response": {
|
246
247
|
"status": 200,
|
247
248
|
"headers": {
|
249
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
248
250
|
},
|
249
251
|
"body": {
|
250
252
|
"summary": {
|
@@ -293,6 +295,7 @@
|
|
293
295
|
"response": {
|
294
296
|
"status": 200,
|
295
297
|
"headers": {
|
298
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
296
299
|
},
|
297
300
|
"body": {
|
298
301
|
"summary": {
|
@@ -341,6 +344,7 @@
|
|
341
344
|
"response": {
|
342
345
|
"status": 400,
|
343
346
|
"headers": {
|
347
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
344
348
|
},
|
345
349
|
"body": {
|
346
350
|
"errors": [
|
@@ -367,6 +371,7 @@
|
|
367
371
|
"response": {
|
368
372
|
"status": 400,
|
369
373
|
"headers": {
|
374
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
370
375
|
},
|
371
376
|
"body": {
|
372
377
|
"errors": [
|
@@ -394,6 +399,7 @@
|
|
394
399
|
"response": {
|
395
400
|
"status": 200,
|
396
401
|
"headers": {
|
402
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
397
403
|
},
|
398
404
|
"body": {
|
399
405
|
"matrix": [
|
@@ -462,6 +468,7 @@
|
|
462
468
|
"response": {
|
463
469
|
"status": 200,
|
464
470
|
"headers": {
|
471
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
465
472
|
},
|
466
473
|
"body": {
|
467
474
|
"summary": {
|
@@ -510,6 +517,7 @@
|
|
510
517
|
"response": {
|
511
518
|
"status": 200,
|
512
519
|
"headers": {
|
520
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
513
521
|
},
|
514
522
|
"body": {
|
515
523
|
"summary": {
|
@@ -558,6 +566,7 @@
|
|
558
566
|
"response": {
|
559
567
|
"status": 200,
|
560
568
|
"headers": {
|
569
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
561
570
|
},
|
562
571
|
"body": {
|
563
572
|
"summary": {
|
@@ -606,6 +615,7 @@
|
|
606
615
|
"response": {
|
607
616
|
"status": 200,
|
608
617
|
"headers": {
|
618
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
609
619
|
},
|
610
620
|
"body": {
|
611
621
|
"matrix": [
|
@@ -651,6 +661,7 @@
|
|
651
661
|
"response": {
|
652
662
|
"status": 201,
|
653
663
|
"headers": {
|
664
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
654
665
|
},
|
655
666
|
"body": {
|
656
667
|
"_links": {
|
@@ -685,6 +696,7 @@
|
|
685
696
|
"response": {
|
686
697
|
"status": 200,
|
687
698
|
"headers": {
|
699
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
688
700
|
},
|
689
701
|
"body": {
|
690
702
|
"_links": {
|
@@ -719,6 +731,7 @@
|
|
719
731
|
"response": {
|
720
732
|
"status": 200,
|
721
733
|
"headers": {
|
734
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
722
735
|
},
|
723
736
|
"body": {
|
724
737
|
"_links": {
|
@@ -753,6 +766,7 @@
|
|
753
766
|
"response": {
|
754
767
|
"status": 201,
|
755
768
|
"headers": {
|
769
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
756
770
|
},
|
757
771
|
"body": {
|
758
772
|
"_links": {
|
@@ -790,14 +804,16 @@
|
|
790
804
|
"Content-Type": "application/hal+json"
|
791
805
|
},
|
792
806
|
"body": {
|
793
|
-
"
|
807
|
+
"error": {
|
808
|
+
"message": "An error occurred"
|
809
|
+
}
|
794
810
|
},
|
795
811
|
"matchingRules": {
|
796
812
|
"$.headers.Content-Type": {
|
797
813
|
"match": "regex",
|
798
814
|
"regex": "application\\/.*json"
|
799
815
|
},
|
800
|
-
"$.body.message": {
|
816
|
+
"$.body.error.message": {
|
801
817
|
"match": "regex",
|
802
818
|
"regex": ".*"
|
803
819
|
}
|
@@ -820,6 +836,7 @@
|
|
820
836
|
"response": {
|
821
837
|
"status": 201,
|
822
838
|
"headers": {
|
839
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
823
840
|
}
|
824
841
|
}
|
825
842
|
},
|
@@ -839,6 +856,7 @@
|
|
839
856
|
"response": {
|
840
857
|
"status": 200,
|
841
858
|
"headers": {
|
859
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
842
860
|
}
|
843
861
|
}
|
844
862
|
},
|
@@ -861,7 +879,7 @@
|
|
861
879
|
"href": "http://example.org/pacticipants/Pricing%20Service",
|
862
880
|
"title": "Pricing Service"
|
863
881
|
},
|
864
|
-
"pacts": [
|
882
|
+
"pb:pacts": [
|
865
883
|
{
|
866
884
|
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
|
867
885
|
"title": "Pact between Condor (v1.3.0) and Pricing Service",
|
@@ -869,6 +887,11 @@
|
|
869
887
|
}
|
870
888
|
]
|
871
889
|
}
|
890
|
+
},
|
891
|
+
"matchingRules": {
|
892
|
+
"$.body": {
|
893
|
+
"match": "type"
|
894
|
+
}
|
872
895
|
}
|
873
896
|
}
|
874
897
|
},
|
@@ -891,7 +914,7 @@
|
|
891
914
|
"href": "http://example.org/pacticipants/Pricing%20Service",
|
892
915
|
"title": "Pricing Service"
|
893
916
|
},
|
894
|
-
"pacts": [
|
917
|
+
"pb:pacts": [
|
895
918
|
{
|
896
919
|
"href": "http://example.org/pacts/provider/Pricing%20Service/consumer/Condor/version/1.3.0",
|
897
920
|
"title": "Pact between Condor (v1.3.0) and Pricing Service",
|
@@ -899,6 +922,11 @@
|
|
899
922
|
}
|
900
923
|
]
|
901
924
|
}
|
925
|
+
},
|
926
|
+
"matchingRules": {
|
927
|
+
"$.body": {
|
928
|
+
"match": "type"
|
929
|
+
}
|
902
930
|
}
|
903
931
|
}
|
904
932
|
},
|
@@ -914,6 +942,7 @@
|
|
914
942
|
"response": {
|
915
943
|
"status": 200,
|
916
944
|
"headers": {
|
945
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
917
946
|
},
|
918
947
|
"body": {
|
919
948
|
"consumer": {
|
@@ -984,12 +1013,13 @@
|
|
984
1013
|
"method": "get",
|
985
1014
|
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/latest/prod",
|
986
1015
|
"headers": {
|
987
|
-
"Accept": "application/json, application/
|
1016
|
+
"Accept": "application/hal+json, application/json"
|
988
1017
|
}
|
989
1018
|
},
|
990
1019
|
"response": {
|
991
1020
|
"status": 200,
|
992
1021
|
"headers": {
|
1022
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
993
1023
|
},
|
994
1024
|
"body": {
|
995
1025
|
"consumer": {
|
@@ -1017,6 +1047,7 @@
|
|
1017
1047
|
"response": {
|
1018
1048
|
"status": 201,
|
1019
1049
|
"headers": {
|
1050
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1020
1051
|
},
|
1021
1052
|
"body": {
|
1022
1053
|
"_links": {
|
@@ -1046,6 +1077,7 @@
|
|
1046
1077
|
"response": {
|
1047
1078
|
"status": 201,
|
1048
1079
|
"headers": {
|
1080
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1049
1081
|
},
|
1050
1082
|
"body": {
|
1051
1083
|
"_links": {
|
@@ -1075,6 +1107,7 @@
|
|
1075
1107
|
"response": {
|
1076
1108
|
"status": 200,
|
1077
1109
|
"headers": {
|
1110
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1078
1111
|
},
|
1079
1112
|
"body": {
|
1080
1113
|
"_links": {
|
@@ -1098,12 +1131,13 @@
|
|
1098
1131
|
"method": "get",
|
1099
1132
|
"path": "/",
|
1100
1133
|
"headers": {
|
1101
|
-
"Accept": "application/json, application/
|
1134
|
+
"Accept": "application/hal+json, application/json"
|
1102
1135
|
}
|
1103
1136
|
},
|
1104
1137
|
"response": {
|
1105
1138
|
"status": 200,
|
1106
1139
|
"headers": {
|
1140
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1107
1141
|
},
|
1108
1142
|
"body": {
|
1109
1143
|
"_links": {
|
@@ -1127,12 +1161,13 @@
|
|
1127
1161
|
"method": "get",
|
1128
1162
|
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor",
|
1129
1163
|
"headers": {
|
1130
|
-
"Accept": "application/json, application/
|
1164
|
+
"Accept": "application/hal+json, application/json"
|
1131
1165
|
}
|
1132
1166
|
},
|
1133
1167
|
"response": {
|
1134
1168
|
"status": 200,
|
1135
1169
|
"headers": {
|
1170
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1136
1171
|
},
|
1137
1172
|
"body": {
|
1138
1173
|
"number": "1.2.3",
|
@@ -1157,12 +1192,13 @@
|
|
1157
1192
|
"method": "get",
|
1158
1193
|
"path": "/",
|
1159
1194
|
"headers": {
|
1160
|
-
"Accept": "application/json, application/
|
1195
|
+
"Accept": "application/hal+json, application/json"
|
1161
1196
|
}
|
1162
1197
|
},
|
1163
1198
|
"response": {
|
1164
1199
|
"status": 200,
|
1165
1200
|
"headers": {
|
1201
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1166
1202
|
},
|
1167
1203
|
"body": {
|
1168
1204
|
"_links": {
|
@@ -1186,12 +1222,13 @@
|
|
1186
1222
|
"method": "get",
|
1187
1223
|
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-TAGGED-VERSION-Condor-production",
|
1188
1224
|
"headers": {
|
1189
|
-
"Accept": "application/json, application/
|
1225
|
+
"Accept": "application/hal+json, application/json"
|
1190
1226
|
}
|
1191
1227
|
},
|
1192
1228
|
"response": {
|
1193
1229
|
"status": 200,
|
1194
1230
|
"headers": {
|
1231
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1195
1232
|
},
|
1196
1233
|
"body": {
|
1197
1234
|
"number": "1.2.3",
|
@@ -1208,6 +1245,459 @@
|
|
1208
1245
|
}
|
1209
1246
|
}
|
1210
1247
|
}
|
1248
|
+
},
|
1249
|
+
{
|
1250
|
+
"description": "a request to create a webhook with a JSON body for a consumer and provider",
|
1251
|
+
"providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",
|
1252
|
+
"request": {
|
1253
|
+
"method": "post",
|
1254
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
1255
|
+
"headers": {
|
1256
|
+
"Content-Type": "application/json",
|
1257
|
+
"Accept": "application/hal+json"
|
1258
|
+
},
|
1259
|
+
"body": {
|
1260
|
+
"events": [
|
1261
|
+
{
|
1262
|
+
"name": "contract_content_changed"
|
1263
|
+
}
|
1264
|
+
],
|
1265
|
+
"request": {
|
1266
|
+
"url": "https://webhook",
|
1267
|
+
"method": "POST",
|
1268
|
+
"headers": {
|
1269
|
+
"Foo": "bar",
|
1270
|
+
"Bar": "foo"
|
1271
|
+
},
|
1272
|
+
"body": {
|
1273
|
+
"some": "body"
|
1274
|
+
},
|
1275
|
+
"username": "username",
|
1276
|
+
"password": "password"
|
1277
|
+
}
|
1278
|
+
}
|
1279
|
+
},
|
1280
|
+
"response": {
|
1281
|
+
"status": 201,
|
1282
|
+
"headers": {
|
1283
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1284
|
+
},
|
1285
|
+
"body": {
|
1286
|
+
"_links": {
|
1287
|
+
"self": {
|
1288
|
+
"href": "http://localhost:1234/some-url",
|
1289
|
+
"title": "A title"
|
1290
|
+
}
|
1291
|
+
}
|
1292
|
+
},
|
1293
|
+
"matchingRules": {
|
1294
|
+
"$.body._links.self.href": {
|
1295
|
+
"match": "regex",
|
1296
|
+
"regex": "http:\\/\\/.*"
|
1297
|
+
},
|
1298
|
+
"$.body._links.self.title": {
|
1299
|
+
"match": "type"
|
1300
|
+
}
|
1301
|
+
}
|
1302
|
+
}
|
1303
|
+
},
|
1304
|
+
{
|
1305
|
+
"description": "a request to create a webhook with a non-JSON body for a consumer and provider",
|
1306
|
+
"providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",
|
1307
|
+
"request": {
|
1308
|
+
"method": "post",
|
1309
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
1310
|
+
"headers": {
|
1311
|
+
"Content-Type": "application/json",
|
1312
|
+
"Accept": "application/hal+json"
|
1313
|
+
},
|
1314
|
+
"body": {
|
1315
|
+
"events": [
|
1316
|
+
{
|
1317
|
+
"name": "contract_content_changed"
|
1318
|
+
}
|
1319
|
+
],
|
1320
|
+
"request": {
|
1321
|
+
"url": "https://webhook",
|
1322
|
+
"method": "POST",
|
1323
|
+
"headers": {
|
1324
|
+
"Foo": "bar",
|
1325
|
+
"Bar": "foo"
|
1326
|
+
},
|
1327
|
+
"body": "<xml></xml>",
|
1328
|
+
"username": "username",
|
1329
|
+
"password": "password"
|
1330
|
+
}
|
1331
|
+
}
|
1332
|
+
},
|
1333
|
+
"response": {
|
1334
|
+
"status": 201,
|
1335
|
+
"headers": {
|
1336
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1337
|
+
},
|
1338
|
+
"body": {
|
1339
|
+
"_links": {
|
1340
|
+
"self": {
|
1341
|
+
"href": "http://localhost:1234/some-url",
|
1342
|
+
"title": "A title"
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
},
|
1346
|
+
"matchingRules": {
|
1347
|
+
"$.body._links.self.href": {
|
1348
|
+
"match": "regex",
|
1349
|
+
"regex": "http:\\/\\/.*"
|
1350
|
+
},
|
1351
|
+
"$.body._links.self.title": {
|
1352
|
+
"match": "type"
|
1353
|
+
}
|
1354
|
+
}
|
1355
|
+
}
|
1356
|
+
},
|
1357
|
+
{
|
1358
|
+
"description": "an invalid request to create a webhook for a consumer and provider",
|
1359
|
+
"providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",
|
1360
|
+
"request": {
|
1361
|
+
"method": "post",
|
1362
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
1363
|
+
"headers": {
|
1364
|
+
"Content-Type": "application/json",
|
1365
|
+
"Accept": "application/hal+json"
|
1366
|
+
},
|
1367
|
+
"body": {
|
1368
|
+
"events": [
|
1369
|
+
{
|
1370
|
+
"name": "contract_content_changed"
|
1371
|
+
}
|
1372
|
+
],
|
1373
|
+
"request": {
|
1374
|
+
"url": null,
|
1375
|
+
"method": "POST",
|
1376
|
+
"headers": {
|
1377
|
+
"Foo": "bar",
|
1378
|
+
"Bar": "foo"
|
1379
|
+
},
|
1380
|
+
"body": {
|
1381
|
+
"some": "body"
|
1382
|
+
},
|
1383
|
+
"username": "username",
|
1384
|
+
"password": "password"
|
1385
|
+
}
|
1386
|
+
}
|
1387
|
+
},
|
1388
|
+
"response": {
|
1389
|
+
"status": 400,
|
1390
|
+
"headers": {
|
1391
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1392
|
+
},
|
1393
|
+
"body": {
|
1394
|
+
"errors": {
|
1395
|
+
"request.url": [
|
1396
|
+
"Some error"
|
1397
|
+
]
|
1398
|
+
}
|
1399
|
+
},
|
1400
|
+
"matchingRules": {
|
1401
|
+
"$.body.errors['request.url']": {
|
1402
|
+
"min": 1
|
1403
|
+
},
|
1404
|
+
"$.body.errors['request.url'][*].*": {
|
1405
|
+
"match": "type"
|
1406
|
+
}
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
},
|
1410
|
+
{
|
1411
|
+
"description": "a request to create a webhook for a consumer and provider",
|
1412
|
+
"providerState": "'Condor' does not exist in the pact-broker",
|
1413
|
+
"request": {
|
1414
|
+
"method": "post",
|
1415
|
+
"path": "/webhooks/provider/Pricing%20Service/consumer/Condor",
|
1416
|
+
"headers": {
|
1417
|
+
"Content-Type": "application/json",
|
1418
|
+
"Accept": "application/hal+json"
|
1419
|
+
},
|
1420
|
+
"body": {
|
1421
|
+
"events": [
|
1422
|
+
{
|
1423
|
+
"name": "contract_content_changed"
|
1424
|
+
}
|
1425
|
+
],
|
1426
|
+
"request": {
|
1427
|
+
"url": "https://webhook",
|
1428
|
+
"method": "POST",
|
1429
|
+
"headers": {
|
1430
|
+
"Foo": "bar",
|
1431
|
+
"Bar": "foo"
|
1432
|
+
},
|
1433
|
+
"body": {
|
1434
|
+
"some": "body"
|
1435
|
+
},
|
1436
|
+
"username": "username",
|
1437
|
+
"password": "password"
|
1438
|
+
}
|
1439
|
+
}
|
1440
|
+
},
|
1441
|
+
"response": {
|
1442
|
+
"status": 404,
|
1443
|
+
"headers": {
|
1444
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1445
|
+
}
|
1446
|
+
}
|
1447
|
+
},
|
1448
|
+
{
|
1449
|
+
"description": "a request for the index resource",
|
1450
|
+
"request": {
|
1451
|
+
"method": "get",
|
1452
|
+
"path": "/",
|
1453
|
+
"headers": {
|
1454
|
+
"Accept": "application/hal+json"
|
1455
|
+
}
|
1456
|
+
},
|
1457
|
+
"response": {
|
1458
|
+
"status": 200,
|
1459
|
+
"headers": {
|
1460
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1461
|
+
},
|
1462
|
+
"body": {
|
1463
|
+
"_links": {
|
1464
|
+
"pb:webhooks": {
|
1465
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-WEBHOOKS"
|
1466
|
+
}
|
1467
|
+
}
|
1468
|
+
},
|
1469
|
+
"matchingRules": {
|
1470
|
+
"$.body._links.pb:webhooks.href": {
|
1471
|
+
"match": "regex",
|
1472
|
+
"regex": "http:\\/\\/.*"
|
1473
|
+
}
|
1474
|
+
}
|
1475
|
+
}
|
1476
|
+
},
|
1477
|
+
{
|
1478
|
+
"description": "a request to create a webhook with a JSON body for a consumer",
|
1479
|
+
"providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",
|
1480
|
+
"request": {
|
1481
|
+
"method": "post",
|
1482
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
1483
|
+
"headers": {
|
1484
|
+
"Content-Type": "application/json",
|
1485
|
+
"Accept": "application/hal+json"
|
1486
|
+
},
|
1487
|
+
"body": {
|
1488
|
+
"events": [
|
1489
|
+
{
|
1490
|
+
"name": "contract_content_changed"
|
1491
|
+
}
|
1492
|
+
],
|
1493
|
+
"request": {
|
1494
|
+
"url": "https://webhook",
|
1495
|
+
"method": "POST",
|
1496
|
+
"headers": {
|
1497
|
+
"Foo": "bar",
|
1498
|
+
"Bar": "foo"
|
1499
|
+
},
|
1500
|
+
"body": {
|
1501
|
+
"some": "body"
|
1502
|
+
},
|
1503
|
+
"username": "username",
|
1504
|
+
"password": "password"
|
1505
|
+
},
|
1506
|
+
"consumer": {
|
1507
|
+
"name": "Condor"
|
1508
|
+
}
|
1509
|
+
}
|
1510
|
+
},
|
1511
|
+
"response": {
|
1512
|
+
"status": 201,
|
1513
|
+
"headers": {
|
1514
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1515
|
+
},
|
1516
|
+
"body": {
|
1517
|
+
"_links": {
|
1518
|
+
"self": {
|
1519
|
+
"href": "http://localhost:1234/some-url",
|
1520
|
+
"title": "A title"
|
1521
|
+
}
|
1522
|
+
}
|
1523
|
+
},
|
1524
|
+
"matchingRules": {
|
1525
|
+
"$.body._links.self.href": {
|
1526
|
+
"match": "regex",
|
1527
|
+
"regex": "http:\\/\\/.*"
|
1528
|
+
},
|
1529
|
+
"$.body._links.self.title": {
|
1530
|
+
"match": "type"
|
1531
|
+
}
|
1532
|
+
}
|
1533
|
+
}
|
1534
|
+
},
|
1535
|
+
{
|
1536
|
+
"description": "a request to create a webhook with a JSON body for a consumer that does not exist",
|
1537
|
+
"request": {
|
1538
|
+
"method": "post",
|
1539
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
1540
|
+
"headers": {
|
1541
|
+
"Content-Type": "application/json",
|
1542
|
+
"Accept": "application/hal+json"
|
1543
|
+
},
|
1544
|
+
"body": {
|
1545
|
+
"events": [
|
1546
|
+
{
|
1547
|
+
"name": "contract_content_changed"
|
1548
|
+
}
|
1549
|
+
],
|
1550
|
+
"request": {
|
1551
|
+
"url": "https://webhook",
|
1552
|
+
"method": "POST",
|
1553
|
+
"headers": {
|
1554
|
+
"Foo": "bar",
|
1555
|
+
"Bar": "foo"
|
1556
|
+
},
|
1557
|
+
"body": {
|
1558
|
+
"some": "body"
|
1559
|
+
},
|
1560
|
+
"username": "username",
|
1561
|
+
"password": "password"
|
1562
|
+
},
|
1563
|
+
"consumer": {
|
1564
|
+
"name": "Condor"
|
1565
|
+
}
|
1566
|
+
}
|
1567
|
+
},
|
1568
|
+
"response": {
|
1569
|
+
"status": 400,
|
1570
|
+
"headers": {
|
1571
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1572
|
+
},
|
1573
|
+
"body": {
|
1574
|
+
"errors": {
|
1575
|
+
"consumer.name": [
|
1576
|
+
"Some error"
|
1577
|
+
]
|
1578
|
+
}
|
1579
|
+
},
|
1580
|
+
"matchingRules": {
|
1581
|
+
"$.body.errors['consumer.name']": {
|
1582
|
+
"min": 1
|
1583
|
+
},
|
1584
|
+
"$.body.errors['consumer.name'][*].*": {
|
1585
|
+
"match": "type"
|
1586
|
+
}
|
1587
|
+
}
|
1588
|
+
}
|
1589
|
+
},
|
1590
|
+
{
|
1591
|
+
"description": "a request to create a webhook with a JSON body for a provider",
|
1592
|
+
"providerState": "the 'Pricing Service' and 'Condor' already exist in the pact-broker",
|
1593
|
+
"request": {
|
1594
|
+
"method": "post",
|
1595
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
1596
|
+
"headers": {
|
1597
|
+
"Content-Type": "application/json",
|
1598
|
+
"Accept": "application/hal+json"
|
1599
|
+
},
|
1600
|
+
"body": {
|
1601
|
+
"events": [
|
1602
|
+
{
|
1603
|
+
"name": "contract_content_changed"
|
1604
|
+
}
|
1605
|
+
],
|
1606
|
+
"request": {
|
1607
|
+
"url": "https://webhook",
|
1608
|
+
"method": "POST",
|
1609
|
+
"headers": {
|
1610
|
+
"Foo": "bar",
|
1611
|
+
"Bar": "foo"
|
1612
|
+
},
|
1613
|
+
"body": {
|
1614
|
+
"some": "body"
|
1615
|
+
},
|
1616
|
+
"username": "username",
|
1617
|
+
"password": "password"
|
1618
|
+
},
|
1619
|
+
"provider": {
|
1620
|
+
"name": "Pricing Service"
|
1621
|
+
}
|
1622
|
+
}
|
1623
|
+
},
|
1624
|
+
"response": {
|
1625
|
+
"status": 201,
|
1626
|
+
"headers": {
|
1627
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1628
|
+
},
|
1629
|
+
"body": {
|
1630
|
+
"_links": {
|
1631
|
+
"self": {
|
1632
|
+
"href": "http://localhost:1234/some-url",
|
1633
|
+
"title": "A title"
|
1634
|
+
}
|
1635
|
+
}
|
1636
|
+
},
|
1637
|
+
"matchingRules": {
|
1638
|
+
"$.body._links.self.href": {
|
1639
|
+
"match": "regex",
|
1640
|
+
"regex": "http:\\/\\/.*"
|
1641
|
+
},
|
1642
|
+
"$.body._links.self.title": {
|
1643
|
+
"match": "type"
|
1644
|
+
}
|
1645
|
+
}
|
1646
|
+
}
|
1647
|
+
},
|
1648
|
+
{
|
1649
|
+
"description": "a request to create a global webhook with a JSON body",
|
1650
|
+
"request": {
|
1651
|
+
"method": "post",
|
1652
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
|
1653
|
+
"headers": {
|
1654
|
+
"Content-Type": "application/json",
|
1655
|
+
"Accept": "application/hal+json"
|
1656
|
+
},
|
1657
|
+
"body": {
|
1658
|
+
"events": [
|
1659
|
+
{
|
1660
|
+
"name": "contract_content_changed"
|
1661
|
+
}
|
1662
|
+
],
|
1663
|
+
"request": {
|
1664
|
+
"url": "https://webhook",
|
1665
|
+
"method": "POST",
|
1666
|
+
"headers": {
|
1667
|
+
"Foo": "bar",
|
1668
|
+
"Bar": "foo"
|
1669
|
+
},
|
1670
|
+
"body": {
|
1671
|
+
"some": "body"
|
1672
|
+
},
|
1673
|
+
"username": "username",
|
1674
|
+
"password": "password"
|
1675
|
+
}
|
1676
|
+
}
|
1677
|
+
},
|
1678
|
+
"response": {
|
1679
|
+
"status": 201,
|
1680
|
+
"headers": {
|
1681
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
1682
|
+
},
|
1683
|
+
"body": {
|
1684
|
+
"_links": {
|
1685
|
+
"self": {
|
1686
|
+
"href": "http://localhost:1234/some-url",
|
1687
|
+
"title": "A title"
|
1688
|
+
}
|
1689
|
+
}
|
1690
|
+
},
|
1691
|
+
"matchingRules": {
|
1692
|
+
"$.body._links.self.href": {
|
1693
|
+
"match": "regex",
|
1694
|
+
"regex": "http:\\/\\/.*"
|
1695
|
+
},
|
1696
|
+
"$.body._links.self.title": {
|
1697
|
+
"match": "type"
|
1698
|
+
}
|
1699
|
+
}
|
1700
|
+
}
|
1211
1701
|
}
|
1212
1702
|
],
|
1213
1703
|
"metadata": {
|