pact_broker 2.32.0 → 2.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +3 -0
- data/CHANGELOG.md +18 -0
- data/config/database.yml +5 -8
- data/db/migrations/20190510_set_version_sequence.rb +1 -0
- data/db/migrations/20190602_add_headers_column_to_webhooks.rb +6 -0
- data/db/migrations/20190603_migrate_webhook_headers.rb +10 -0
- data/lib/pact_broker/api/resources/index.rb +12 -0
- data/lib/pact_broker/api/resources/pact.rb +1 -1
- data/lib/pact_broker/api/resources/verifications.rb +1 -1
- data/lib/pact_broker/api/resources/webhook_execution.rb +1 -1
- data/lib/pact_broker/certificates/certificate.rb +1 -1
- data/lib/pact_broker/config/setting.rb +1 -1
- data/lib/pact_broker/db/data_migrations/migrate_webhook_headers.rb +30 -0
- data/lib/pact_broker/domain/pacticipant.rb +1 -1
- data/lib/pact_broker/domain/verification.rb +1 -1
- data/lib/pact_broker/domain/version.rb +1 -1
- data/lib/pact_broker/domain/webhook.rb +27 -1
- data/lib/pact_broker/domain/webhook_request.rb +9 -146
- data/lib/pact_broker/integrations/integration.rb +7 -0
- data/lib/pact_broker/matrix/repository.rb +0 -1
- data/lib/pact_broker/matrix/row.rb +58 -17
- data/lib/pact_broker/pacts/pact_publication.rb +8 -1
- data/lib/pact_broker/pacts/pact_version.rb +1 -1
- data/lib/pact_broker/pacts/repository.rb +5 -8
- data/lib/pact_broker/repositories/helpers.rb +5 -4
- data/lib/pact_broker/test/test_data_builder.rb +2 -2
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/latest_version.rb +10 -0
- data/lib/pact_broker/webhooks/execution.rb +1 -1
- data/lib/pact_broker/webhooks/http_request_with_redacted_headers.rb +21 -0
- data/lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb +21 -0
- data/lib/pact_broker/webhooks/job.rb +2 -2
- data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +86 -0
- data/lib/pact_broker/webhooks/render.rb +10 -71
- data/lib/pact_broker/webhooks/repository.rb +2 -9
- data/lib/pact_broker/webhooks/service.rb +5 -5
- data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -1
- data/lib/pact_broker/webhooks/webhook.rb +9 -30
- data/lib/pact_broker/webhooks/webhook_event.rb +1 -1
- data/lib/pact_broker/{domain → webhooks}/webhook_execution_result.rb +6 -5
- data/lib/pact_broker/webhooks/webhook_request_logger.rb +105 -0
- data/lib/pact_broker/webhooks/webhook_request_template.rb +7 -6
- data/pact_broker.gemspec +1 -0
- data/script/docker/db-restore.sh +5 -0
- data/script/docker/db-rm.sh +3 -0
- data/script/docker/db-start.sh +7 -0
- data/script/import-pg-database.sh +5 -0
- data/script/seed.rb +1 -1
- data/spec/features/execute_webhook_spec.rb +1 -1
- data/spec/features/publish_verification_spec.rb +1 -1
- data/spec/integration/webhooks/certificate_spec.rb +4 -6
- data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/verifications_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +1 -1
- data/spec/lib/pact_broker/db/data_migrations/migrate_webhook_headers_spec.rb +78 -0
- data/spec/lib/pact_broker/domain/webhook_request_spec.rb +8 -163
- data/spec/lib/pact_broker/domain/webhook_spec.rb +45 -8
- data/spec/lib/pact_broker/matrix/repository_spec.rb +24 -0
- data/spec/lib/pact_broker/pacticipants/find_potential_duplicate_pacticipant_names_spec.rb +4 -4
- data/spec/lib/pact_broker/pacts/pact_publication_spec.rb +60 -0
- data/spec/lib/pact_broker/webhooks/job_spec.rb +3 -3
- data/spec/lib/pact_broker/webhooks/render_spec.rb +22 -7
- data/spec/lib/pact_broker/webhooks/repository_spec.rb +24 -24
- data/spec/lib/pact_broker/webhooks/service_spec.rb +5 -5
- data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +197 -0
- data/spec/lib/pact_broker/webhooks/webhook_request_template_spec.rb +13 -4
- data/spec/support/database.rb +1 -1
- data/spec/support/ssl_pact_broker_server.rb +46 -0
- data/tasks/database.rb +12 -0
- data/tasks/db.rake +26 -6
- data/tasks/docker_database.rb +25 -0
- metadata +35 -3
@@ -19,9 +19,6 @@ module PactBroker
|
|
19
19
|
db_webhook = Webhook.from_domain webhook, consumer, provider
|
20
20
|
db_webhook.uuid = uuid
|
21
21
|
db_webhook.save
|
22
|
-
webhook.request.headers.each_pair do | name, value |
|
23
|
-
db_webhook.add_header PactBroker::Webhooks::WebhookHeader.from_domain(name, value, db_webhook.id)
|
24
|
-
end
|
25
22
|
(webhook.events || []).each do | webhook_event |
|
26
23
|
db_webhook.add_event(webhook_event)
|
27
24
|
end
|
@@ -34,14 +31,10 @@ module PactBroker
|
|
34
31
|
|
35
32
|
def update_by_uuid uuid, webhook
|
36
33
|
existing_webhook = Webhook.find(uuid: uuid)
|
37
|
-
existing_webhook.consumer_id = pacticipant_repository.find_by_name(webhook.consumer.name).id
|
38
|
-
existing_webhook.provider_id = pacticipant_repository.find_by_name(webhook.provider.name).id
|
34
|
+
existing_webhook.consumer_id = webhook.consumer ? pacticipant_repository.find_by_name(webhook.consumer.name).id : nil
|
35
|
+
existing_webhook.provider_id = webhook.provider ? pacticipant_repository.find_by_name(webhook.provider.name).id : nil
|
39
36
|
existing_webhook.update_from_domain(webhook).save
|
40
|
-
existing_webhook.headers.collect(&:delete)
|
41
37
|
existing_webhook.events.collect(&:delete)
|
42
|
-
webhook.request.headers.each_pair do | name, value |
|
43
|
-
existing_webhook.add_header PactBroker::Webhooks::WebhookHeader.from_domain(name, value, existing_webhook.id)
|
44
|
-
end
|
45
38
|
(webhook.events || []).each do | webhook_event |
|
46
39
|
existing_webhook.add_event(webhook_event)
|
47
40
|
end
|
@@ -68,10 +68,10 @@ module PactBroker
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.test_execution webhook, options
|
71
|
-
|
71
|
+
logging_options = options[:logging_options].merge(
|
72
72
|
failure_log_message: "Webhook execution failed",
|
73
73
|
)
|
74
|
-
merged_options = options.merge(
|
74
|
+
merged_options = options.merge(logging_options: logging_options)
|
75
75
|
verification = nil
|
76
76
|
if webhook.trigger_on_provider_verification_published?
|
77
77
|
verification = verification_service.search_for_latest(webhook.consumer_name, webhook.provider_name) || PactBroker::Verifications::PlaceholderVerification.new
|
@@ -84,8 +84,8 @@ module PactBroker
|
|
84
84
|
# # TODO delete?
|
85
85
|
# def self.execute_webhook_now webhook, pact, verification = nil
|
86
86
|
# triggered_webhook = webhook_repository.create_triggered_webhook(next_uuid, webhook, pact, verification, USER)
|
87
|
-
#
|
88
|
-
# webhook_execution_result = execute_triggered_webhook_now triggered_webhook,
|
87
|
+
# logging_options = { failure_log_message: "Webhook execution failed"}
|
88
|
+
# webhook_execution_result = execute_triggered_webhook_now triggered_webhook, logging_options
|
89
89
|
# if webhook_execution_result.success?
|
90
90
|
# webhook_repository.update_triggered_webhook_status triggered_webhook, TriggeredWebhook::STATUS_SUCCESS
|
91
91
|
# else
|
@@ -135,7 +135,7 @@ module PactBroker
|
|
135
135
|
job_data = {
|
136
136
|
triggered_webhook: triggered_webhook,
|
137
137
|
webhook_context: options.fetch(:webhook_context),
|
138
|
-
|
138
|
+
logging_options: options.fetch(:logging_options),
|
139
139
|
database_connector: options.fetch(:database_connector)
|
140
140
|
}
|
141
141
|
# Delay slightly to make sure the request transaction has finished before we execute the webhook
|
@@ -104,7 +104,7 @@ end
|
|
104
104
|
|
105
105
|
# Table: triggered_webhooks
|
106
106
|
# Columns:
|
107
|
-
# id | integer | PRIMARY KEY
|
107
|
+
# id | integer | PRIMARY KEY DEFAULT nextval('triggered_webhooks_id_seq'::regclass)
|
108
108
|
# trigger_uuid | text | NOT NULL
|
109
109
|
# trigger_type | text | NOT NULL
|
110
110
|
# pact_publication_id | integer | NOT NULL
|
@@ -7,11 +7,12 @@ module PactBroker
|
|
7
7
|
module Webhooks
|
8
8
|
class Webhook < Sequel::Model
|
9
9
|
set_primary_key :id
|
10
|
+
plugin :serialization, :json, :headers
|
11
|
+
plugin :timestamps, update_on_create: true
|
12
|
+
|
10
13
|
associate(:many_to_one, :provider, :class => "PactBroker::Domain::Pacticipant", :key => :provider_id, :primary_key => :id)
|
11
14
|
associate(:many_to_one, :consumer, :class => "PactBroker::Domain::Pacticipant", :key => :consumer_id, :primary_key => :id)
|
12
|
-
|
13
15
|
one_to_many :events, :class => "PactBroker::Webhooks::WebhookEvent", :reciprocal => :webhook
|
14
|
-
one_to_many :headers, :class => "PactBroker::Webhooks::WebhookHeader", :reciprocal => :webhook
|
15
16
|
|
16
17
|
dataset_module do
|
17
18
|
include PactBroker::Repositories::Helpers
|
@@ -21,11 +22,6 @@ module PactBroker
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
def before_destroy
|
25
|
-
WebhookHeader.where(webhook_id: id).destroy
|
26
|
-
super
|
27
|
-
end
|
28
|
-
|
29
25
|
def update_from_domain webhook
|
30
26
|
set(self.class.properties_hash_from_domain(webhook))
|
31
27
|
end
|
@@ -57,19 +53,13 @@ module PactBroker
|
|
57
53
|
end
|
58
54
|
|
59
55
|
def request_attributes
|
60
|
-
values.merge(headers:
|
56
|
+
values.merge(headers: headers, body: parsed_body, password: plain_text_password, uuid: uuid)
|
61
57
|
end
|
62
58
|
|
63
59
|
def plain_text_password
|
64
60
|
password.nil? ? nil : Base64.strict_decode64(password)
|
65
61
|
end
|
66
62
|
|
67
|
-
def parsed_headers
|
68
|
-
WebhookHeader.where(webhook_id: id).all.each_with_object({}) do | header, hash |
|
69
|
-
hash[header[:name]] = header[:value]
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
63
|
def parsed_body
|
74
64
|
if body && is_json_request_body
|
75
65
|
JSON.parse(body)
|
@@ -94,30 +84,17 @@ module PactBroker
|
|
94
84
|
password: not_plain_text_password(webhook.request.password),
|
95
85
|
enabled: webhook.enabled.nil? ? true : webhook.enabled,
|
96
86
|
body: (is_json_request_body ? webhook.request.body.to_json : webhook.request.body),
|
97
|
-
is_json_request_body: is_json_request_body
|
87
|
+
is_json_request_body: is_json_request_body,
|
88
|
+
headers: webhook.request.headers
|
98
89
|
}
|
99
90
|
end
|
100
91
|
end
|
101
|
-
|
102
|
-
Webhook.plugin :timestamps, update_on_create: true
|
103
|
-
|
104
|
-
class WebhookHeader < Sequel::Model
|
105
|
-
associate(:many_to_one, :webhook, :class => "PactBroker::Repositories::Webhook", :key => :webhook_id, :primary_key => :id)
|
106
|
-
|
107
|
-
def self.from_domain name, value, webhook_id
|
108
|
-
db_header = new
|
109
|
-
db_header.name = name
|
110
|
-
db_header.value = value
|
111
|
-
db_header.webhook_id = webhook_id
|
112
|
-
db_header
|
113
|
-
end
|
114
|
-
end
|
115
92
|
end
|
116
93
|
end
|
117
94
|
|
118
95
|
# Table: webhooks
|
119
96
|
# Columns:
|
120
|
-
# id | integer | PRIMARY KEY
|
97
|
+
# id | integer | PRIMARY KEY DEFAULT nextval('webhooks_id_seq'::regclass)
|
121
98
|
# uuid | text | NOT NULL
|
122
99
|
# method | text | NOT NULL
|
123
100
|
# url | text | NOT NULL
|
@@ -129,6 +106,8 @@ end
|
|
129
106
|
# updated_at | timestamp without time zone |
|
130
107
|
# username | text |
|
131
108
|
# password | text |
|
109
|
+
# enabled | boolean | DEFAULT true
|
110
|
+
# description | text |
|
132
111
|
# Indexes:
|
133
112
|
# webhooks_pkey | PRIMARY KEY btree (id)
|
134
113
|
# uq_webhook_uuid | UNIQUE btree (uuid)
|
@@ -38,7 +38,7 @@ end
|
|
38
38
|
|
39
39
|
# Table: webhook_events
|
40
40
|
# Columns:
|
41
|
-
# id | integer | PRIMARY KEY
|
41
|
+
# id | integer | PRIMARY KEY DEFAULT nextval('webhook_events_id_seq'::regclass)
|
42
42
|
# webhook_id | integer |
|
43
43
|
# name | text |
|
44
44
|
# created_at | timestamp without time zone | NOT NULL
|
@@ -1,12 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Domain
|
1
|
+
require 'pact_broker/webhooks/http_request_with_redacted_headers'
|
2
|
+
require 'pact_broker/webhooks/http_response_with_utf_8_safe_body'
|
4
3
|
|
4
|
+
module PactBroker
|
5
|
+
module Webhooks
|
5
6
|
class WebhookExecutionResult
|
6
7
|
|
7
8
|
def initialize request, response, logs, error = nil
|
8
|
-
@request = request
|
9
|
-
@response = response
|
9
|
+
@request = PactBroker::Webhooks::HttpRequestWithRedactedHeaders.new(request)
|
10
|
+
@response = response ? PactBroker::Webhooks::HttpResponseWithUtf8SafeBody.new(response) : nil
|
10
11
|
@logs = logs
|
11
12
|
@error = error
|
12
13
|
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'pact_broker/messages'
|
2
|
+
require 'pact_broker/logging'
|
3
|
+
require 'pact_broker/webhooks/http_request_with_redacted_headers'
|
4
|
+
require 'pact_broker/webhooks/http_response_with_utf_8_safe_body'
|
5
|
+
|
6
|
+
module PactBroker
|
7
|
+
module Webhooks
|
8
|
+
class WebhookRequestLogger
|
9
|
+
include PactBroker::Logging
|
10
|
+
|
11
|
+
attr_reader :execution_logger, :options
|
12
|
+
|
13
|
+
def initialize(options)
|
14
|
+
@log_stream = StringIO.new
|
15
|
+
@execution_logger = Logger.new(log_stream)
|
16
|
+
@options = options
|
17
|
+
end
|
18
|
+
|
19
|
+
def log(uuid, webhook_request, http_response, error)
|
20
|
+
safe_response = http_response ? HttpResponseWithUtf8SafeBody.new(http_response) : nil
|
21
|
+
log_request(webhook_request)
|
22
|
+
log_response(uuid, safe_response) if safe_response
|
23
|
+
log_error(uuid, error) if error
|
24
|
+
log_completion_message(success?(safe_response))
|
25
|
+
log_stream.string
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
attr_reader :log_stream
|
31
|
+
|
32
|
+
def log_request(webhook_request)
|
33
|
+
http_request = HttpRequestWithRedactedHeaders.new(webhook_request.http_request)
|
34
|
+
logger.info "Making webhook #{webhook_request.uuid} request #{http_request.method.upcase} URI=#{webhook_request.url} (headers and body in debug logs)"
|
35
|
+
logger.debug "Webhook #{webhook_request.uuid} request headers=#{http_request.to_hash}"
|
36
|
+
logger.debug "Webhook #{webhook_request.uuid} request body=#{http_request.body}"
|
37
|
+
|
38
|
+
execution_logger.info "HTTP/1.1 #{webhook_request.http_method.upcase} #{webhook_request.url}"
|
39
|
+
http_request.to_hash.each do | name, value |
|
40
|
+
execution_logger.info "#{name}: #{value.join(", ")}"
|
41
|
+
end
|
42
|
+
execution_logger.info(webhook_request.body) if webhook_request.body
|
43
|
+
end
|
44
|
+
|
45
|
+
def log_response uuid, response
|
46
|
+
log_response_to_application_logger(uuid, response)
|
47
|
+
if options.fetch(:show_response)
|
48
|
+
log_response_to_execution_logger(response)
|
49
|
+
else
|
50
|
+
execution_logger.info response_body_hidden_message
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def response_body_hidden_message
|
55
|
+
PactBroker::Messages.message('messages.response_body_hidden')
|
56
|
+
end
|
57
|
+
|
58
|
+
def log_response_to_application_logger uuid, response
|
59
|
+
logger.info "Received response for webhook #{uuid} status=#{response.code} (headers and body in debug logs)"
|
60
|
+
logger.debug "Webhook #{uuid} response headers=#{response.to_hash} "
|
61
|
+
logger.debug "Webhook #{uuid} response body=#{response.unsafe_body}"
|
62
|
+
end
|
63
|
+
|
64
|
+
def log_response_to_execution_logger response
|
65
|
+
execution_logger.info "HTTP/#{response.http_version} #{response.code} #{response.message}"
|
66
|
+
response.each_header do | name, value |
|
67
|
+
execution_logger.info "#{name}: #{value}"
|
68
|
+
end
|
69
|
+
|
70
|
+
if response.body
|
71
|
+
if response.unsafe_body?
|
72
|
+
execution_logger.debug "Note that invalid UTF-8 byte sequences were removed from response body before saving the logs"
|
73
|
+
end
|
74
|
+
execution_logger.info response.body
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def log_completion_message success
|
79
|
+
if options[:success_log_message] && success
|
80
|
+
execution_logger.info(options[:success_log_message])
|
81
|
+
logger.info(options[:success_log_message])
|
82
|
+
end
|
83
|
+
|
84
|
+
if options[:failure_log_message] && !success
|
85
|
+
execution_logger.info(options[:failure_log_message])
|
86
|
+
logger.info(options[:failure_log_message])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def log_error uuid, e
|
91
|
+
logger.info "Error executing webhook #{uuid} #{e.class.name} - #{e.message} #{e.backtrace.join("\n")}"
|
92
|
+
|
93
|
+
if options[:show_response]
|
94
|
+
execution_logger.error "Error executing webhook #{uuid} #{e.class.name} - #{e.message}"
|
95
|
+
else
|
96
|
+
execution_logger.error "Error executing webhook #{uuid}. #{response_body_hidden_message}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def success?(response)
|
101
|
+
!response.nil? && response.code.to_i < 300
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -28,25 +28,26 @@ module PactBroker
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def build(context)
|
31
|
+
template_params = PactBroker::Webhooks::PactAndVerificationParameters.new(context[:pact], context[:verification], context[:webhook_context]).to_hash
|
31
32
|
attributes = {
|
32
33
|
method: http_method,
|
33
|
-
url: build_url(
|
34
|
+
url: build_url(template_params),
|
34
35
|
headers: headers,
|
35
36
|
username: username,
|
36
37
|
password: password,
|
37
38
|
uuid: uuid,
|
38
|
-
body: build_body(
|
39
|
+
body: build_body(template_params)
|
39
40
|
}
|
40
41
|
PactBroker::Domain::WebhookRequest.new(attributes)
|
41
42
|
end
|
42
43
|
|
43
|
-
def build_url(
|
44
|
-
URI(PactBroker::Webhooks::Render.call(url,
|
44
|
+
def build_url(template_params)
|
45
|
+
URI(PactBroker::Webhooks::Render.call(url, template_params){ | value | CGI::escape(value) if !value.nil? } ).to_s
|
45
46
|
end
|
46
47
|
|
47
|
-
def build_body(
|
48
|
+
def build_body(template_params)
|
48
49
|
body_string = String === body ? body : body.to_json
|
49
|
-
PactBroker::Webhooks::Render.call(body_string,
|
50
|
+
PactBroker::Webhooks::Render.call(body_string, template_params)
|
50
51
|
end
|
51
52
|
|
52
53
|
def description
|
data/pact_broker.gemspec
CHANGED
data/script/seed.rb
CHANGED
@@ -44,7 +44,7 @@ webhook_body = {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
TestDataBuilder.new
|
47
|
-
.create_global_webhook(method: 'POST', url: "http://localhost:9292/pact-changed-webhook", body: webhook_body.to_json)
|
47
|
+
.create_global_webhook(method: 'POST', url: "http://localhost:9292/pact-changed-webhook", body: webhook_body.to_json, username: "foo", password: "bar")
|
48
48
|
.create_global_verification_webhook(method: 'POST', url: "http://localhost:9292/verification-published-webhook", body: webhook_body.to_json)
|
49
49
|
# .create_certificate(path: 'spec/fixtures/certificates/self-signed.badssl.com.pem')
|
50
50
|
# .create_consumer("Bethtest")
|
@@ -22,7 +22,7 @@ describe "Execute a webhook" do
|
|
22
22
|
stub_request(:post, /http/).with(body: expected_webhook_url).to_return(:status => 200, body: response_body)
|
23
23
|
end
|
24
24
|
|
25
|
-
let(:expected_webhook_url) { %r{http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/.*/metadata
|
25
|
+
let(:expected_webhook_url) { %r{http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/.*/metadata/.*} }
|
26
26
|
let(:response_body) { "webhook-response-body" }
|
27
27
|
|
28
28
|
it "performs the HTTP request" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'pact_broker/domain/verification'
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "Publishing a pact verification" do
|
4
4
|
|
5
5
|
let(:td) { TestDataBuilder.new }
|
6
6
|
let(:path) { "/pacts/provider/Provider/consumer/Consumer/pact-version/#{pact.pact_version_sha}/verification-results" }
|
@@ -22,13 +22,11 @@ describe "executing a webhook to a server with a self signed certificate" do
|
|
22
22
|
url: 'https://localhost:4444/')
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
subject { webhook_request.execute({ show_response: true }) }
|
25
|
+
subject { webhook_request.execute }
|
28
26
|
|
29
27
|
context "without the correct cacert" do
|
30
28
|
it "fails" do
|
31
|
-
expect
|
29
|
+
expect { subject }.to raise_error(OpenSSL::SSL::SSLError)
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
@@ -38,8 +36,8 @@ describe "executing a webhook to a server with a self signed certificate" do
|
|
38
36
|
end
|
39
37
|
|
40
38
|
it "succeeds" do
|
41
|
-
puts subject.
|
42
|
-
expect(subject.
|
39
|
+
puts subject.body unless subject.code == "200"
|
40
|
+
expect(subject.code).to eq "200"
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
@@ -8,7 +8,7 @@ module PactBroker
|
|
8
8
|
|
9
9
|
describe "to_json" do
|
10
10
|
|
11
|
-
let(:webhook_execution_result) { PactBroker::
|
11
|
+
let(:webhook_execution_result) { PactBroker::Webhooks::WebhookExecutionResult.new(request, response, logs, error)}
|
12
12
|
let(:logs) { "logs" }
|
13
13
|
let(:headers) { { "Something" => ["blah", "thing"]} }
|
14
14
|
let(:request) do
|