Commit d17779b9 authored by Michał "rysiek" Woźniak's avatar Michał "rysiek" Woźniak 🔒

Fixes based on @paz comments in !302

parent ffc176ea
Pipeline #33345 failed with stages
in 15 minutes and 21 seconds
class AddDeliverSelfSentToList < ActiveRecord::Migration
class AddDeliverSelfsentToList < ActiveRecord::Migration
def up
if ! column_exists?(:lists, :deliver_selfsent)
add_column :lists, :deliver_selfsent, :boolean, default: true
......
......@@ -745,7 +745,6 @@ describe Schleuder::List do
it "sends the message to all subscribers including the sender, if deliver_selfsent is true and the mail is correctly signed" do
list = create(:list, send_encrypted_only: false, deliver_selfsent: true)
key_material = File.read("spec/fixtures/default_list_key.txt")
sub, msgs = list.subscribe("admin@example.org", nil, true, true, key_material)
key_material = File.read("spec/fixtures/example_key.txt")
sub, msgs = list.subscribe("user1@example.org", nil, false, true, key_material)
......@@ -756,12 +755,16 @@ describe Schleuder::List do
mail.body = "Some content"
gpg_opts = {
sign: true,
sign_as: 'C4D60F8833789C7CAA44496FD3FFA6613AB10ECE'
sign_as: '59C71FB38AEE22E091C78259D06350440F759BD3'
}
mail.gpg(gpg_opts)
mail.deliver
signed_mail = Mail::TestMailer.deliveries.first
Mail::TestMailer.deliveries.clear
Schleuder::Runner.new().run(signed_mail.to_s, list.email)
Schleuder::Runner.new().run(mail, list.email)
messages = Mail::TestMailer.deliveries
recipients = messages.map { |m| m.to.first }.sort
......@@ -778,7 +781,6 @@ describe Schleuder::List do
it "sends the message to all subscribers but not the sender, if deliver_selfsent is false and the mail is correctly signed" do
list = create(:list, send_encrypted_only: false, deliver_selfsent: false)
key_material = File.read("spec/fixtures/default_list_key.txt")
sub, msgs = list.subscribe("admin@example.org", nil, true, true, key_material)
key_material = File.read("spec/fixtures/example_key.txt")
sub, msgs = list.subscribe("user1@example.org", nil, false, true, key_material)
......@@ -789,11 +791,16 @@ describe Schleuder::List do
mail.body = "Some content"
gpg_opts = {
sign: true,
sign_as: 'C4D60F8833789C7CAA44496FD3FFA6613AB10ECE'
sign_as: '59C71FB38AEE22E091C78259D06350440F759BD3'
}
mail.gpg(gpg_opts)
Schleuder::Runner.new().run(mail, list.email)
mail.deliver
signed_mail = Mail::TestMailer.deliveries.first
Mail::TestMailer.deliveries.clear
Schleuder::Runner.new().run(signed_mail.to_s, list.email)
messages = Mail::TestMailer.deliveries
recipients = messages.map { |m| m.to.first }.sort
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment