|
9 | 9 | require 'mapi/convert'
|
10 | 10 |
|
11 | 11 | class TestMsg < Test::Unit::TestCase
|
12 |
| - def test_blammo |
13 |
| - Mapi::Msg.open "#{TEST_DIR}/test_Blammo.msg" do |msg| |
14 |
| - assert_equal '"TripleNickel" <[email protected]>', msg.from |
15 |
| - assert_equal 'BlammoBlammo', msg.subject |
16 |
| - assert_equal 0, msg.recipients.length |
17 |
| - assert_equal 0, msg.attachments.length |
18 |
| - # this is all properties |
19 |
| - assert_equal 66, msg.properties.raw.length |
20 |
| - # this is unique named properties |
21 |
| - assert_equal 48, msg.properties.to_h.length |
22 |
| - # test accessing the named property keys - same name but different namespace |
23 |
| - assert_equal 'Yippee555', msg.props['Name4', Ole::Types::Clsid.parse('55555555-5555-5555-c000-000000000046')] |
24 |
| - assert_equal 'Yippee666', msg.props['Name4', Ole::Types::Clsid.parse('66666666-6666-6666-c000-000000000046')] |
25 |
| - end |
26 |
| - end |
| 12 | + def test_blammo |
| 13 | + Mapi::Msg.open "#{TEST_DIR}/test_Blammo.msg" do |msg| |
| 14 | + assert_equal '"TripleNickel" <[email protected]>', msg.from |
| 15 | + assert_equal 'BlammoBlammo', msg.subject |
| 16 | + assert_equal 0, msg.recipients.length |
| 17 | + assert_equal 0, msg.attachments.length |
| 18 | + # this is all properties |
| 19 | + assert_equal 66, msg.properties.raw.length |
| 20 | + # this is unique named properties |
| 21 | + assert_equal 48, msg.properties.to_h.length |
| 22 | + # test accessing the named property keys - same name but different namespace |
| 23 | + assert_equal 'Yippee555', msg.props['Name4', Ole::Types::Clsid.parse('55555555-5555-5555-c000-000000000046')] |
| 24 | + assert_equal 'Yippee666', msg.props['Name4', Ole::Types::Clsid.parse('66666666-6666-6666-c000-000000000046')] |
| 25 | + end |
| 26 | + end |
27 | 27 |
|
28 | 28 |
|
29 |
| - def test_rtf_to_html_returns_valid_utf8 |
30 |
| - msg = Mapi::Msg.open "#{TEST_DIR}/multipart-with-html.msg" do |msg| |
31 |
| - assert_equal 1, msg.recipients.length |
32 |
| - assert_equal 3, msg.attachments.length |
33 |
| - html_part = msg.to_mime.parts[0].parts[1].to_s |
34 |
| - if html_part.respond_to?(:encoding) |
35 |
| - assert_equal 'UTF-8', html_part.encoding.to_s |
36 |
| - assert html_part.valid_encoding? |
37 |
| - end |
38 |
| - end |
39 |
| - end |
| 29 | + def test_rendered_string_is_valid_encoding |
| 30 | + msg = Mapi::Msg.open "#{TEST_DIR}/multipart-with-html.msg" do |msg| |
| 31 | + string_version = msg.to_mime.to_s |
| 32 | + if string_version.respond_to?(:valid_encoding?) |
| 33 | + assert_equal true, string_version.valid_encoding? |
| 34 | + end |
| 35 | + end |
| 36 | + end |
40 | 37 |
|
41 |
| - def test_embedded_msg_renders_as_string |
42 |
| - msg = Mapi::Msg.open "#{TEST_DIR}/embedded.msg" do |msg| |
43 |
| - assert_match "message/rfc822", msg.to_mime.to_s |
44 |
| - end |
45 |
| - end |
| 38 | + def test_embedded_msg_renders_as_string |
| 39 | + msg = Mapi::Msg.open "#{TEST_DIR}/embedded.msg" do |msg| |
| 40 | + assert_match "message/rfc822", msg.to_mime.to_s |
| 41 | + end |
| 42 | + end |
46 | 43 | end
|
47 | 44 |
|
0 commit comments