mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
add postmark webhook handling (#8919)
This commit is contained in:
@ -138,6 +138,40 @@ describe WebhooksController do
|
||||
end
|
||||
end
|
||||
|
||||
context "postmark" do
|
||||
it "works" do
|
||||
user = Fabricate(:user, email: email)
|
||||
email_log = Fabricate(:email_log, user: user, message_id: message_id, to_address: email)
|
||||
|
||||
post "/webhooks/postmark.json", params: {
|
||||
"Type"=> "HardBounce",
|
||||
"MessageID"=> message_id,
|
||||
"Email"=> email
|
||||
}
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
email_log.reload
|
||||
expect(email_log.bounced).to eq(true)
|
||||
expect(email_log.user.user_stat.bounce_score).to eq(SiteSetting.hard_bounce_score)
|
||||
end
|
||||
it "soft bounces" do
|
||||
user = Fabricate(:user, email: email)
|
||||
email_log = Fabricate(:email_log, user: user, message_id: message_id, to_address: email)
|
||||
|
||||
post "/webhooks/postmark.json", params: {
|
||||
"Type"=> "SoftBounce",
|
||||
"MessageID"=> message_id,
|
||||
"Email"=> email
|
||||
}
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
email_log.reload
|
||||
expect(email_log.bounced).to eq(true)
|
||||
expect(email_log.user.user_stat.bounce_score).to eq(SiteSetting.soft_bounce_score)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "sparkpost" do
|
||||
it "works" do
|
||||
user = Fabricate(:user, email: email)
|
||||
|
Reference in New Issue
Block a user