Skip to content

Commit

Permalink
chore: add test data builder methods for verification success and fai…
Browse files Browse the repository at this point in the history
…lure webhooks
  • Loading branch information
bethesque committed Dec 5, 2019
1 parent 6735da3 commit 72ff965
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions lib/pact_broker/test/test_data_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ def create_global_verification_webhook parameters = {}
create_webhook(parameters.merge(consumer: nil, provider: nil, event_names: [PactBroker::Webhooks::WebhookEvent::VERIFICATION_PUBLISHED]))
end

def create_global_verification_succeeded_webhook parameters = {}
create_webhook(parameters.merge(consumer: nil, provider: nil, event_names: [PactBroker::Webhooks::WebhookEvent::VERIFICATION_SUCCEEDED]))
end

def create_global_verification_failed_webhook parameters = {}
create_webhook(parameters.merge(consumer: nil, provider: nil, event_names: [PactBroker::Webhooks::WebhookEvent::VERIFICATION_FAILED]))
end

def create_provider_webhook parameters = {}
create_webhook(parameters.merge(consumer: nil))
end
Expand Down
12 changes: 10 additions & 2 deletions script/seed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@
'githubVerificationStatus' => '${pactbroker.githubVerificationStatus}'
}

# .create_global_webhook(
# method: 'POST',
# url: "http://localhost:9292/pact-changed-webhook",
# body: webhook_body.to_json,
# username: "foo",
# password: "bar")
TestDataBuilder.new
.create_global_webhook(method: 'POST', url: "http://localhost:9292/pact-changed-webhook", body: webhook_body.to_json, username: "foo", password: "bar")
.create_global_verification_webhook(method: 'POST', url: "http://localhost:9292/verification-published-webhook", body: webhook_body.to_json)
.create_global_verification_succeeded_webhook(
method: 'POST',
url: "http://localhost:9292/verification-published-webhook",
body: webhook_body.to_json)
# .create_certificate(path: 'spec/fixtures/certificates/self-signed.badssl.com.pem')
# .create_consumer("Bethtest")
# .create_verification_webhook(method: 'GET', url: "http://localhost:9292", body: webhook_body, username: "foo", password: "bar", headers: {"Accept" => "application/json"})
Expand Down

0 comments on commit 72ff965

Please sign in to comment.