pact_broker 2.60.0 → 2.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +48 -0
  3. data/db/migrations/20200922_add_event_to_triggered_webhook.rb +5 -0
  4. data/lib/pact_broker/api.rb +2 -0
  5. data/lib/pact_broker/api/contracts/verifiable_pacts_query_schema.rb +37 -0
  6. data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +16 -0
  7. data/lib/pact_broker/api/decorators/triggered_webhook_decorator.rb +1 -0
  8. data/lib/pact_broker/api/decorators/verifiable_pact_decorator.rb +5 -5
  9. data/lib/pact_broker/api/pact_broker_urls.rb +19 -4
  10. data/lib/pact_broker/api/resources/all_webhooks.rb +1 -6
  11. data/lib/pact_broker/api/resources/can_i_deploy.rb +0 -4
  12. data/lib/pact_broker/api/resources/can_i_deploy_badge.rb +85 -0
  13. data/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version.rb +40 -0
  14. data/lib/pact_broker/api/resources/default_base_resource.rb +9 -0
  15. data/lib/pact_broker/api/resources/error_handler.rb +4 -4
  16. data/lib/pact_broker/api/resources/error_test.rb +4 -2
  17. data/lib/pact_broker/api/resources/group.rb +0 -4
  18. data/lib/pact_broker/api/resources/index.rb +1 -1
  19. data/lib/pact_broker/api/resources/integration.rb +0 -4
  20. data/lib/pact_broker/api/resources/integrations.rb +0 -4
  21. data/lib/pact_broker/api/resources/label.rb +0 -8
  22. data/lib/pact_broker/api/resources/latest_pact.rb +1 -5
  23. data/lib/pact_broker/api/resources/latest_pacts.rb +1 -5
  24. data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +0 -4
  25. data/lib/pact_broker/api/resources/matrix.rb +4 -0
  26. data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +4 -0
  27. data/lib/pact_broker/api/resources/metrics.rb +4 -0
  28. data/lib/pact_broker/api/resources/pact.rb +4 -8
  29. data/lib/pact_broker/api/resources/pact_content_diff.rb +4 -0
  30. data/lib/pact_broker/api/resources/pact_triggered_webhooks.rb +5 -1
  31. data/lib/pact_broker/api/resources/pact_versions.rb +5 -1
  32. data/lib/pact_broker/api/resources/pact_webhooks.rb +5 -1
  33. data/lib/pact_broker/api/resources/pact_webhooks_status.rb +5 -1
  34. data/lib/pact_broker/api/resources/pacticipant.rb +5 -9
  35. data/lib/pact_broker/api/resources/pacticipants.rb +0 -4
  36. data/lib/pact_broker/api/resources/pacticipants_for_label.rb +4 -0
  37. data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +4 -9
  38. data/lib/pact_broker/api/resources/provider_pacts.rb +1 -5
  39. data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +14 -7
  40. data/lib/pact_broker/api/resources/relationships.rb +4 -2
  41. data/lib/pact_broker/api/resources/tag.rb +5 -5
  42. data/lib/pact_broker/api/resources/tagged_pact_versions.rb +5 -2
  43. data/lib/pact_broker/api/resources/triggered_webhook_logs.rb +7 -5
  44. data/lib/pact_broker/api/resources/verification.rb +5 -5
  45. data/lib/pact_broker/api/resources/verification_triggered_webhooks.rb +6 -12
  46. data/lib/pact_broker/api/resources/verifications.rb +5 -5
  47. data/lib/pact_broker/api/resources/version.rb +11 -12
  48. data/lib/pact_broker/api/resources/versions.rb +5 -2
  49. data/lib/pact_broker/api/resources/webhook.rb +4 -0
  50. data/lib/pact_broker/api/resources/webhook_execution.rb +4 -0
  51. data/lib/pact_broker/api/resources/webhooks.rb +5 -1
  52. data/lib/pact_broker/app.rb +1 -1
  53. data/lib/pact_broker/badges/service.rb +12 -1
  54. data/lib/pact_broker/certificates/service.rb +2 -2
  55. data/lib/pact_broker/configuration.rb +12 -1
  56. data/lib/pact_broker/db.rb +14 -0
  57. data/lib/pact_broker/db/table_dependency_calculator.rb +45 -0
  58. data/lib/pact_broker/doc/views/pacticipant/can-i-deploy-badge.markdown +9 -0
  59. data/lib/pact_broker/domain/webhook_request.rb +3 -1
  60. data/lib/pact_broker/pacts/build_verifiable_pact_notices.rb +7 -4
  61. data/lib/pact_broker/test/test_data_builder.rb +1 -1
  62. data/lib/pact_broker/ui/app.rb +6 -0
  63. data/lib/pact_broker/ui/controllers/can_i_deploy.rb +42 -0
  64. data/lib/pact_broker/ui/controllers/matrix.rb +3 -34
  65. data/lib/pact_broker/ui/helpers/matrix_helper.rb +40 -0
  66. data/lib/pact_broker/ui/views/matrix/show.haml +1 -1
  67. data/lib/pact_broker/version.rb +1 -1
  68. data/lib/pact_broker/webhooks/repository.rb +3 -2
  69. data/lib/pact_broker/webhooks/service.rb +2 -2
  70. data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -3
  71. data/lib/pact_broker/webhooks/webhook_event.rb +1 -2
  72. data/script/seed.rb +39 -17
  73. data/spec/features/get_can_i_deploy_badge_spec.rb +13 -0
  74. data/spec/features/get_matrix_badge_spec.rb +1 -1
  75. data/spec/features/get_provider_pacts_for_verification_spec.rb +26 -0
  76. data/spec/lib/pact_broker/api/contracts/verifiable_pacts_query_schema_spec.rb +97 -0
  77. data/spec/lib/pact_broker/api/decorators/pact_webhooks_status_decorator_spec.rb +2 -1
  78. data/spec/lib/pact_broker/api/decorators/triggered_webhook_decorator_spec.rb +3 -1
  79. data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +15 -0
  80. data/spec/lib/pact_broker/api/resources/can_i_deploy_badge_spec.rb +80 -0
  81. data/spec/lib/pact_broker/api/resources/can_i_deploy_pacticipant_version_spec.rb +31 -0
  82. data/spec/lib/pact_broker/api/resources/default_base_resource_spec.rb +10 -5
  83. data/spec/lib/pact_broker/api/resources/provider_pacts_for_verification_spec.rb +37 -7
  84. data/spec/lib/pact_broker/api/resources/verification_triggered_webhooks_spec.rb +0 -1
  85. data/spec/lib/pact_broker/badges/service_spec.rb +7 -1
  86. data/spec/lib/pact_broker/certificates/service_spec.rb +3 -3
  87. data/spec/lib/pact_broker/ui/controllers/can_i_deploy_spec.rb +26 -0
  88. data/spec/lib/pact_broker/webhooks/repository_spec.rb +3 -2
  89. data/spec/lib/pact_broker/webhooks/service_spec.rb +2 -2
  90. data/tasks/database.rb +1 -0
  91. data/tasks/database/table_dependency_calculator.rb +4 -41
  92. metadata +20 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbaaee53f1641458eb110582a96bf0be98d7078ef1fa681ffee934c6e8007347
