$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'test/unit' require 'rubygems' require 'mms2r' require 'mms2r/media' require 'tmail/mail' require 'logger' class MMS2RTMobileTest < Test::Unit::TestCase def setup @log = Logger.new(STDOUT) @log.level = Logger::DEBUG @log.datetime_format = "%H:%M:%S" msg = < From: 2068675309@tmomail.net To: tommytutone@example.com Subject: ads are bad Date: Fri, 29 Dec 2006 17:48:41 -0800 Mime-Version: 1.0 Content-Type: multipart/related; type="text/html"; boundary="----=_Part_6032807_21271850.1167443321223" Importance: Normal X-MMS-Message-Type: MM4_forward.REQ X-Priority: 3 ------=_Part_6032807_21271850.1167443321223 Content-Type: text/html Content-Transfer-Encoding: quoted-printable Content-ID: <0000> Content-Disposition: inline =09=09T-Mobile=20 =09=09 =09=09 =09 =09 =09=09 =09=09=09 =09=09=09=09 =09=09=09=09 =09=09=09=09 =09=09=09 =09=09=09 =09=09=09=09 =09=09=09 =09=09=09 =09=09=09=09 =09=09=09=09 =09=09=09 =09=09=09=09 =09=09=09=09 =09=09=09 =09=09=09 =09=09=09=09 =09=09=09=09
=09=09=09=09 =09=09=09=09
=20 =09=09=09=09 =09=09=09=09

This mes= sage was sent from a T-Mobile wireless phone.
------=_Part_6032807_21271850.1167443321223 Content-Type: image/jpeg; name=12-01-06_1234.jpg Content-Transfer-Encoding: base64 Content-Location: 12-01-06_1234.jpg Content-ID: <280> R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw== ------=_Part_6032807_21271850.1167443321223 Content-Type: image/gif; name=audio.gif Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=audio.gif Content-ID: R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw== ------=_Part_6032807_21271850.1167443321223 Content-Type: image/gif; name=dottedline600.gif Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=dottedline600.gif Content-ID: R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw== ------=_Part_6032807_21271850.1167443321223 Content-Type: image/gif; name=tmobilelogo.gif Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=tmobilelogo.gif Content-ID: R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw== ------=_Part_6032807_21271850.1167443321223 Content-Type: image/gif; name=tmobilespace.gif Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=tmobilespace.gif Content-ID: R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw== ------=_Part_6032807_21271850.1167443321223 Content-Type: image/gif; name=video.gif Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=video.gif Content-ID: R0lGODlhAQABAIAAAP///wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw== ------=_Part_6032807_21271850.1167443321223-- EOF @simple_image_mail = TMail::Mail.parse(msg) end def teadown; end def test_ignore_simple_image mms = MMS2R::Media.create(@simple_image_mail) mms.process assert(mms.media.size == 1) assert(File.basename(mms.media['image/jpeg'][0]).eql?('12-01-06_1234.jpg')) mms.purge end end