aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2007-10-09 13:34:51 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2007-10-09 13:34:51 +0000
commit19c9c7fafbc7c808c080317a1326c4fbc6068bea (patch)
tree7244a25cc5c1cb33ef2c0986e6f1da26a47acc69 /actionmailer/test
parentd556f466079d329ee678afe0c11db914894cb4b0 (diff)
downloadrails-19c9c7fafbc7c808c080317a1326c4fbc6068bea.tar.gz
rails-19c9c7fafbc7c808c080317a1326c4fbc6068bea.tar.bz2
rails-19c9c7fafbc7c808c080317a1326c4fbc6068bea.zip
Set default charset of MTAs to ISO instead of us-ascii (unless reported otherwise)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7819 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rw-r--r--actionmailer/test/quoting_test.rb44
1 files changed, 42 insertions, 2 deletions
diff --git a/actionmailer/test/quoting_test.rb b/actionmailer/test/quoting_test.rb
index 243c982fc9..4af9014e43 100644
--- a/actionmailer/test/quoting_test.rb
+++ b/actionmailer/test/quoting_test.rb
@@ -3,6 +3,44 @@ require 'tmail'
require 'tempfile'
class QuotingTest < Test::Unit::TestCase
+
+ # Move some tests from TMAIL here
+ def test_unquote_quoted_printable
+ a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
+ assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
+ end
+
+ def test_unquote_base64
+ a ="=?ISO-8859-1?B?WzE2NjQxN10gQmVrcuZmdGVsc2UgZnJhIFJlanNlZmViZXI=?="
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
+ assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
+ end
+
+ def test_unquote_without_charset
+ a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
+ assert_equal "[166417]_Bekr=E6ftelse_fra_Rejsefeber", b
+ end
+
+ def test_unqoute_multiple
+ a ="=?utf-8?q?Re=3A_=5B12=5D_=23137=3A_Inkonsistente_verwendung_von_=22Hin?==?utf-8?b?enVmw7xnZW4i?="
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
+ assert_equal "Re: [12] #137: Inkonsistente verwendung von \"Hinzuf\303\274gen\"", b
+ end
+
+ def test_unqoute_in_the_middle
+ a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
+ assert_equal "Re: Photos Brosch\303\274re Rand", b
+ end
+
+ def test_unqoute_iso
+ a ="=?ISO-8859-1?Q?Brosch=FCre_Rand?="
+ b = TMail::Unquoter.unquote_and_convert_to(a, 'iso-8859-1')
+ assert_equal "Brosch\374re Rand", b
+ end
+
def test_quote_multibyte_chars
original = "\303\246 \303\270 and \303\245"
@@ -18,7 +56,8 @@ class QuotingTest < Test::Unit::TestCase
unquoted = TMail::Unquoter.unquote_and_convert_to(result, nil)
assert_equal unquoted, original
end
-
+
+
# test an email that has been created using \r\n newlines, instead of
# \n newlines.
def test_email_quoted_with_0d0a
@@ -62,7 +101,7 @@ class QuotingTest < Test::Unit::TestCase
# No .so
end
end
-
+
private
# This whole thing *could* be much simpler, but I don't think Tempfile,
@@ -91,3 +130,4 @@ class QuotingTest < Test::Unit::TestCase
[ File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_encoded_string"), File.read("#{File.dirname(__FILE__)}/fixtures/raw_base64_decoded_string") ]
end
end
+