mms2r 1.0.7 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/History.txt +19 -1
  2. data/Manifest.txt +38 -19
  3. data/README.txt +40 -8
  4. data/Rakefile +2 -2
  5. data/conf/mms2r_cingular_me_media_subject.yml +3 -0
  6. data/conf/{mms2r_cingularmedia_transform.yml → mms2r_cingular_me_media_transform.yml} +1 -0
  7. data/conf/mms2r_dobson_media_ignore.yml +4 -0
  8. data/conf/mms2r_media_ignore.yml +4 -0
  9. data/conf/mms2r_media_subject.yml +3 -0
  10. data/conf/mms2r_my_cingular_media_subject.yml +3 -0
  11. data/conf/mms2r_nextel_media_ignore.yml +11 -0
  12. data/conf/mms2r_sprint_media_ignore.yml +5 -0
  13. data/conf/mms2r_sprint_media_subject.yml +3 -0
  14. data/conf/{mms2r_tmobilemedia_ignore.yml → mms2r_t_mobile_media_ignore.yml} +2 -5
  15. data/conf/mms2r_verizon_media_ignore.yml +4 -0
  16. data/conf/mms2r_verizon_media_transform.yml +6 -0
  17. data/dev_tools/debug_sprint_hpricot_parsing.rb +82 -0
  18. data/lib/mms2r.rb +61 -0
  19. data/lib/mms2r/cingular_me_media.rb +23 -0
  20. data/lib/mms2r/dobson_media.rb +4 -5
  21. data/lib/mms2r/{mmode_media.rb → m_mode_media.rb} +4 -4
  22. data/lib/mms2r/media.rb +283 -160
  23. data/lib/mms2r/my_cingular_media.rb +15 -0
  24. data/lib/mms2r/nextel_media.rb +9 -3
  25. data/lib/mms2r/sprint_media.rb +137 -29
  26. data/lib/mms2r/sprint_pcs_media.rb +16 -0
  27. data/lib/mms2r/t_mobile_media.rb +21 -0
  28. data/lib/mms2r/verizon_media.rb +11 -3
  29. data/lib/mms2r/vtext_media.rb +16 -0
  30. data/test/files/cingularme-text-02.mail +14 -0
  31. data/test/files/hello_world_empty_text.mail +6 -0
  32. data/test/files/hello_world_mail_multipart.mail +7 -0
  33. data/test/files/{cingular-image-01.mail → mycingular-image-01.mail} +0 -0
  34. data/test/files/simple-with-two-images-two-texts.mail +49 -0
  35. data/test/files/{sprint-image-02.mail → sprint-broken-image-01.mail} +1 -1
  36. data/test/files/sprint-image-01.mail +1 -1
  37. data/test/files/sprint-pcs-text-01.mail +8 -0
  38. data/test/files/sprint-text-01.mail +195 -8
  39. data/test/files/sprint-two-images-01.mail +198 -0
  40. data/test/files/sprint-video-01.mail +1 -1
  41. data/test/files/verizon-image-02.mail +1 -1
  42. data/test/files/vtext-text-01.mail +1 -1
  43. data/test/test_mms2r_cingular_me_media.rb +51 -0
  44. data/test/test_mms2r_dobson_media.rb +46 -0
  45. data/test/{test_mms2r_mmode.rb → test_mms2r_m_mode_media.rb} +1 -1
  46. data/test/test_mms2r_media.rb +160 -74
  47. data/test/test_mms2r_my_cingular_media.rb +31 -0
  48. data/test/test_mms2r_nextel_media.rb +100 -0
  49. data/test/test_mms2r_sprint_media.rb +221 -0
  50. data/test/test_mms2r_sprint_pcs_media.rb +27 -0
  51. data/test/{test_mms2r_tmobile.rb → test_mms2r_t_mobile_media.rb} +13 -13
  52. data/test/test_mms2r_verizon_media.rb +96 -0
  53. data/test/test_mms2r_vtext_media.rb +28 -0
  54. data/vendor/plugins/mms2r/lib/autotest/discover.rb +3 -0
  55. data/vendor/plugins/mms2r/lib/autotest/mms2r.rb +33 -0
  56. metadata +62 -37
  57. data/conf/mms2r_nextelmedia_ignore.yml +0 -10
  58. data/conf/mms2r_sprintmedia_ignore.yml +0 -10
  59. data/conf/mms2r_verizonmedia_ignore.yml +0 -3
  60. data/conf/mms2r_verizonmedia_transform.yml +0 -3
  61. data/lib/mms2r/cingular_media.rb +0 -11
  62. data/lib/mms2r/tmobile_media.rb +0 -11
  63. data/lib/mms2r/version.rb +0 -12
  64. data/test/test_mms2r_cingular.rb +0 -58
  65. data/test/test_mms2r_dobson.rb +0 -36
  66. data/test/test_mms2r_nextel.rb +0 -132
  67. data/test/test_mms2r_sprint.rb +0 -174
  68. data/test/test_mms2r_verizon.rb +0 -102
