From 72ff9655ef2452caa2aca5e6a4ca25df2fec3e1c Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 5 Dec 2019 14:23:30 +1100 Subject: [PATCH] chore: add test data builder methods for verification success and failure webhooks --- lib/pact_broker/test/test_data_builder.rb | 8 ++++++++ script/seed.rb | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/pact_broker/test/test_data_builder.rb b/lib/pact_broker/test/test_data_builder.rb index 4dd24a605..5f7717156 100644 --- a/lib/pact_broker/test/test_data_builder.rb +++ b/lib/pact_broker/test/test_data_builder.rb @@ -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 diff --git a/script/seed.rb b/script/seed.rb index e6587d061..4db643398 100755 --- a/script/seed.rb +++ b/script/seed.rb @@ -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"})