4
- data.tar.gz: 84a2f6e6785acc85cf7053b86a54574746cb06de917bd11a0dff23403046aff5
3
+ metadata.gz: 3fee7d96bde4fc04adb41fe041a124e81c9b371336f9308f92c918a2fb4ca914
4
+ data.tar.gz: 3706e5b3a8fbf6db31c748658a1b0f22713f872889757844c9506250b2cefa54
5
5
  SHA512:
6
- metadata.gz: de93223c0a1d52af6563bf31b2ae733c41b6cec65afb4a61be741d78f47cf18484ee2fa292c9660b8db09cb3a1a66c549decb145a0b7a036477a9ac73b70f8c6
7
- data.tar.gz: 04d3a59551f4fe9f46af8b65cd6c0dc3326ac86a594298eb22d529e33f6a98e39cdf6f9c682bd69bd9bbb85f4f290fe3e2f706d71cfa766b61def28c0dbd7bfc
6
+ metadata.gz: d1a1046845fb3832062d675ebfa1d49e0fa62ac6ea8acb8edb6c706b53e66888b72a243bc16e94842b89b4b349adf3ac22c3f35f043a75538f9dea7f3d28122a
7
+ data.tar.gz: fdad352fd207e05717eb127ec0ad0c35de8465b4dfed9a6cdcf862bc5d6f169bf15975a932c8cd355716b90ba3291552fadc35aab1768710179f330592fd5166
@@ -1,3 +1,51 @@
1
+ <a name="v2.64.0"></a>
2
+ ### v2.64.0 (2020-09-25)
3
+
4
+ #### Features
5
+
6
+ * add API endpoint for can-i-deploy for latest tagged pacticipant version ([88fdc60a](/../../commit/88fdc60a))
7
+ * render matrix UI page for can-i-deploy endpoint ([463e9cfd](/../../commit/463e9cfd))
8
+ * change text on can-i-deploy badge ([f9e183e9](/../../commit/f9e183e9))
9
+
10
+ <a name="v2.63.0"></a>
11
+ ### v2.63.0 (2020-09-25)
12
+
13
+ #### Features
14
+
15
+ * allow label of can-i-deploy badge to be customised by setting the label query parameter ([ed544f94](/../../commit/ed544f94))
16
+ * add badges for can-i-deploy ([887a9ca3](/../../commit/887a9ca3))
17
+
18
+ <a name="v2.62.0"></a>
19
+ ### v2.62.0 (2020-09-23)
20
+
21
+ #### Features
22
+
23
+ * **webhooks**
24
+ * remove user-agent and accept-encoding headers which the Ruby HTTP library adds by default ([ef25b88c](/../../commit/ef25b88c))
25
+
26
+ * add event name to triggered webhook ([ecce16fd](/../../commit/ecce16fd))
27
+
28
+ #### Bug Fixes
29
+
30
+ * **webhooks**
31
+ * use path to initialise http request, rather than full URL ([ecbac9a6](/../../commit/ecbac9a6))
32
+
33
+ * gracefully handle corrupt webhook metadata in pact URL ([ba94c355](/../../commit/ba94c355))
34
+
35
+ <a name="v2.61.0"></a>
36
+ ### v2.61.0 (2020-09-12)
37
+
38
+ #### Features
39
+
40
+ * add back support for GET requests to the 'pacts for verification' API with a deprecation notice in the response ([8f45cc9f](/../../commit/8f45cc9f))
41
+
42
+ <a name="v2.60.1"></a>
43
+ ### v2.60.1 (2020-09-10)
44
+
45
+ #### Bug Fixes
46
+
47
+ * href for beta:provider-pacts-for-verification ([3949fdd1](/../../commit/3949fdd1))
48
+
1
49
  <a name="v2.60.0"></a>