@@ -0,0 +1,28 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+ require File.dirname(__FILE__) + "/test_helper"
3
+ require 'test/unit'
4
+ require 'rubygems'
5
+ require 'mms2r'
6
+ require 'mms2r/media'
7
+ require 'tmail/mail'
8
+ require 'logger'
9
+
10
+ class MMS2R::VtextMediaTest < Test::Unit::TestCase
11
+ include MMS2R::TestHelper
12
+
13
+ def test_simple_text_vtext
14
+
15
+ mail = TMail::Mail.parse(load_mail('vtext-text-01.mail').join)
16
+ mms = MMS2R::Media.create(mail)
17
+ assert_equal(MMS2R::VtextMedia, mms.class, "expected a #{MMS2R::VtextMedia} and received a #{mms.class}")
18
+ mms.process
19
+ assert_not_nil(mms.media['text/plain'])
20
+ file = mms.media['text/plain'][0]
21
+ assert_not_nil(file)
22
+ assert(File::exist?(file), "file #{file} does not exist")
23
+ text = IO.readlines("#{file}").join
24
+ assert_match(/hello world/, text)
25
+ mms.purge
26
+ end
27
+
28
+ end
@@ -0,0 +1,3 @@
1
+ Autotest.add_discovery do
2
+ "mms2r"
3
+ end
@@ -0,0 +1,33 @@
1
+ require 'autotest'
2
+
3
+ class Autotest::Mms2r < Autotest
4
+
5
+ def initialize # :nodoc:
6
+ super
7
+ @exceptions = /\.svn|test\/files|test\/test_helper|doc\/|lib\/vendor|coverage\//
8
+ @test_mappings = {
9
+ %r%^conf/(mms2r_.*media)_(subject|transform|ignore)\.yml% => proc { |_, m|
10
+ ["test/test_#{m[1]}.rb"]
11
+ },
12
+ %r%^lib/mms2r/(.+)\.rb$% => proc { |_, m|
13
+ ["test/test_mms2r_#{m[1]}.rb"]
14
+ },
15
+ %r%^lib/mms2r.rb$% => proc { |_, m|
16
+ ["test/test_mms2r_media.rb"]
17
+ },
18
+ %r%^test/test_mms2r_.*media\.rb$% => proc { |filename, _|
19
+ filename
20
+ }
21
+ }
22
+ end
23
+
24
+ def path_to_classname(s)
25
+ f = s.sub(/.*test_mms2r_(.+).rb$/, '\1')
26
+ f = f.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }
27
+ f.unshift("MMS2R")
28
+ l = f.pop
29
+ f.push( l =~ /Test$/ ? l : "#{l}Test" )
30
+ f.join('::')
31
+ end
32
+
33
+ end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: mms2r
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.7
7
- date: 2007-04-27 00:00:00 -07:00
8
- summary: Extract media from MMS
6
+ version: 1.1.0
7
+ date: 2007-06-08 00:00:00 -07:00
8
+ summary: Extract user media from MMS (and not carrier cruft)
9
9
  require_paths:
10
10
  - lib
