]> source.dussan.org Git - redmine.git/commitdiff
add S/MIME signature mail test (#31593)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 3 Jun 2020 16:17:03 +0000 (16:17 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 3 Jun 2020 16:17:03 +0000 (16:17 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19808 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/fixtures/mail_handler/smime_signature.eml [new file with mode: 0644]
test/unit/mail_handler_test.rb

diff --git a/test/fixtures/mail_handler/smime_signature.eml b/test/fixtures/mail_handler/smime_signature.eml
new file mode 100644 (file)
index 0000000..61ff4f8
--- /dev/null
@@ -0,0 +1,89 @@
+Return-Path: <JSmith@somenet.foo>\r
+Message-ID: <be1f226987da486a0b50aa59eba6578a94571af0.camel@somenet.foo>\r
+Subject: Self-Signed S/MIME signature\r
+From: JSmith <JSmith@somenet.foo>\r
+To: <redmine@somenet.foo>\r
+Date: Wed, 03 Jun 2020 22:29:36 +0900\r
+Content-Type: multipart/signed; micalg="sha-256";\r
+       protocol="application/x-pkcs7-signature";\r
+       boundary="=-a6R2ultRPmAp8zmxN9qV"\r
+X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) \r
+Mime-Version: 1.0\r
+\r
+\r
+--=-a6R2ultRPmAp8zmxN9qV\r
+Content-Type: multipart/mixed; boundary="=-WFkuWLE/majN4BpDwkgg"\r
+\r
+\r
+--=-WFkuWLE/majN4BpDwkgg\r
+Content-Type: text/plain\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+smime.sh.txt describes how to create Self-Signed S/MIME Certs.\r
+\r
+--=-WFkuWLE/majN4BpDwkgg\r
+Content-Disposition: attachment; filename="smime.sh.txt"\r
+Content-Type: text/plain; name="smime.sh.txt"; charset="UTF-8"\r
+Content-Transfer-Encoding: base64\r
+\r
+IyBCYXNlZCBvbiBodHRwczovL2dpc3QuZ2l0aHViLmNvbS9yaWNoaWVmb3JlbWFuLzMxNjYzODcK\r
+Cm9wZW5zc2wgZ2VucnNhIC1kZXMzIC1vdXQgY2Eua2V5IDQwOTYKb3BlbnNzbCByZXEgLW5ldyAt\r
+eDUwOSAtZGF5cyAzNjUwIC1rZXkgY2Eua2V5IC1vdXQgY2EuY3J0CgpvcGVuc3NsIGdlbnJzYSAt\r
+ZGVzMyAtb3V0IHNtaW1lLmtleSA0MDk2Cm9wZW5zc2wgcmVxIC1uZXcgLWtleSBzbWltZS5rZXkg\r
+LW91dCBzbWltZS5jc3IKb3BlbnNzbCB4NTA5IC1yZXEgLWRheXMgMzY1MCAtaW4gc21pbWUuY3Ny\r
+IC1DQSBjYS5jcnQgLUNBa2V5IGNhLmtleSBcCiAgICAtc2V0X3NlcmlhbCAxIC1vdXQgc21pbWUu\r
+Y3J0IC1zZXRhbGlhcyAiU2VsZiBTaWduZWQgU01JTUUiIFwKICAgIC1hZGR0cnVzdCBlbWFpbFBy\r
+b3RlY3Rpb24gLWFkZHJlamVjdCBjbGllbnRBdXRoIC1hZGRyZWplY3Qgc2VydmVyQXV0aCAtdHJ1\r
+c3RvdXQKb3BlbnNzbCBwa2NzMTIgLWV4cG9ydCAtaW4gc21pbWUuY3J0IC1pbmtleSBzbWltZS5r\r
+ZXkgLW91dCBzbWltZS5wMTIK\r
+\r
+\r
+--=-WFkuWLE/majN4BpDwkgg--\r
+\r
+--=-a6R2ultRPmAp8zmxN9qV\r
+Content-Type: application/x-pkcs7-signature; name="smime.p7s"\r
+Content-Disposition: attachment; filename="smime.p7s"\r
+Content-Transfer-Encoding: base64\r
+\r
+MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCCBSEw\r
+ggUdMIIDBQIBATANBgkqhkiG9w0BAQsFADBCMQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVs\r
+dCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkgTHRkMCAXDTIwMDYwMT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
+oYi/pYpQwoeZsS6tgnBAISqsSpgOPMIn9hpLqLTQsVQyh7F5/0udwrBl+obpgalbyjRGxxAdqD6X\r
+pPxGB+qOMICdjWqPezuvqnAqtu/3RLdusxXYd2m6ZH6c9Cy2GMCAKi48Hd2I+XTzfgj/ToQSjN6d\r
+htzUR3+O6VdkoqEm+1yFSboLTQ/9BzBsY2tJc5oEYZhvSyKIU83RwSmHcYAFtd+m1DKdFHKmIvGG\r
+MyaOfpIE30CVKLT73Gv8UZWQ3usQPu4yQxyWBpkniaQ6i3AVSmOc4mviQSJ7F0Iq5/N9uMD3zAAT\r
+EQRhHOuv1sE9h702Qv6ecj5IVp3RhcudL97y9E9mtHYq9Ixypg0argOUF3ACt3KREG2Vnhc+IbNI\r
+yP9WNpcdOsl3ZhlTVbk4nGsomeVaUf2sgfHyqB7BlHYZiztO9CfYNBSbizArjS3qKB+7pIMHLOxV\r
+Z0eWZUQfOwd7SSEkQYvl3SC1czXxKSRRWkE3hgbIDE0A0veJBZw9PWFfrSBmsLIJfbSAh2mRAAAA\r
+AAAA\r
+\r
+\r
+--=-a6R2ultRPmAp8zmxN9qV--\r
+\r
index 630bf5fc76f3819df217eb64c2486108a8e881be..489106379a5cf0b6051335596a00017c89a024bc 100644 (file)
@@ -1282,6 +1282,22 @@ class MailHandlerTest < ActiveSupport::TestCase
     assert_equal false, MailHandler.safe_receive
   end
 
+  def test_smine_signature
+    issue = submit_email('smime_signature.eml', :issue => {:project => 'onlinestore'})
+    assert issue.is_a?(Issue)
+    assert !issue.new_record?
+    issue.reload
+    assert_equal 'Self-Signed S/MIME signature', issue.subject
+    assert_equal User.find_by_login('jsmith'), issue.author
+    assert_equal Project.find(2), issue.project
+    assert_equal 'smime.sh.txt describes how to create Self-Signed S/MIME Certs.', issue.description
+    assert_equal 2, issue.attachments.size
+    assert_equal 'smime.sh.txt', issue.attachments[0].filename
+    assert_equal 'text/plain', issue.attachments[0].content_type
+    assert_equal 'smime.p7s', issue.attachments[1].filename
+    assert_equal 'application/x-pkcs7-signature', issue.attachments[1].content_type
+  end
+
   private
 
   def submit_email(filename, options={})