2
50
  ### v2.60.0 (2020-09-08)
3
51
 
@@ -0,0 +1,5 @@
1
+ Sequel.migration do
2
+ change do
3
+ add_column(:triggered_webhooks, :event_name, String)
4
+ end
5
+ end
@@ -71,6 +71,8 @@ module PactBroker
71
71
  add ['pacticipants', :pacticipant_name, 'versions'], Api::Resources::Versions, {resource_name: "pacticipant_versions"}
72
72
  add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number], Api::Resources::Version, {resource_name: "pacticipant_version"}
73
73
  add ['pacticipants', :pacticipant_name, 'latest-version', :tag], Api::Resources::Version, {resource_name: "latest_tagged_pacticipant_version"}
74
+ add ['pacticipants', :pacticipant_name, 'latest-version', :tag, 'can-i-deploy', 'to', :to], Api::Resources::CanIDeployPacticipantVersion, { resource_name: "can_i_deploy_latest_tagged_version" }
75
+ add ['pacticipants', :pacticipant_name, 'latest-version', :tag, 'can-i-deploy', 'to', :to, 'badge'], Api::Resources::CanIDeployBadge, { resource_name: "can_i_deploy_badge" }
74
76
  add ['pacticipants', :pacticipant_name, 'latest-version'], Api::Resources::Version, {resource_name: "latest_pacticipant_version"}
75
77
  add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number, 'tags', :tag_name], Api::Resources::Tag, {resource_name: "pacticipant_version_tag"}
76
78
  add ['pacticipants', :pacticipant_name, 'labels', :label_name], Api::Resources::Label, {resource_name: "pacticipant_label"}