11
- email: mike@mondragon.cc
11
+ email: mikemondragon@gmail.com
12
12
  homepage: http://mms2r.rubyforge.org/
13
13
  rubyforge_project: mms2r
14
- description: "== DESCRIPTION: MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the cellphone carriers. MMS messages are multipart email and the carriers often inject branding into these messages. Use MMS2R if you want to get at the real user generated content from a MMS without having to deal with the garbage from the carriers. If MMS2R is not aware of a particular carrier no extra processing is done to the MMS other than decoding and consolidating its media. Contact the author to add additional carriers to be processed by the library. Suggestions and patches appreciated and welcomed! Corpus of carriers currently processed by MMS2R: * AT&T/Cingular => mmode.com * Cingular => mms.mycingular.com * Cingular => cingularme.com * Dobson/Cellular One => mms.dobson.net * Nextel => messaging.nextel.com * Sprint => pm.sprint.com * Sprint => messaging.sprintpcs.com * T-Mobile => tmomail.net * Verizon => vzwpix.com * Verizon => vtext.com"
14
+ description: "== DESCRIPTION: MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the cellphone carriers. MMS messages are multipart email and the carriers often inject branding into these messages. Use MMS2R if you want to get at the real user generated content from a MMS without having to deal with the cruft from the carriers. If MMS2R is not aware of a particular carrier no extra processing is done to the MMS other than decoding and consolidating its media. Contact the author to add additional carriers to be processed by the library. Suggestions and patches appreciated and welcomed! Corpus of carriers currently processed by MMS2R: * AT&T/Cingular => mmode.com * Cingular => mms.mycingular.com * Cingular => cingularme.com * Dobson/Cellular One => mms.dobson.net * Nextel => messaging.nextel.com * Sprint => pm.sprint.com * Sprint => messaging.sprintpcs.com * T-Mobile => tmomail.net * Verizon => vzwpix.com * Verizon => vtext.com"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -33,22 +33,31 @@ files:
33
33
  - Manifest.txt
34
34
  - README.txt
35
35
  - Rakefile
36
- - conf/mms2r_cingularmedia_transform.yml
37
- - conf/mms2r_nextelmedia_ignore.yml
38
- - conf/mms2r_sprintmedia_ignore.yml
39
- - conf/mms2r_tmobilemedia_ignore.yml
40
- - conf/mms2r_verizonmedia_ignore.yml
41
- - conf/mms2r_verizonmedia_transform.yml
36
+ - conf/mms2r_cingular_me_media_subject.yml
37
+ - conf/mms2r_cingular_me_media_transform.yml
38
+ - conf/mms2r_dobson_media_ignore.yml
39
+ - conf/mms2r_media_ignore.yml
40
+ - conf/mms2r_media_subject.yml
41
+ - conf/mms2r_my_cingular_media_subject.yml
42
+ - conf/mms2r_nextel_media_ignore.yml
43
+ - conf/mms2r_sprint_media_ignore.yml
44
+ - conf/mms2r_sprint_media_subject.yml
45
+ - conf/mms2r_t_mobile_media_ignore.yml
46
+ - conf/mms2r_verizon_media_ignore.yml
47
+ - conf/mms2r_verizon_media_transform.yml
48
+ - dev_tools/debug_sprint_hpricot_parsing.rb
42
49
  - lib/mms2r.rb
43
- - lib/mms2r/cingular_media.rb
50
+ - lib/mms2r/cingular_me_media.rb
44
51
  - lib/mms2r/dobson_media.rb
52
+ - lib/mms2r/m_mode_media.rb
45
53
  - lib/mms2r/media.rb
46
- - lib/mms2r/mmode_media.rb
54
+ - lib/mms2r/my_cingular_media.rb
47
55
  - lib/mms2r/nextel_media.rb
48
56
  - lib/mms2r/sprint_media.rb
49
- - lib/mms2r/tmobile_media.rb
57
+ - lib/mms2r/sprint_pcs_media.rb
58
+ - lib/mms2r/t_mobile_media.rb
50
59
  - lib/mms2r/verizon_media.rb
51
- - lib/mms2r/version.rb
60
+ - lib/mms2r/vtext_media.rb
52
61
  - lib/vendor/text/format.rb
53
62
  - lib/vendor/tmail.rb
54
63
  - lib/vendor/tmail/address.rb
@@ -73,23 +82,28 @@ files:
73
82
  - lib/vendor/tmail/stringio.rb
74
83
  - lib/vendor/tmail/tmail.rb
75
84
  - lib/vendor/tmail/utils.rb
76
- - test/files/cingular-image-01.mail
77
85
  - test/files/cingularme-text-01.mail
86
+ - test/files/cingularme-text-02.mail
78
87
  - test/files/dobson-image-01.mail
79
88
  - test/files/dot.jpg
89
+ - test/files/hello_world_empty_text.mail
80
90
  - test/files/hello_world_mail_multipart.mail
81
91
  - test/files/hello_world_mail_plain_no_content_type.mail
82
92
  - test/files/hello_world_mail_plain_with_content_type.mail
83
93
  - test/files/mmode-image-01.mail
94
+ - test/files/mycingular-image-01.mail
84
95
  - test/files/nextel-image-01.mail
85
96
  - test/files/nextel-image-02.mail
86
97
  - test/files/nextel-image-03.mail
87
98
  - test/files/nextel-image-04.mail
99
+ - test/files/simple-with-two-images-two-texts.mail
88
100
  - test/files/simple_image.mail
89
101
  - test/files/simple_multipart_alternative.mail
102
+ - test/files/sprint-broken-image-01.mail
90
103
  - test/files/sprint-image-01.mail
91
- - test/files/sprint-image-02.mail
104
+ - test/files/sprint-pcs-text-01.mail
92
105
  - test/files/sprint-text-01.mail
106
+ - test/files/sprint-two-images-01.mail
93
107
  - test/files/sprint-video-01.mail
94
108
  - test/files/sprint.mov
95
109
  - test/files/tmobile-image-01.mail
@@ -100,28 +114,39 @@ files:
100
114
  - test/files/verizon-video-01.mail
101
115
  - test/files/vtext-text-01.mail
102
116
  - test/test_helper.rb
103
- - test/test_mms2r_cingular.rb
104
- - test/test_mms2r_dobson.rb
117
+ - test/test_mms2r_cingular_me_media.rb
118
+ - test/test_mms2r_dobson_media.rb
119
+ - test/test_mms2r_m_mode_media.rb
105
120
  - test/test_mms2r_media.rb
106
- - test/test_mms2r_mmode.rb
107
- - test/test_mms2r_nextel.rb
108
- - test/test_mms2r_sprint.rb
109
- - test/test_mms2r_tmobile.rb
110
- - test/test_mms2r_verizon.rb
121
+ - test/test_mms2r_my_cingular_media.rb
122
+ - test/test_mms2r_nextel_media.rb
123
+ - test/test_mms2r_sprint_media.rb
124
+ - test/test_mms2r_sprint_pcs_media.rb
125
+ - test/test_mms2r_t_mobile_media.rb
126
+ - test/test_mms2r_verizon_media.rb
127
+ - test/test_mms2r_vtext_media.rb
128
+ - vendor/plugins/mms2r/lib/autotest/discover.rb
129
+ - vendor/plugins/mms2r/lib/autotest/mms2r.rb
111
130
  test_files:
131
+ - test/test_mms2r_cingular_me_media.rb
132
+ - test/test_mms2r_sprint_pcs_media.rb
112
133
  - test/test_mms2r_media.rb
113
- - test/test_mms2r_tmobile.rb
114
- - test/test_mms2r_cingular.rb
115
- - test/test_mms2r_verizon.rb
116
- - test/test_mms2r_sprint.rb
117
- - test/test_mms2r_mmode.rb
118
- - test/test_mms2r_nextel.rb
134
+ - test/test_mms2r_my_cingular_media.rb
135
+ - test/test_mms2r_nextel_media.rb
136
+ - test/test_mms2r_sprint_media.rb
137
+ - test/test_mms2r_vtext_media.rb
138
+ - test/test_mms2r_dobson_media.rb
139
+ - test/test_mms2r_m_mode_media.rb
140
+ - test/test_mms2r_verizon_media.rb
119
141
  - test/test_helper.rb