@@ -0,0 +1,37 @@
1
+ require 'dry-validation'
2
+ require 'pact_broker/api/contracts/dry_validation_workarounds'
3
+ require 'pact_broker/api/contracts/dry_validation_predicates'
4
+
5
+ module PactBroker
6
+ module Api
7
+ module Contracts
8
+ class VerifiablePactsQuerySchema
9
+ extend DryValidationWorkarounds
10
+ using PactBroker::HashRefinements
11
+
12
+ SCHEMA = Dry::Validation.Schema do
13
+ configure do
14
+ predicates(DryValidationPredicates)
15
+ config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__)
16
+ end
17
+ optional(:provider_version_tags).maybe(:array?)
18
+ optional(:consumer_version_selectors).each do
19
+ schema do
20
+ required(:tag).filled(:str?)
21
+ optional(:latest).filled(included_in?: ["true", "false"])
22
+ optional(:fallback_tag).filled(:str?)
23
+ optional(:consumer).filled(:str?, :not_blank?)
24
+ end
25
+ end
26
+ optional(:include_pending_status).filled(included_in?: ["true", "false"])
27
+ optional(:include_wip_pacts_since).filled(:date?)
28
+ end
29
+
30
+ def self.call(params)
31
+ select_first_message(flatten_indexed_messages(SCHEMA.call(params&.symbolize_keys).messages(full: true)))
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -58,6 +58,22 @@ module PactBroker
58
58
  }
59
59
  end
60
60
 
61
+ link :'pb:can-i-deploy-badge' do | options |
62
+ {
63
+ title: "Can I Deploy #{represented.name} badge",
64
+ href: templated_can_i_deploy_badge_url(represented.name, options[:base_url]),
65
+ templated: true
66
+ }
67
+ end
68
+
69
+ curies do | options |
70
+ [{
71
+ name: :pb,
72
+ href: options[:base_url] + '/doc/{rel}?context=pacticipant',
73
+ templated: true
74
+ }]
75
+ end
76
+
61
77
  def to_hash options
62
78
  h = super
63
79
  dasherized = DasherizedVersionDecorator.new(represented).to_hash(options)
@@ -9,6 +9,7 @@ module PactBroker
9
9
  property :number_of_attempts_made, as: :attemptsMade
10
10
  property :number_of_attempts_remaining, as: :attemptsRemaining
11
11
  property :trigger_type, as: :triggerType
12
+ property :event_name, as: :eventName
12
13
 
13
14
  property :created_at, as: :triggeredAt
14
15
 
@@ -14,14 +14,14 @@ module PactBroker
14
14
 
15
15
  property :pending,
16
16
  if: ->(context) { context[:options][:user_options][:include_pending_status] }
17
- property :wip, if: -> (context) { context[:represented].wip }
18
-
19
- property :notices, getter: -> (context) { context[:decorator].notices(context[:options][:user_options]) }
20
- property :noteToDevelopers, getter: -> (_) { "Please print out the text from the 'notices' rather than using the inclusionReason and the pendingReason fields. These will be removed when this API moves out of beta."}
17
+ property :wip,
18
+ if: -> (context) { context[:represented].wip }
19
+ property :notices,
20
+ getter: -> (context) { context[:decorator].notices(context[:options][:user_options]) }
21
21
 
22
22
  def notices(user_options)
23
23
  pact_url = pact_version_url(represented, user_options[:base_url])
24
- PactBroker::Pacts::BuildVerifiablePactNotices.call(represented, pact_url, include_pending_status: user_options[:include_pending_status])
24
+ PactBroker::Pacts::BuildVerifiablePactNotices.call(represented, pact_url, user_options)
25
25
  end
26
26
  end
27
27
 
@@ -1,11 +1,13 @@
1
1
  require 'erb'
2
2
  require 'pact_broker/pacts/metadata'
3
+ require 'pact_broker/logging'
3
4
 
4
5
  module PactBroker
5
6
  module Api
6
7
  module PactBrokerUrls
7
8
 
8
9
  include PactBroker::Pacts::Metadata
10
+ include PactBroker::Logging
9
11
  # TODO make base_url the last and optional argument for all methods, defaulting to ''
10
12
 
11
13
  extend self
@@ -70,8 +72,13 @@ module PactBroker
70
72
 
71
73
  def decode_webhook_metadata(metadata)
72
74
  if metadata
73
- Rack::Utils.parse_nested_query(Base64.strict_decode64(metadata)).each_with_object({}) do | (k, v), new_hash |
74
- new_hash[k.to_sym] = v
75
+ begin
76
+ Rack::Utils.parse_nested_query(Base64.strict_decode64(metadata)).each_with_object({}) do | (k, v), new_hash |
77
+ new_hash[k.to_sym] = v
78
+ end
79
+ rescue StandardError => e
80
+ logger.warn("Exception parsing webhook metadata: #{metadata}", e)
81
+ {}
75
82
  end
76
83
  else
77
84
  {}
@@ -190,11 +197,19 @@ module PactBroker
190
197
  end
191
198
 
192
199
  def templated_tag_url_for_pacticipant pacticipant_name, base_url = ""
193
- pacticipant_url_from_params({pacticipant_name: pacticipant_name}, base_url) + "/versions/{version}/tags/{tag}"
200
+ pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/versions/{version}/tags/{tag}"
194
201
  end
195
202
 
196
203
  def templated_label_url_for_pacticipant pacticipant_name, base_url = ""
197
- pacticipant_url_from_params({pacticipant_name: pacticipant_name}, base_url) + "/labels/{label}"
204
+ pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/labels/{label}"
205
+ end
206
+
207
+ def templated_can_i_deploy_url pacticipant_name, base_url = ""
208
+ pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/latest-version/{tag}/can-i-deploy/to/{environmentTag}"
209
+ end
210
+
211
+ def templated_can_i_deploy_badge_url pacticipant_name, base_url = ""
212
+ templated_can_i_deploy_url(pacticipant_name, base_url) + "/badge"
198
213
  end
199
214
 
200
215
  def label_url label, base_url
@@ -46,12 +46,7 @@ module PactBroker
46
46
  end
47
47
 
48
48
  def policy_name
49
- :'webhooks::webooks'
50
- end
51
-
52
- def policy_record
53
- # Note: consumer and provider not yet set on new webhook
54
- request.post? ? webhook : webhooks
49
+ :'webhooks::webhooks'
55
50
  end
56
51
 
57
52
  private
@@ -25,10 +25,6 @@ module PactBroker
25
25
  :'matrix::can_i_deploy'
26
26
  end
27
27
 
28
- def policy_record
29
- selectors
30
- end
31
-
32
28
  private
33
29
 
34
30
  attr_reader :query_params, :selectors, :options