120
- - test/test_mms2r_dobson.rb
121
- rdoc_options: []
122
-
123
- extra_rdoc_files: []
124
-
142
+ - test/test_mms2r_t_mobile_media.rb
143
+ rdoc_options:
144
+ - --main
145
+ - README.txt
146
+ extra_rdoc_files:
147
+ - History.txt
148
+ - Manifest.txt
149
+ - README.txt
125
150
  executables: []
126
151
 
127
152
  extensions: []
@@ -145,5 +170,5 @@ dependencies:
145
170
  requirements:
146
171
  - - ">="
147
172
  - !ruby/object:Gem::Version
148
- version: 1.2.0
173
+ version: 1.2.1
149
174
  version:
@@ -1,10 +0,0 @@
1
- ---
2
- text/plain:
3
- - This is an MMS message. 2006 Sprint Nextel. All rights reserved.
4
- - This is an MMS message. Please go to
5
- - This is a multi-part message in MIME format.
6
- text/html:
7
- - "<html><body>\n\n<center>This is an MMS message. <br><center> 2006 Sprint Nextel. All rights reserved</center>"
8
- - "<html><body>\n\nThis is an MMS message. <br><center> 2006 Sprint Nextel. All rights reserved</center>\n</body></html>"
9
- - "<html><body>\n\nThis is an MMS message. <br><center> 2006 Sprint Nextel. All rights reserved <br></center>\n</body></html>"
10
- - "<html><body>\n\nThis is an MMS message. Please go to "
@@ -1,10 +0,0 @@
1
- ---
2
- text/plain:
3
- - |-
4
- You have new Picture Mail!
5
-
6
- Click Go/View to see now.
7
- - |-
8
- You have new Video Mail!
9
-
10
- Click Go/View to see now.
@@ -1,3 +0,0 @@
1
- ---
2
- text/plain:
3
- - This message was sent using PIX-FLIX Messaging service from Verizon Wireless!
@@ -1,3 +0,0 @@
1
- ---
2
- text/plain:
3
- "(.*?)\n\nThis message was sent using PIX-FLIX Messaging service from Verizon Wireless!.*" : "\1"
@@ -1,11 +0,0 @@
1
- require 'mms2r'
2
- require 'mms2r/media'
3
-
4
- module MMS2R
5
-
6
- ##
7
- # Cingular version of MMS2R::Media
8
-
9
- class MMS2R::CingularMedia < MMS2R::Media
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- require 'mms2r'
2
- require 'mms2r/media'
3
-
4
- module MMS2R
5
-
6
- ##
7
- # T-Mobile version of MMS2R::Media
8
-
9
- class MMS2R::TMobileMedia < MMS2R::Media
10
- end
11
- end
data/lib/mms2r/version.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'mms2r'
2
-
3
- module MMS2R
4
- class MMS2R::Media
5
-
6
- ##
7
- # MMS2R Library version
8
-
9
- VERSION = '1.0.7'
10
-
11
- end
12
- end
@@ -1,58 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- require File.dirname(__FILE__) + "/test_helper"
3
- require 'test/unit'
4
- require 'rubygems'
5
- require 'mms2r'
6
- require 'mms2r/media'
7
- require 'tmail/mail'
8
- require 'logger'
9
-
10
-
11
- class MMS2RCingularTest < Test::Unit::TestCase
12
- include MMS2R::TestHelper
13
-
14
- def setup
15
- @log = Logger.new(STDOUT)
16
- @log.level = Logger::DEBUG
17
- @log.datetime_format = "%H:%M:%S"
18
- end
19
-
20
- def teardown; end
21
-
22
- def test_clean_text_ad
23
- mail = TMail::Mail.parse(load_mail('cingularme-text-01.mail').join)
24
- mms = MMS2R::Media.create(mail)
25
- assert_equal(MMS2R::CingularMedia, mms.class, "expected a #{MMS2R::CingularMedia} and received a #{mms.class}")
26
- mms.process
27
- assert_not_nil(mms.media['text/plain'])
28
- file = mms.media['text/plain'][0]
29
- assert_not_nil(file)
30
- assert(File::exist?(file), "file #{file} does not exist")
31
- text = IO.readlines("#{file}").join
32
- ad = "\n--\n===============================================\nBrought to you by, Cingular Wireless Messaging\nhttp://www.CingularMe.COM/"
33
- assert_no_match(/#{ad}/m, text)
34
- assert_no_match(/Brought to you by, Cingular Wireless Messaging/, text)
35
- good_text = "hello world\n\n"
36
- assert_match(/#{good_text}/m, text)
37
- mms.purge
38
- end
39
-
40
- def test_image
41
- mail = TMail::Mail.parse(load_mail('cingular-image-01.mail').join)
42
- mms = MMS2R::Media.create(mail)
43
- assert_equal(MMS2R::CingularMedia, mms.class, "expected a #{MMS2R::CingularMedia} and received a #{mms.class}")
44
- mms.process
45
-
46
- assert(mms.media.size == 2, "Size is #{mms.media.size}")
47
- assert_not_nil(mms.media['text/plain'])
48
- assert_not_nil(mms.media['image/jpeg'][0])
49
- assert_match(/04-18-07_1723.jpg$/, mms.media['image/jpeg'][0])
50
-
51
- assert_equal(nil, mms.get_subject, "Default Cingular subject not stripped")
52
- assert_file_size(mms.media['image/jpeg'][0], 337)
53
-
54
- assert_equal("Water", IO.readlines(mms.get_text.path).join)
55
-
56
- mms.purge
57
- end
58
- end
@@ -1,36 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- require File.dirname(__FILE__) + "/test_helper"
3
- require 'test/unit'
4
- require 'rubygems'
5
- require 'mms2r'
6
- require 'mms2r/media'
7
- require 'tmail/mail'
8
- require 'logger'
9
-
10
-
11
- class MMS2RDobson < Test::Unit::TestCase
12
- include MMS2R::TestHelper
13
-
14
- def test_dobson_image
15
- mail = TMail::Mail.parse(load_mail('dobson-image-01.mail').join)
16
- mms = MMS2R::Media.create(mail)
17
- assert_equal(mms.class, MMS2R::DobsonMedia)
18
-
19
- mms.process
20
-
21
- assert(mms.media.size == 3, "Size is #{mms.media.size}")
22
- assert_not_nil(mms.media['text/plain'])
23
- assert_not_nil(mms.media['application/smil']) # dobson phones have weird SMIL that can be ignored.
24
- assert_not_nil(mms.media['image/jpeg'][0])
25
- assert_match(/04-18-07_1723.jpg$/, mms.media['image/jpeg'][0])
26
-
27
- assert_file_size(mms.media['image/jpeg'][0], 337)
28
-
29
- file = mms.media['text/plain'][0]
30
- assert_not_nil(file)
31
- assert(File::exist?(file), "file #{file} does not exist")
32
- text = IO.readlines("#{file}").join
33
- assert_equal "Body", text.strip
34
- mms.purge
35
- end
36
- end
@@ -1,132 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- require File.dirname(__FILE__) + "/test_helper"
3
- require 'test/unit'
4
- require 'rubygems'
5
- require 'mms2r'
6
- require 'mms2r/media'
7
- require 'tmail/mail'
8
- require 'logger'
9
-
10
- class MMS2RNextelTest < Test::Unit::TestCase
11
- include MMS2R::TestHelper
12
-
13
- def setup
14
- @log = Logger.new(STDOUT)
15
- @log.level = Logger::DEBUG
16
- @log.datetime_format = "%H:%M:%S"
17
- end
18
-
19
- def teardown; end
20
-
21
- def test_simple_get_text_is_nil
22
- mail = TMail::Mail.parse(load_mail('nextel-image-01.mail').join)
23
- mms = MMS2R::Media.create(mail)
24
- mms.process
25
-
26
- assert_nil(mms.get_text)
27
-
28
- mms.purge
29
- end
30
-
31
- def test_simple_get_text
32
- mail = TMail::Mail.parse(load_mail('cingularme-text-01.mail').join)
33
- mms = MMS2R::Media.create(mail)
34
- mms.process
35
-
36
- file = mms.get_text
37
- assert_file_size(file, 13)
38
- assert_match(/\.txt$/, file.original_filename)
39
- assert_equal(13, file.size)
40
- assert_match(/\.txt$/, file.local_path)
41
-
42
- mms.purge
43
- end
44
-
45
- def test_simple_get_media_is_nil
46
- mail = TMail::Mail.parse(load_mail('cingularme-text-01.mail').join)
47
- mms = MMS2R::Media.create(mail)
48
- mms.process
49
-
50
- assert_nil(mms.get_media)
51
-
52
- mms.purge
53
- end
54
-
55
- def test_simple_get_media
56
- mail = TMail::Mail.parse(load_mail('nextel-image-01.mail').join)
57
- mms = MMS2R::Media.create(mail)
58
- mms.process
59
-
60
- file = mms.get_media
61
- assert_file_size(file, 337)
62
- assert_equal('Jan15_0001.jpg', file.original_filename)
63
- assert_equal(337, file.size)
64
- assert_match(/Jan15_0001.jpg$/, file.local_path)
65
-
66
- mms.purge
67
- end
68
-
69
- def test_simple_image1
70
- mail = TMail::Mail.parse(load_mail('nextel-image-01.mail').join)
71
- mms = MMS2R::Media.create(mail)
72
- mms.process
73
-
74
- assert(mms.media.size == 1)
75
- assert_nil(mms.media['text/plain'])
76
- assert_nil(mms.media['text/html'])
77
- assert_not_nil(mms.media['image/jpeg'][0])
78
- assert_match(/Jan15_0001.jpg$/, mms.media['image/jpeg'][0])
79
-
80
- assert_file_size(mms.media['image/jpeg'][0], 337)
81
-
82
- mms.purge
83
- end
84
-
85
- def test_simple_image2
86
- mail = TMail::Mail.parse(load_mail('nextel-image-02.mail').join)
87
- mms = MMS2R::Media.create(mail)
88
- mms.process
89
-
90
- assert(mms.media.size == 1)
91
- assert_nil(mms.media['text/plain'])
92
- assert_nil(mms.media['text/html'])
93
- assert_not_nil(mms.media['image/jpeg'][0])
94
- assert_match(/Mar12_0001.jpg$/, mms.media['image/jpeg'][0])
95
-
96
- assert_file_size(mms.media['image/jpeg'][0], 337)
97
-
98
- mms.purge
99
- end
100
-
101
- def test_simple_image3
102
- mail = TMail::Mail.parse(load_mail('nextel-image-03.mail').join)
103
- mms = MMS2R::Media.create(mail)
104
- mms.process
105
-
106
- assert(mms.media.size == 1)
107
- assert_nil(mms.media['text/plain'])
108
- assert_nil(mms.media['text/html'])
109
- assert_not_nil(mms.media['image/jpeg'][0])
110
- assert_match(/Apr01_0001.jpg$/, mms.media['image/jpeg'][0])
111
-
112
- assert_file_size(mms.media['image/jpeg'][0], 337)
113
-
114
- mms.purge
115
- end
116
-
117
- def test_simple_image4
118
- mail = TMail::Mail.parse(load_mail('nextel-image-04.mail').join)
119
- mms = MMS2R::Media.create(mail)
120
- mms.process
121
-
122
- assert(mms.media.size == 1)
123
- assert_nil(mms.media['text/plain'])
124
- assert_nil(mms.media['text/html'])
125
- assert_not_nil(mms.media['image/jpeg'][0])
126
- assert_match(/Mar20_0001.jpg$/, mms.media['image/jpeg'][0])
127
-
128
- assert_file_size(mms.media['image/jpeg'][0], 337)
129
-
130
- mms.purge
131
- end
132
- end