@@ -0,0 +1,85 @@
1
+ require 'pact_broker/matrix/can_i_deploy_query_schema'
2
+ require 'pact_broker/matrix/parse_can_i_deploy_query'
3
+
4
+ module PactBroker
5
+ module Api
6
+ module Resources
7
+ class CanIDeployBadge < BaseResource
8
+ def initialize
9
+ super
10
+ selector = PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: pacticipant_name, latest: true, tag: identifier_from_path[:tag])
11
+ @options = {
12
+ latestby: 'cvp',
13
+ latest: true,
14
+ tag: identifier_from_path[:to]
15
+ }
16
+ @selectors = [selector]
17
+ end
18
+
19
+ def allowed_methods
20
+ ["GET", "OPTIONS"]
21
+ end
22
+
23
+ def content_types_provided
24
+ [['image/svg+xml', :to_svg]]
25
+ end
26
+
27
+ def resource_exists?
28
+ false
29
+ end
30
+
31
+ # Only called if resource_exists? returns false
32
+ def previously_existed?
33
+ true
34
+ end
35
+
36
+ def is_authorized?(authorization_header)
37
+ super || PactBroker.configuration.enable_public_badge_access
38
+ end
39
+
40
+ def forbidden?
41
+ false
42
+ end
43
+
44
+ def moved_temporarily?
45
+ response.headers['Cache-Control'] = 'no-cache'
46
+ begin
47
+ if pacticipant
48
+ if version
49
+ badge_service.can_i_deploy_badge_url(identifier_from_path[:tag], identifier_from_path[:to], label, results.deployable?)
50
+ else
51
+ badge_service.error_badge_url("version", "not found")
52
+ end
53
+ else
54
+ badge_service.error_badge_url(selectors.first.pacticipant_name, "not found")
55
+ end
56
+ rescue StandardError => e
57
+ # Want to render a badge, even if there's an error
58
+ badge_service.error_badge_url("error", ErrorHandler.display_message(e, "reference: #{ErrorHandler.generate_error_reference}"))
59
+ end
60
+ end
61
+
62
+ def policy_name
63
+ :'badges::badge'
64
+ end
65
+
66
+ private
67
+
68
+ attr_reader :selectors, :options
69
+
70
+ def results
71
+ @results ||= matrix_service.find(selectors, options)
72
+ end
73
+
74
+ def version
75
+ @version ||= version_service.find_by_pacticipant_name_and_latest_tag(identifier_from_path[:pacticipant_name], identifier_from_path[:tag])
76
+ end
77
+
78
+ def label
79
+ lab = request.query['label']
80
+ lab && !lab.empty? ? lab : nil
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,40 @@
1
+ require 'pact_broker/api/resources/matrix'
2
+ require 'pact_broker/matrix/can_i_deploy_query_schema'
3
+ require 'pact_broker/matrix/parse_can_i_deploy_query'
4
+
5
+ module PactBroker
6
+ module Api
7
+ module Resources
8
+ class CanIDeployPacticipantVersion < Matrix
9
+ def initialize
10
+ super
11
+ selector = PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: pacticipant_name, latest: true, tag: identifier_from_path[:tag])
12
+ @options = {
13
+ latestby: 'cvp',
14
+ latest: true,
15
+ tag: identifier_from_path[:to]
16
+ }
17
+ @selectors = [selector]
18
+ end
19
+
20
+ def resource_exists?
21
+ !!version
22
+ end
23
+
24
+ def policy_name
25
+ :'matrix::can_i_deploy'
26
+ end
27
+
28
+ private
29
+
30
+ def version
31
+ @version ||= version_service.find_by_pacticipant_name_and_latest_tag(identifier_from_path[:pacticipant_name], identifier_from_path[:tag])
32
+ end
33
+
34
+ def results
35
+ @results ||= matrix_service.find(selectors, options)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -202,6 +202,15 @@ module PactBroker
202
202
  @pact ||= pact_service.find_pact(pact_params)
203
203
  end
204
204
 
205
+ # Not necessarily an existing integration
206
+ def integration
207
+ if consumer_specified? && provider_specified?
208
+ OpenStruct.new(consumer: consumer, provider: provider)
209
+ else
210
+ nil
211
+ end
212
+ end
213
+
205
214
  def database_connector
206
215
  request.env["pactbroker.database_connector"]
207
216
  end
@@ -32,11 +32,11 @@ module PactBroker
32
32
  PactBroker.configuration.warning_error_classes.any? { |clazz| e.is_a?(clazz) }
33
33
  end
34
34
 
35
- def self.display_message(e, error_reference)
35
+ def self.display_message(e, obfuscated_message)
36
36
  if PactBroker.configuration.show_backtrace_in_error_response?
37
- e.message || obfuscated_error_message(error_reference)
37
+ e.message || obfuscated_message
38
38
  else
39
- reportable?(e) ? obfuscated_error_message(error_reference) : e.message
39
+ reportable?(e) ? obfuscated_message : e.message
40
40
  end
41
41
  end
42
42
 
@@ -47,7 +47,7 @@ module PactBroker
47
47
  def self.response_body_hash e, error_reference
48
48
  response_body = {
49
49
  error: {
50
- message: display_message(e, error_reference),
50
+ message: display_message(e, obfuscated_error_message(error_reference)),
51
51
  reference: error_reference
52
52
  }
53
53
  }
@@ -4,9 +4,7 @@ require 'pact_broker/error'
4
4
  module PactBroker
5
5
  module Api
6
6
  module Resources
7
-
8
7
  class ErrorTest < BaseResource
9
-
10
8
  def content_types_provided
11
9
  [
12
10
  ["application/hal+json", :to_json]
@@ -24,6 +22,10 @@ module PactBroker
24
22
  def process_post
25
23
  raise PactBroker::TestError.new("Don't panic. This is a test API error.")
26
24
  end
25
+
26
+ def policy_name
27
+ :'default'
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -26,10 +26,6 @@ module PactBroker
26
26
  :'groups::group'
27
27
  end
28
28
 
29
- def policy_record
30
- pacticipant
31
- end
32
-
33
29
  private
34
30
 
35
31
  def group